Database corruption (Could not apply migration 'FixAudioData') upgrading from v10.9.3 to a newer version #12338
Description
This issue respects the following points:
- This is a bug, not a question or a configuration issue; Please visit our forum or chat rooms first to troubleshoot with volunteers, before creating a report. The links can be found here.
- This issue is not already reported on GitHub (I've searched it).
- I'm using an up to date version of Jellyfin Server stable, unstable or master; We generally do not support previous older versions. If possible, please update to the latest version before opening an issue.
- I agree to follow Jellyfin's Code of Conduct.
- This report addresses only a single issue; If you encounter multiple issues, kindly create separate reports for each one.
Description of the bug
I have been stuck on v10.9.3 since the v10.9.4 release as it caused a database corruption issue.
I have been trying to upgrade again these last 3 days searching for solutions and following the several GitHub issues that have been reported.
- Disable Docker healthcheck to prevent killing the container during the migration
- #12199 (comment), remove
FixAudioDatafrommigrations.xmland ensureIsStartupWizardCompletedistrueonsystem.xml
I have searched what does the FixAudioData migration to solve it in a "hacky" way.
Manually removing all the audio files from library.db TypedBaseItems table and its references on mediastreams table. The migration ran successfully but the library scan failed after few seconds. (All this while having backups).
A comment I consider important. I cannot find any column called HasLyrics or LyricFiles on the tables. I think the issue is coming from here.
Reproduction steps
- Stop Jellyfin container with jellyfin/jellyfin:10.9.3 image
- Upgrade to any newer version, such as jellyfin/jellyfin:latest (current latest as of writing this 10.9.8)
- Container exists with status 0 and a SQLiteException
What is the current bug behavior?
The FixAudioData migration does not run successfully
What is the expected correct behavior?
The upgrade should not throw any errors
Jellyfin Server version
Older*
Specify commit id
No response
Specify unstable release number
No response
Specify version number
10.9.3
Specify the build version
10.9.3
Environment
- OS: Ubuntu 22.04 (LTS)
- Linux Kernel: 5.15.0-116-generic
- Virtualization: Docker
- Clients: any
- Browser: any
- FFmpeg Version: 6.0.1-jellyfin
- Playback Method: N/A
- Hardware Acceleration: none
- GPU Model: none
- Plugins:
- Open Subtitles 20.0.0.0
- Playback Reporting 14.0.0.0
- Reports 17.0.0.0
- Session Cleaner 3.0.0.0
- Webhook 13.0.0.0
- TMDb 10.9.3.0
- Studio Images 10.9.3.0
- OMDb 10.9.3.0
- MusicBrainz 10.9.3.0
- AudioDB 10.9.3.0
- Reverse Proxy: nginx
- Base URL: none
- Networking: Host
- Storage: localJellyfin logs
[11:15:27] [INF] Jellyfin version: 10.9.8
[11:15:27] [INF] Environment Variables: ["[JELLYFIN_LOG_DIR, /var/log/jellyfin]", "[JELLYFIN_FFMPEG, /usr/lib/jellyfin-ffmpeg/ffmpeg]", "[JELLYFIN_DATA_DIR, /var/lib/jellyfin]", "[JELLYFIN_CONFIG_DIR, /etc/jellyfin]", "[JELLYFIN_CACHE_DIR, /var/cache/jellyfin]", "[JELLYFIN_WEB_DIR, /jellyfin/jellyfin-web]"]
[11:15:27] [INF] Arguments: ["/jellyfin/jellyfin.dll"]
[11:15:27] [INF] Operating system: Debian GNU/Linux 12 (bookworm)
[11:15:27] [INF] Architecture: X64
[11:15:27] [INF] 64-Bit Process: True
[11:15:27] [INF] User Interactive: True
[11:15:27] [INF] Processor count: 2
[11:15:27] [INF] Program data path: /var/lib/jellyfin
[11:15:27] [INF] Log directory path: /var/log/jellyfin
[11:15:27] [INF] Config directory path: /etc/jellyfin
[11:15:27] [INF] Cache path: /var/cache/jellyfin
[11:15:27] [INF] Web resources path: /jellyfin/jellyfin-web
[11:15:27] [INF] Application directory: /jellyfin/
[11:15:27] [INF] Setting cache path: /var/cache/jellyfin
[11:15:28] [INF] Loading assemblies
[11:15:28] [INF] Skipping disabled plugin 1.3.2.0 of Intros
[11:15:28] [INF] Loaded assembly Jellyfin.Plugin.OpenSubtitles, Version=20.0.0.0, Culture=neutral, PublicKeyToken=null from /var/lib/jellyfin/plugins/Open Subtitles_20.0.0.0/Jellyfin.Plugin.OpenSubtitles.dll
[11:15:28] [INF] Loaded assembly Jellyfin.Plugin.PlaybackReporting, Version=15.0.0.0, Culture=neutral, PublicKeyToken=null from /var/lib/jellyfin/plugins/Playback Reporting_15.0.0.0/Jellyfin.Plugin.PlaybackReporting.dll
[11:15:28] [INF] Loaded assembly SQLitePCL.pretty, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null from /var/lib/jellyfin/plugins/Playback Reporting_15.0.0.0/SQLitePCL.pretty.dll
[11:15:28] [INF] Loaded assembly Jellyfin.Plugin.Reports, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null from /var/lib/jellyfin/plugins/Reports_17.0.0.0/Jellyfin.Plugin.Reports.dll
[11:15:28] [INF] Loaded assembly ClosedXML, Version=0.97.0.0, Culture=neutral, PublicKeyToken=fd1eb21b62ae805b from /var/lib/jellyfin/plugins/Reports_17.0.0.0/ClosedXML.dll
[11:15:28] [INF] Loaded assembly ExcelNumberFormat, Version=1.1.0.0, Culture=neutral, PublicKeyToken=23c6f5d73be07eca from /var/lib/jellyfin/plugins/Reports_17.0.0.0/ExcelNumberFormat.dll
[11:15:28] [INF] Loaded assembly DocumentFormat.OpenXml, Version=2.16.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17 from /var/lib/jellyfin/plugins/Reports_17.0.0.0/DocumentFormat.OpenXml.dll
[11:15:28] [INF] Loaded assembly SixLabors.Fonts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d998eea7b14cab13 from /var/lib/jellyfin/plugins/Reports_17.0.0.0/SixLabors.Fonts.dll
[11:15:28] [INF] Loaded assembly System.IO.Packaging, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from /var/lib/jellyfin/plugins/Reports_17.0.0.0/System.IO.Packaging.dll
[11:15:28] [INF] Loaded assembly Jellyfin.Plugin.SessionCleaner, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null from /var/lib/jellyfin/plugins/Session Cleaner_3.0.0.0/Jellyfin.Plugin.SessionCleaner.dll
[11:15:28] [INF] Loaded assembly MailKit, Version=4.5.0.0, Culture=neutral, PublicKeyToken=4e064fe7c44a8f1b from /var/lib/jellyfin/plugins/Webhook_13.0.0.0/MailKit.dll
[11:15:28] [INF] Loaded assembly MQTTnet, Version=4.3.3.952, Culture=neutral, PublicKeyToken=fdb7629f2e364a63 from /var/lib/jellyfin/plugins/Webhook_13.0.0.0/MQTTnet.dll
[11:15:28] [INF] Loaded assembly MimeKit, Version=4.5.0.0, Culture=neutral, PublicKeyToken=bede1c8a46c66814 from /var/lib/jellyfin/plugins/Webhook_13.0.0.0/MimeKit.dll
[11:15:28] [INF] Loaded assembly BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938 from /var/lib/jellyfin/plugins/Webhook_13.0.0.0/BouncyCastle.Cryptography.dll
[11:15:28] [INF] Loaded assembly Jellyfin.Plugin.Webhook, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null from /var/lib/jellyfin/plugins/Webhook_13.0.0.0/Jellyfin.Plugin.Webhook.dll
[11:15:28] [INF] Loaded assembly Handlebars, Version=2.1.6.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661 from /var/lib/jellyfin/plugins/Webhook_13.0.0.0/Handlebars.dll
[11:15:28] [INF] Loaded assembly MQTTnet.Extensions.ManagedClient, Version=4.3.3.952, Culture=neutral, PublicKeyToken=fdb7629f2e364a63 from /var/lib/jellyfin/plugins/Webhook_13.0.0.0/MQTTnet.Extensions.ManagedClient.dll
[11:15:28] [INF] Defined LAN subnets: ["192.168.1.0/24"]
[11:15:28] [INF] Defined LAN exclusions: []
[11:15:28] [INF] Used LAN subnets: ["192.168.1.0/24"]
[11:15:28] [INF] Filtered interface addresses: ["127.0.0.1"]
[11:15:28] [INF] Bind Addresses ["127.0.0.1"]
[11:15:28] [INF] Remote IP filter is Allowlist
[11:15:28] [INF] Filtered subnets: []
[11:15:47] [INF] Loaded plugin: Open Subtitles 20.0.0.0
[11:15:47] [INF] Loaded plugin: Playback Reporting 15.0.0.0
[11:15:47] [INF] Loaded plugin: Reports 17.0.0.0
[11:15:47] [INF] Loaded plugin: Session Cleaner 3.0.0.0
[11:15:47] [INF] Loaded plugin: Webhook 13.0.0.0
[11:15:47] [INF] Loaded plugin: TMDb 10.9.8.0
[11:15:47] [INF] Loaded plugin: Studio Images 10.9.8.0
[11:15:47] [INF] Loaded plugin: OMDb 10.9.8.0
[11:15:47] [INF] Loaded plugin: MusicBrainz 10.9.8.0
[11:15:47] [INF] Loaded plugin: AudioDB 10.9.8.0
[11:15:47] [INF] Applying migration 'FixAudioData'
[11:15:47] [INF] Backing up library.db to /var/lib/jellyfin/data/library.db.bak1
[11:15:47] [INF] library.db backed up to /var/lib/jellyfin/data/library.db.bak1
[11:15:47] [INF] Backfilling audio lyrics data to database.
[11:16:00] [ERR] Could not apply migration 'FixAudioData'
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 11: 'database disk image is malformed'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, ManagedConnection db)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(ManagedConnection db, IEnumerable`1 tuples)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
at Jellyfin.Server.Migrations.Routines.FixAudioData.Perform()
at Jellyfin.Server.Migrations.MigrationRunner.PerformMigrations(IMigrationRoutine[] migrations, MigrationOptions migrationOptions, Action`1 saveConfiguration, ILogger logger)
[11:16:00] [FTL] Error while starting server
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 11: 'database disk image is malformed'.
at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, ManagedConnection db)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(ManagedConnection db, IEnumerable`1 tuples)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
at Jellyfin.Server.Migrations.Routines.FixAudioData.Perform()
at Jellyfin.Server.Migrations.MigrationRunner.PerformMigrations(IMigrationRoutine[] migrations, MigrationOptions migrationOptions, Action`1 saveConfiguration, ILogger logger)
at Jellyfin.Server.Migrations.MigrationRunner.Run(CoreAppHost host, ILoggerFactory loggerFactory)
at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[11:16:00] [INF] Running query planner optimizations in the database... This might take a while
[11:16:00] [INF] Disposing CoreAppHost
[11:16:00] [INF] Disposing MusicBrainzArtistProvider
[11:16:00] [INF] Disposing MusicBrainzAlbumProvider
[11:16:00] [INF] Disposing PluginManagerFFmpeg logs
No response
Client / Browser logs
No response
Relevant screenshots or videos
No response
Additional information
Docker compose.yml file, I migrated to Docker long ago that's why there are so many volume mounts
services:
jellyfin:
image: jellyfin/jellyfin:latest
#image: jellyfin/jellyfin:10.9.3 # 10.9.4 does not work ok
container_name: jellyfin
user: 119:124
# required to be able to "bind" UPD port 1900
network_mode: 'host'
# restart: 'unless-stopped'
healthcheck:
disable: true
start_period: 2h
#ports:
# - "127.0.0.1:8096:8096/tcp"
# - "1900:1900/udp"
# - "7359:7359/udp"
volumes:
- ./data/etc:/etc/jellyfin
- ./data/cache:/var/cache/jellyfin
- ./data/lib:/var/lib/jellyfin
- ./data/log:/var/log/jellyfin
- /my/data/dir:/my/data/dirI have check up the scheduled tasks and the library scan fails in v10.9.3. Throws the following exception scanning a TV-Show.
[11:28:55] [ERR] Error executing Scheduled Task
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 11: 'database disk image is malformed'.
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, SqliteConnection db)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(SqliteConnection db, IEnumerable`1 tuples)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService`2.SaveItemAsync(MetadataResult`1 result, ItemUpdateType reason, CancellationToken cancellationToken)
at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
Metadata
Assignees
Labels
Type
Projects
Status
Fixed
Status
Needs triage
Activity