Cannot restore plex database

Server Version#:1.28.1.6104-788f82488

I had to wipe my main media server which is running Ubuntu Server 22.04. In preparation I made a rsync copy of my boot drive. I have restored everything but my plex database. No matter what I do it doesn’t seem to help. I have copied it back over many times. I’ve made sure the permissions were correct… I’ve tried booting up plex before and after the copy. The guides say that all I need to do is move the files to the right place, but all I can assume is something didn’t get backed up. That or it had something to do with setting the privileges to 777, but I set them back to 755 before booting it up again. Any help would be appreciated

No Linux user here, but
if you make a copy of the main database file while the server is still running, you will very likely end up with a damaged copy.
Restore one of the backups. Restore a Database Backed Up via 'Scheduled Tasks' | Plex Support

To add to OttoKerner:

Assuming the copy was done with PMS stopped,

Everything in /var/lib/plexmediaserver must be owned by user plex:plex
Setting permissions wildly is precarious and will fail at some point.

To set ownership and permission to standard:
(You may copy these verbatim)

  1. Confirm Plex is stopped ( sudo systemctl stop plexmediaserver)
  2. Set Ownership back to the Plex username and set file permissions to standard.
sudo bash
chown -R  plex:plex /var/lib/plexmediaserver
find /var/lib/plexmediaserver -type d -exec chmod 755 {} \;
find /var/lib/plexmediaserver -type f -exec chmod 644 {} \;
  1. You may now start Plex and hopefully it will start (if no database damage)

@Xanderland

I looked at your Reddit post.

Did you have your PMS installation customized in any way?

If you moved the Application Support directory, it would explain why there is nothing in /var/lib/plexmediaserver under Library

The reason it’s not there is because I didn’t shut down the service when I did the rsync. It skipped those files because they were being written to.

So what did you copy?

rsync will read an open file. I do it all the time knowing the results are indeterminate

It appears that it copied everything BUT the contents of /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-in\ Support/ which appears to be empty

Let’s resolve the status of your databases.

That will determine what comes next.

I presume you have finally minimally copied com.plexapp.plugins.library.db and com.plexapp.plugins.library.blobs.db back into "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"

Confirm database status:

sudo bash
systemctl stop plexmediaserver   <-- make certain but pretty sure it still is down

cd "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"

"/usr/lib/plexmediaserver/Plex SQLite com.plexapp.plugins.library.db" 'PRAGMA integrity_check(1)'
"/usr/lib/plexmediaserver/Plex SQLite com.plexapp.plugins.library.blobs.db"  'PRAGMA integrity_check(1)'

If the databases are intact, each check will report “ok” as it exits.

Presuming they are, I want all the permissions set to standard

chown -R plex:plex /var/lib/plexmediaserver
find /var/lib/plexmediaserver -type d -exec chmod 755 {} \;
find /var/lib/plexmediaserver -type f -exec chmod 644 {} \;

With these completed and the databases OK, you can attempt to restart PMS.

Should it fail,

cd "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs"

Make a tar.gz of everything you see there and attach it here so I can see the damage.

Unless there is some hope here very soon, your best choice might best be to burn it all down and start over rather than fight with it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.