Trying to move between 2 servers

Server Version#:1.14.1.5487-dcc512d26
Player Version#:

I was following the instructions at: https://support.plex.tv/articles/201370363-move-an-install-to-another-system/ to the letter… but no matter what I do the server will not start.

My goal is to preserve the library if possible… I will live without if I must. I always end up with the database being corrupt and have executed the check/repair on it, no change.

(Version: I am using the version that matches the old server (centos6 stopped at this version, So I setup a new server centos7 to move to and start upgrading. I have tried the latest version first, then wiped and tried the old/matching version)

[root@media Databases]# cp com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original
[root@media Databases]# sqlite3 com.plexapp.plugins.library.db “DROP index ‘index_title_sort_naturalsort’”
Error: no such index: index_title_sort_naturalsort
[root@media Databases]#
[root@media Databases]# sqlite3 com.plexapp.plugins.library.db “DELETE from schema_migrations where version=‘20180501000000’”
Error: no such table: schema_migrations
[root@media Databases]# sqlite3 com.plexapp.plugins.library.db .dump > dump.sql
[root@media Databases]# rm com.plexapp.plugins.library.db
rm: remove regular file ‘com.plexapp.plugins.library.db’? y
[root@media Databases]# sqlite3 com.plexapp.plugins.library.db < dump.sql

Log is below, if anyone has any tips and things I could try please let me know.

(Is there a chance rsync would break the database? Once I logged out of the old server and shut it down, I’d rsync /var/lib/plexmediaserver/…/Plex Media Server onto the new server and then chown the tree to be owned by my user ‘plex’ which is set at the $PLEX_USER.)

==> Plex Media Server.log <==
Aug 05, 2019 11:20:21.781 [0x7f94bd6d4700] INFO - Plex Media Server v1.14.1.5487-dcc512d26 - ubuntu PC x86_64 - build: linux-ubuntu-x86_64 redhat - GMT -04:00
Aug 05, 2019 11:20:21.781 [0x7f94bd6d4700] INFO - Linux version: 4.19-ovh-xxxx-std-ipv6-64 (#823148 SMP Fri Jul 26 15:11:04 UTC 2019), language: en-US
Aug 05, 2019 11:20:21.781 [0x7f94bd6d4700] INFO - Processor Intel® Xeon® E-2136 CPU @ 3.30GHz
Aug 05, 2019 11:20:21.781 [0x7f94bd6d4700] INFO - /usr/lib/plexmediaserver/Plex Media Server
Aug 05, 2019 11:20:21.781 [0x7f94cf9ea840] DEBUG - BPQ: [Idle] -> [Starting]
Aug 05, 2019 11:20:21.781 [0x7f94cf9ea840] DEBUG - FeatureManager: Using cached data for features list
Aug 05, 2019 11:20:21.782 [0x7f94cf9ea840] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.13.0, threadsafe=1
Aug 05, 2019 11:20:21.785 [0x7f94cf9ea840] DEBUG - Running migrations. (EPG 0)
Aug 05, 2019 11:20:21.785 [0x7f94cf9ea840] ERROR - SQLITE3:0x10, 1, no such table: schema_migrations
Aug 05, 2019 11:20:21.785 [0x7f94cf9ea840] ERROR - Database corruption: sqlite3_statement_backend::prepare: no such table: schema_migrations for SQL: select version from schema_migrations order by version

May I suggest an alternative? Linux server-server move can be reduced in complexity over what the article states (so vague)

You clone from one to the other. Remember to decommission the original (Preferences.xml) before starting again else the two will collide (UUID’s will be identical)

Presuming new mount points are not the same, You’ll want to integrate this as part of the process.

You will effectively,

  1. Prepare the source system (turn off all automatic library features)
  2. Clone
  3. Decommission source system
  4. Perform media location updates before enabling automatic library features.
  5. Final cleanup when done.

I’m trying to do this right now, but I have a question! When you say “decommission the original Preferences.xml” do you mean to remove specific key/values? or remove the file/contents entirely?

Decommissioning it is either two forms:

  1. (simplist): Nuke the file and do a soft-reset which is a hard ownership reset. You reclaim it but don’t setup new library sections (they persist through the reset)

  2. Requires a bit of editing of Preferences.xml - Edit out: MachineID, Processed IDs, AnonID, etc – those UUID fields are what make the server unique & identifiable to Plex.tv

Since I clearly have bigger issues since I cannot get the old server to start up anymore… I have to ask if you know how to make a plex server show up when it’s missing?

Current situation, I have a clean/fresh PMS running on my new server. I have ssh forwarding to access localhost:32400/ like I’ve always done on the old server, but I get no server to claim and there are no servers under my Authorized Devices. I see a friends PMS, I’ve confirmed the port is open and reachable and can see the plex process listening on 32400. Firewalls are disabled at the moment.

As a precaution I ‘yum remove plexmediaserver’ and ‘rm -rf /var/lib/plexmediaserver’ the old attempt and started the new install of 1.16.

Edit: In the past I would clear those entries out of the Preferences.xml to force it to be unclaimed and I’d take it back.

Edit2: I am browsing the forums and trying some stuff, so far nothing has worked.

Edit3: This seems to be on par with my experience Missing "Server" under Settings - #21 by MacGriogair but nothing seems to fix it. Should I move to that thread?

Edit4: Now I’m stuck on a gracenote error on a fresh install. :frowning:

Edit5: Gracenote error might not matter, I can access the web interface but still no option to claim.

Edit6: On the next version of plex can we get a button to “force scan LAN for servers” or to “search for plex server at this IP” or something? With a meaningful error when it see’s a PMS but it’s unclaimable.

Edit7: noting I had an error

Aug 05, 2019 19:25:57.826 [0x7f7137bff700] ERROR - SQLITE3:0x10, 14, cannot open file at line 34876 of [fc49f556e4]
Aug 05, 2019 19:25:57.826 [0x7f7137bff700] ERROR - SQLITE3:0x10, 14, os_unix.c:34876: (2) open(/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/gn_lists.gdb) - No such file or directory

but creating a blank file at this location stops it.

Jumped over to a new thread where someone seems to be having the same issue.

Although I didn’t notice a problem claiming, I don’t have the option to claim.

All issues resolved. Thank you @ChuckPa

Now that I got my whole mess sorted, I did try to do this…when I start the server and set it’s name… there are no libraries, although I did copy everything over. Everything is accessible via the same path as the old server.

I did start the server once before I changed the permissions on files extracted from the tarball. Might this cause such an issue?

Edit: Repeated everything to make sure I followed instructions perfectly. Server always comes up without Libraries, I even used identical server versions in a test and still the library is not appearing.

Edit: Can also confirm that I shutdown the old server with empty trash disabled:

but on the first connect I see it enabled

Plex’s UID/GID is likely different. Did you remember?

  1. Stop Plex
  2. sudo chown -R plex.plex /var/lib/plexmediaserver

I confirm UID/GID was broke the first run but then I did run chown -R plex:plex was ran, but still no library.

Added edit above showing trash enabled itself.

Are you willing to chalk up this first one as a learning experience?

If so:

  1. systemctl stop plexmediaserver
  2. cd /var/lib/plexmediaserver
  3. sudo mv Library Library.first-try
  4. sudo tar xf /path/to/old/system/Library.tar
  5. sudo chown -R plex.plex ./Library
  6. systemctl start plexmediserver

Edit: Please show me the first few lines of the tarball you’re using:

tar tvf  tarball-name-here.tar | less

Copy/paste the first 5 lines please.

drwxr-xr-x plex/plex 0 2017-11-12 14:18 Library/
drwxr-xr-x plex/plex 0 2017-11-12 14:18 Library/Application Support/
drwxr-xr-x plex/plex 0 2018-05-22 22:44 Library/Application Support/Plex Media Server/
drwxr-xr-x plex/plex 0 2017-11-12 14:18 Library/Application Support/Plex Media Server/Crash Reports/
drwxr-xr-x plex/plex 0 2017-11-12 14:28 Library/Application Support/Plex Media Server/Crash Reports/1.9.6.4429-23901a099/

I admit I didn’t follow your instructions to the letter because I was logged in as root and line 6 had a typo.

[root@media OLD]# systemctl stop plexmediaserver
[root@media OLD]# cd /var/lib/plexmediaserver
[root@media plexmediaserver]# mv Library Library.first-try
[root@media plexmediaserver]# ls
Library.first-try
[root@media plexmediaserver]# tar xf /tmp/OLD/Library.tar
[root@media plexmediaserver]# ls
Library Library.first-try
[root@media plexmediaserver]# chown -R plex:plex ./Library
[root@media plexmediaserver]# ls -la
total 16
drwxr-xr-x 4 plex plex 4096 Aug 5 21:30 .
drwxr-xr-x 32 root root 4096 Aug 5 21:06 ..
drwxr-xr-x 3 plex plex 4096 Nov 12 2017 Library
drwxr-xr-x 3 plex plex 4096 Nov 12 2017 Library.first-try
[root@media plexmediaserver]# systemctl start plexmediaserver
[root@media plexmediaserver]#

Upon loading the web interface I see the server is unclaimed:

Then I claimed it:

Ok… Settings - Devices - Servers.

Look for the server with this friendly name “Matt’s Server”.

You will likely see two.
Delete the old one.

Should this fail,
sign out of Plex/web in the browser and open an incognito window
now open the server directly by IP.
Should it not anchor there correctly after sign-in, we will soft reset it.

I saw several old ones, I removed them all and continued. It didn’t let me access it, it claims unavailable. I directly connected to the IP and the server stays connecting for a a moment when it opens, but goes unavailable shortly after. I restarted the service and tried again. Same.

Edit: I realized I just removed my authorized session… lol.

I erased Preferences.xml on a restart and got back in, no libraries. Started a rebuild. If you have any other ideas I’d like to try them, it’s a large library.

Can we back up to how you made the tarball?
If it has no libraries then the tarball is bad.

The tarball must include the DB and the metadata tree.

This process does not fail when done correctly.

I would like to request you make a new tarball.

on old

sudo sh
cd /var/lib/plexmediaserver
systemctl stop plexmediaserver
tar cf /home/PlexLibrary.tar ./Library

The ./Library notation it so tar behaves

  • Copy that to the new,

On New

  • sudo sh
  • cd /var/lib/plexmediaserver
  • systemctl stop plexmediaserver
  • mv Library Library-xxx
  • tar xf /path/to/PlexLibrary.tar
  • chown -R plex:plex .
  • systemctl start plexmediaserver

Now open the incognito to the IP of this new system.
it will appear to be the old system (by name) because it’s a clone of it.

[root@plex ~]# cd /var/lib/plexmediaserver
[root@plex plexmediaserver]# service plexmediaserver stop
[root@plex plexmediaserver]# tar cf /home/PlexLibrary.tar ./Library
[root@plex plexmediaserver]# du -chs *
7.2M    Library
7.2M    total

[root@media ~]# sudo sh
sh-4.2# cd /var/lib/plexmediaserver
sh-4.2# systemctl stop plexmediaserver
sh-4.2# mv Library Library-xxx
sh-4.2# tar xf /home/PlexLibrary.tar
sh-4.2# chown -R plex:plex .
sh-4.2# ls -la
total 20
drwxr-xr-x  5 plex plex 4096 Aug  6 09:21 .
drwxr-xr-x 32 root root 4096 Aug  5 21:06 ..
drwxr-xr-x  3 plex plex 4096 Nov 12  2017 Library
drwxr-xr-x  3 plex plex 4096 Nov 12  2017 Library.first-try
drwxr-xr-x  3 plex plex 4096 Nov 12  2017 Library-xxx
sh-4.2# du -chs *
7.1M    Library
8.0M    Library.first-try
3.4G    Library-xxx
3.4G    total
sh-4.2# systemctl start plexmediaserver
sh-4.2# systemctl status plexmediaserver
● plexmediaserver.service - Plex Media Server for Linux
   Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2019-08-06 09:24:40 EDT; 8s ago


Edit: This was when my autocomplete put my user/password in, I tried again with email/pass and it worked. But there is no library/server appearing.

So I peeked at the .db SQLITE databases, I noticed it seemed small… the backup (and the old running copy) seem to have blank ‘directories’ tables… Another PMS I run has a large table with all the paths in it. How could the server be running, and showing all my data, without having the directories in the DB? How can I force the DB to update to include these?

Matt. Your signon url is the problem. You are attempting to access it from app.plex.tv before completion of the transfer. The web browser tokens will change.

The URL you show contains those tokens. Look closely.

I went to http://IP:32400/web and it redirects me to app.plex.tv during auth. Do I have the ability to control auth flow?

Did you do this in an incognito window after signing out the Plex/web app?