mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-23 23:20:51 +01:00
Upgrade from 10.5 to 10.6 fails on MigrateUserDatabase with "SQLite Error 19: 'FOREIGN KEY constraint failed" #2042
Labels
No labels
area:database
awaiting-feedback
backend
blocked
breaking change: web api
bug
build
ci
confirmed
discussion needed
dotnet future
downstream
duplicate
EFjellyfin.db
enhancement
feature
future
github-actions
good first issue
hdr
help wanted
invalid
investigation
librarydb
live-tv
lyrics
media playback
music
needs testing
nuget
performance
platform
pull-request
question
regression
release critical
requires-web
roadmap
security
security
stale
support
syncplay
ui & ux
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: starred/jellyfin#2042
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @adamcik on GitHub (Aug 14, 2020).
Originally assigned to: @barronpm on GitHub.
Describe the bug
Jellyfin does not start up after upgrading to 10.6, it is crash looping trying to apply the
MigrateUserDatabasestep which fails withSQLite Error 19: 'FOREIGN KEY constraint failed.I've tried skimming over https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs, but since I'm not familiar with your code or database schema's it's not obvious where the error is actually being triggered and if I can workaround it (other than wiping all the databases and starting clean).
I would be happy to poke at my sqlite databases if that would help debugging.
System (please complete the following information):
To Reproduce
MigrateUserDatabasewithSQLite Error 19: 'FOREIGN KEY constraint failed'.Expected behavior
Migration completes and system starts up.
Logs
Screenshots
Additional context
This system previously had an Emby install before switching to Jellyfin, I assume there was some auto import / conversion of the databases from it, but I never actively did anything beyond using apt to install jellyfin. So I'm not sure if I started clean at some point and forgot or if this is a converted database.
@adamcik commented on GitHub (Aug 14, 2020):
One a side note, I'm not able to downgrade (assuming that would even be safe to do) as it seems the apt repository doesn't provide 10.5 packages any more. It would be nice if the repo could keep the last couple of versions around so people can mitigate by rolling back if something breaks.
@PrplHaz4 commented on GitHub (Aug 14, 2020):
Since there were db schema changes during this upgrade, rolling back is not as simple as just getting the old binaries.
If you took a backup of the db, this might help you downgrade: https://github.com/jellyfin/jellyfin-docs/pull/372/files
@adamcik commented on GitHub (Aug 14, 2020):
Sadly I didn't backup before upgrading, and since this is "just" a VM for jellyfin I never setup any more persistent backup scheme. But thanks for the pointer. I'll leave things in the state they are or at least make a backup before wiping things clean in case it helps the investigation. Loosing the state for what we've watched isn't the end of the world :-)
@adamcik commented on GitHub (Oct 11, 2020):
I've tried debugging, but ended up giving up on this and have purged all the jellyfin data to start fresh :( As such I can't really help reproduce this any longer. So feel free to close this issue if that makes sense.
@gerroon commented on GitHub (Dec 12, 2020):
These sql schema changes constantly breaking existing databases and upgrades have been a recurring theme. It would be nice if the devs are more careful about this. Iso far wiped my Jellyfin database at least 3 times already.
@cvium commented on GitHub (Apr 9, 2021):
Since this is a data issue we really need access to a database that exhibits this.
@wouterla commented on GitHub (Jun 16, 2021):
I'm having this same issue, I think.
I will attach the users.db file, since I'll have to change the passwords anyway.
This is the log:
users.db.gz
@ShadwDrgn commented on GitHub (Sep 1, 2022):
has anyone figured this out at all because my jellyfin instance is now down because i tried to upgrade and it's completely broken restarting over and over trying to migrate and crashing :( going from 10.7 to 10.8
@knuxbbs commented on GitHub (Apr 23, 2023):
Same here.
@barronpm commented on GitHub (Apr 24, 2023):
So in your logs,
MigrateUserDatabaseis the one that fails? This migration shouldn't even be running unless you are updating from 10.5 or earlier. What does your migrations.xml look like?@sevenrats commented on GitHub (Oct 5, 2023):
both of these server versions are eol.