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.
For troubleshooting, I would recommend you visit the Plex Discord/Matrix channels for real-time help. Additionally, [email protected] may prove helpful.
Just to add to the info so far: while you’re spending the effort doing a migration it’s worth going the extra few steps and moving to their Docker image. It’ll make any future server moves a doddle, not to mention updates etc.
Can recommend the Linuxserver.io version – I found it easier in podman to implement nvidia hardware decoding with the linuxserver.io version than with the official image.
How does a doddle compare to a jiffie?
Doodle is a bit more artistic, while jiffie is a bit more poetic. I haven’t found any practical differences in deployment.
Doddle = easy Jiffie = quick
Marines quite: “It might be quick, but it ain’t easy.”
Agreed. I use their docker image, and have migrated servers. Other than copying data it only took a few minutes of cli-fu and everything was back up and running.
On the phone right now, but i did this last month OP.
First of all make sure to keep a backup of the db. Normally Plex does this for you every few days in the db folder. (From your old windows install)
The missing ingredient most likely is converting all the windows registry entries into preferences.xml
There was a reddit post where some one had posted a sample XML. I repopulated it with all the settings from the windows registry export. If you can’t find the post then I can post mine here in the morning.
Also had to create a plex user and group and chown it to all the media. I am a new Linux user so had to fuck around a lot coz of Fedoras SELinux file perms.
<an eternity later…> Yo yo OP! Here is my sample Preferences.xml, I have nulled out the fields you will need to fill up from the windows registry. After this I still had to reshare the libraries with my friends, unsure which step I botched, but that was easy to re-do.
<?xml version="1.0" encoding="utf-8"?> <Preferences OldestPreviousVersion="1.18.3.2156-349e9837e" MachineIdentifier="####################" ProcessedMachineIdentifier="####################" AnonymousMachineIdentifier="####################" MetricsEpoch="1" AcceptedEULA="1" PublishServerOnPlexOnlineKey="1" PlexOnlineToken="####################" PlexOnlineUsername="####################" PlexOnlineMail="####################" LastAutomaticMappedPort="0" CertificateVersion="3" PubSubServer="####################" PubSubServerRegion="fmt" PubSubServerPing="485" LanguageInCloud="1" FriendlyName="####################" TranscodeCountLimit="3" TranscoderQuality="0" TranscoderH264BackgroundPreset="medium" ButlerUpdateChannel="0" DlnaEnabled="0" CinemaTrailersFromTheater="1" CinemaTrailersType="0" WanPerUserStreamCount="2" LanNetworksBandwidth="" allowedNetworks="192.168.1.0/24" customConnections="" ManualPortMappingMode="1" ManualPortMappingPort="####################" FSEventLibraryPartialScanEnabled="0" FSEventLibraryUpdatesEnabled="0" GenerateBIFBehavior="never" OnDeckWindow="52" ScannerLowPriority="0" ScheduledLibraryUpdateInterval="86400" ScheduledLibraryUpdatesEnabled="1" watchMusicSections="1" CloudSyncNeedsUpdate="0" ButlerTaskRefreshLibraries="1" MinutesAllowedPaused="30" DlnaReportTimeline="0" ButlerEndHour="7" ButlerStartHour="3" PlexOnlineHome="0" DvrIncrementalEpgLoader="0" EnableIPv6="0" WebHooksEnabled="0" CinemaTrailersPrerollID="" TranscoderCanOnlyRemuxVideo="0" PushNotificationsEnabled="0" LogVerbose="0" MergedRecentlyAdded="0" ButlerTaskCleanOldBundles="1" ButlerTaskCleanOldCacheFiles="1" ButlerTaskDeepMediaAnalysis="1" ButlerTaskGenerateAutoTags="0" ButlerTaskOptimizeDatabase="1" ButlerTaskRefreshLocalMedia="1" ButlerTaskRefreshPeriodicMetadata="1" ButlerTaskReverseGeocode="0" ButlerTaskUpgradeMediaAnalysis="1" GenerateChapterThumbBehavior="never" GenerateIntroMarkerBehavior="never" LoudnessAnalysisBehavior="never" MusicAnalysisBehavior="never" WanTotalMaxUploadRate="20000" autoEmptyTrash="1" GlobalMusicVideoPathMigrated="1" CertificateUUID="####################" secureConnections="1" DatabaseCacheSize="4000" ButlerTaskBackupDatabase="1" customCertificatePath="" PreferredNetworkInterface="eno1" CinemaTrailersFromBluRay="1" ButlerDatabaseBackupPath="/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases" sendCrashReports="1" HardwareDevicePath="####################"/>
Appreciate you!!! Will attempt with this step 🫡🫡
I successfully did it about 2 years ago, following the instructions from this repo (last commit 2 years ago though…) https://github.com/MMMZZZZ/Jellyfin-Migrator
deleted by creator
Are you sure the db is identical on the new server (
rsync -a
or similar)? The error suggests the database is not even being recognized as such.Is your current setup up to date?
Everything was freshly installed and updated including the OS (PopOS as I’m running it on my gaming PC)
Is the windows side up to date? Most likely culprit would be a db mismatch if one side or the other is on a different version. Similarly, do you by chance have either side running a beta release? If you have plex pass you potentially have access to these
Shameless moment to plug the idea that you could consider migrating to Jellyfin if you can’t solve the issue
Check the database version on both sides to make sure they match.
Pop OS currently is keeping the next version update on alpha as they’re developing their own compositor display stack called COSMIC to go along with it; so some database dependencies might have outdated versions.