Using Plex SQLite on FreeBSD

So, I’ve been seeing a lot of posts about issues with the database on recent Plex Media Server releases (stuff not working after an update, and corruption in the database being pointed to as the cause). Why all these databases worked fine in previous versions and are suddenly not good with the newest releases is another topic.

What I’m really here asking for is guidance on using the Plex SQLite tool. See, I figure it would be best to check my existing database and fix it if it needs it before I do any upgrading. I’m on 1.25.9.5721 right now.

I can access the jail I have Plex in on SSH, I’ve copied the database to make a backup, and I’ve located the “Plex SQLite” tool in the files. The issue is how to actually run it. The support document just says to do:

"Plex SQLite" [path to database]

That’s not working for me. I just get a “command not found” error.
And the directions after that all are from within the sqlite tool itself, so if you didn’t get there you’re stuck.

You do need the path to Plex SQLite, which, for truenas, is not mentioned in the support document.

However, Plex SQLite is in the same directory as the Plex Media Server executable.

Also, the path to the PMS executable is listed at the top of the Plex Media Server.log file (at least on Windows & Linux).

I looked at a set of logs from the server-truenas section.

It references /usr/local/share/plexmediaserver-plexpass/Plex_Media_Server.

So, you might check that location and see if it has the Plex SQLite executable.

Trying again over here… I was in a directory last night that had a file named “Plex SQLite” in it. But not 100% sure it was this one.

root@plex-4:/usr/local/share/plexmediaserver-plexpass # ls
CrashUploader                   Plex Media Scanner              Plex Transcoder
lib                             Plex Media Server               Plex Tuner Service
Plex Commercial Skipper         Plex Relay                      Plex_Media_Server
Plex DLNA Server                Plex Script Host                Resources
Plex Media Fingerprinter        Plex SQLite                     start.sh
root@plex-4:/usr/local/share/plexmediaserver-plexpass # cd Plex_Media_Server
Plex_Media_Server: Not a directory.

So it’s not inside there.
But the “Plex SQLite” seems to be right here in plexmediaserver-plexpass…

root@plex-4:/usr/local/share/plexmediaserver-plexpass # "Plex SQLite" "/usr/local/plexdata-plexpass/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"
Plex SQLite: Command not found.

Edit: “Plex_Media_Server” looks like it’s a symlink elsewhere:

Here is a script you can use as a guide plex-fix-db.sh · GitHub

From a youtuber spaceinvaderone

Note: missing semi-colon on the “PRAGMA integrity_check”

That script seems to be for Docker.

Try "./Plex SQLite"

On Ubuntu:

l0newo1f@osage:/usr/lib/plexmediaserver$ "Plex SQLite"
Plex SQLite: command not found
l0newo1f@osage:/usr/lib/plexmediaserver$ "./Plex SQLite"
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .quit
l0newo1f@osage:/usr/lib/plexmediaserver$
1 Like

Yes. Looks like that was the key. Thanks!

root@plex-4:/ # cd /usr/local/share/plexmediaserver-plexpass/
root@plex-4:/usr/local/share/plexmediaserver-plexpass # service plexmediaserver_plexpass stop
Stopping plexmediaserver_plexpass.
Waiting for PIDS: 85681, 85681.
Cleaning up leftover child processes.
Waiting for PIDS: 85682, 85682.
root@plex-4:/usr/local/share/plexmediaserver-plexpass # "./Plex SQLite" "/usr/local/plexdata-plexpass/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db"
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
sqlite> PRAGMA integrity_check;
ok
sqlite>

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