Hey guys! Has anyone had success migrating a Plex server from Windows to Linux in recent years? I’m mostly concerned about losing watch history / users (having to reinvite).
I found this Reddit thread on the issue and it seemed like a simple copy and paste of the DB file. I attempted following both the official directions from their guide and from the Reddit post and ran into a SQLite DB error similar to what another user experienced in the Reddit thread:
soci::soci_error() that sqlite3 prepare failed…Error: Unable to set up server: sqlite3_statement_backend::prepare: file is not a database for SQL: PRAGMA cache_size=512 (N4soci10soci_errorE)
Has anyone done a migration in the recent years? Seems like something might have changed within the last few and this copy and paste of the DB file will not work anymore?
The error sounds like your sqlite database file is borked, misplaced or not named correctly. Make sure to shut down Plex on the source Windows machine fully before copying it over. Also make sure the path to the database file is valid - not sure where Plex stores that. Also keep in mind that Linux paths and file names are cAsE SenSiTiVE, so if your db file was named “Plex.db” on Windows, and the Linux version of Plex expects “plex.db” - you will get an error.
Other issues to anticipate related to file/directory naming: library/metadata paths. You may need to redefine/rescan all your media libraries to fix that depending on how Plex handles transitions between platforms that use different path separators (Windows = \ and Linux/macOS = /) and case sensitivity (Windows and macOS = case INsensitive and Linux = case sensitive).
Also consider a DB backup/restore (feature built into Plex) may be a better way to transition vs. just copying the DB file over.
If you’re feeling adventurous, you can download a SQLite browser and take a peek at the Plex DB file. See if there are any red flags like paths to libraries that include Windows specific stuff like drive letters. That will probably break in Linux if just copied over. The backup/restore feature may account for that and actually try to take care of the differences… but that’s just a guess; I never tried this and have no experience with it.
Note: I never bothered to run Plex on anything other than Linux.
P.S. some here suggested using Docker (or Podman - probably better in the long run) to deploy Plex. I strongly recommend that option as well, since it abstracts a lot of the nuts and bolts that you no longer need to care about.