Jellyfin.service code=exited, status=143

After installing jellyfin version 10.5.2-1 on Manjaro through the aur, it doesn’t wanna start anymore. When I do systemctl status jellyfin it shows code=exited, status=143.
I tried uninstalling and reinstalling.

[2020-04-02 00:28:32.183 -07:00] [INF] Jellyfin version: "10.5.2"
[2020-04-02 00:28:32.199 -07:00] [INF] Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll", "--datadir", "/var/lib/jellyfin", "--cachedir", "/var/cache/jellyfin", ""]
[2020-04-02 00:28:32.203 -07:00] [INF] Operating system: "Linux"
[2020-04-02 00:28:32.203 -07:00] [INF] Architecture: X64
[2020-04-02 00:28:32.204 -07:00] [INF] 64-Bit Process: True
[2020-04-02 00:28:32.204 -07:00] [INF] User Interactive: True
[2020-04-02 00:28:32.204 -07:00] [INF] Processor count: 16
[2020-04-02 00:28:32.204 -07:00] [INF] Program data path: "/var/lib/jellyfin"
[2020-04-02 00:28:32.204 -07:00] [INF] Web resources path: "/usr/lib/jellyfin/bin/jellyfin-web"
[2020-04-02 00:28:32.204 -07:00] [INF] Application directory: "/usr/lib/jellyfin/bin/"
[2020-04-02 00:28:32.339 -07:00] [INF] Setting cache path: "/var/cache/jellyfin"
[2020-04-02 00:28:32.361 -07:00] [INF] Loading assemblies
[2020-04-02 00:28:32.369 -07:00] [INF] Loaded assembly "Emby.AutoOrganize, Version=, Culture=neutral, PublicKeyToken=null" from "/var/lib/jellyfin/plugins/Auto Organize/Emby.AutoOrganize.dll"
[2020-04-02 00:28:32.370 -07:00] [INF] Loaded assembly "Jellyfin.Plugin.OpenSubtitles, Version=, Culture=neutral, PublicKeyToken=null" from "/var/lib/jellyfin/plugins/Open Subtitles/Jellyfin.Plugin.OpenSubtitles.dll"
[2020-04-02 00:28:32.370 -07:00] [INF] Loaded assembly "OpenSubtitlesHandler, Version=, Culture=neutral, PublicKeyToken=null" from "/var/lib/jellyfin/plugins/Open Subtitles/OpenSubtitlesHandler.dll"
[2020-04-02 00:28:32.371 -07:00] [INF] Loaded assembly "Jellyfin.Plugin.Bookshelf, Version=, Culture=neutral, PublicKeyToken=null" from "/var/lib/jellyfin/plugins/Bookshelf/Jellyfin.Plugin.Bookshelf.dll"
[2020-04-02 00:28:32.372 -07:00] [INF] Loaded assembly "Jellyfin.Plugin.Reports, Version=, Culture=neutral, PublicKeyToken=null" from "/var/lib/jellyfin/plugins/Reports/Jellyfin.Plugin.Reports.dll"
[2020-04-02 00:28:32.373 -07:00] [INF] Loaded assembly "Jellyfin.Plugin.PlaybackReporting, Version=, Culture=neutral, PublicKeyToken=null" from "/var/lib/jellyfin/plugins/Playback Reporting/Jellyfin.Plugin.PlaybackReporting.dll"
[2020-04-02 00:28:32.632 -07:00] [FTL] Error while starting server.
Corrupt: SQLitePCL.pretty.SQLiteException: database disk image is malformed
   at SQLitePCL.pretty.SQLiteException.Throw(Int32 rc, Int32 extended, String msg)
   at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
   at SQLitePCL.pretty.SQLiteDatabaseConnection.PrepareStatement(String sql, String& tail)
   at SQLitePCL.pretty.DatabaseConnection.PrepareStatement(IDatabaseConnection This, String sql)
   at SQLitePCL.pretty.DatabaseConnection.Execute(IDatabaseConnection This, String sql)
   at Emby.Server.Implementations.Data.BaseSqliteRepository.GetConnection(Boolean _)
   at Emby.Server.Implementations.Data.SqliteItemRepository.Initialize(SqliteUserDataRepository userDataRepo, IUserManager userManager)
   at Emby.Server.Implementations.ApplicationHost.RegisterResources(IServiceCollection serviceCollection)
   at Emby.Server.Implementations.ApplicationHost.InitAsync(IServiceCollection serviceCollection)
   at Jellyfin.Server.Program.StartApp(StartupOptions options)
[2020-04-02 00:28:32.637 -07:00] [INF] Disposing "CoreAppHost"
[2020-04-02 00:28:32.640 -07:00] [INF] Received a SIGTERM signal, shutting down

I realized that my library.db was malformed by doing a integrity check with
sqlite3 library.db "pragma integrity_check"

Then I tried to clean up the library.db with 2 other commands
sqlite3 library.db "reindex nodes"
sqlite3 library.db "reindex pristine"
but neither were able to remove the malformed error.

So I dumped the non-corrupt part of the library.db into a sql file, then renamed the library.db to somthing else, so I can create a new db and insert the sql file into the new db file.

    qlite3 library.db

    sqlite> .mode insert
    sqlite> .output dump_all.sql
    sqlite> .dump
    sqlite> .exit

    mv library.db library-corrupt.db
    sqlite3 library.db

    sqlite> .read dump_all.sql
    sqlite> .exit

I’m not sure what could be going on. The databases right now are a very jumbled mess, with lots of JSON blobs and things all over the place. This is especially bad in the library file.

We’re working on a plan to migrate to a newer setup with better structure, but it’s very slow progress thus far.

Right now, I don’t believe there’s a solution for any corrupt issues.

I installed Jellyfin on docker container and it worked fine until the power tripped and now Jellyfin cannot start again.

docker logs -f jellyfin give me the same error
Database disk image is malformed

Maybe we should write some steps for the users to fix this my themselve.

Any advice ?