Server unavailable after updating to version 1.40.3

Server Version#: 1.40.3.8555
Player Version#:
Hi everybody,

yesterday I performed server update on my TNAS F2-221: the process didn’t have any errors, but now my server is unavailable.
I tried remote AND local connection, but nothing changed. I notice that on TNAS the server was deactivated: after activation nothing changed.
I searched for version 1.40.2 to reinstall, but I can’t find it anywhere.
What can I do? I don’t want to make a fresh start: it would be very annoying.

If you power cycle your NAS and get PMS to run,
you should be able to quit PMS five minutes later
and locate the Plex Media Server.log file.

Check it to see if it’s starting normally. You shouldn’t see any
CRITICAL or ERROR messages. Also look to see if it’s doing
some data migration.

Consider posting your log after redacting private info (email, usernames whatever)

When it comes to running a Plex client to your server, there are

  1. The Hosted Web App which you find after logging into Plex on the web
  2. The bundled web app at (e.g. https://192.168.0.100:32400/web or similar)
  3. A standalone app like Plex for Mac etc.

Which one(s) did you try?
My hope is that the server is just busy, and the log should tell us something.
g/l nib

Well, I’ve just done what you suggested.

Log file shows many INFO and DEBUG lines, with 6 ERROR lines that seem creepy to me. It is running migrations (it seems to me), but I’m not sure, so I’m going to post the file (I’ve deleted my username/e-mail).

To answer your question: I’ve tried all 3 possibilities to run the client (app, hosted web app and bundled web app), same results.

Here’s the log file:

Jun 18, 2024 21:09:20.214 [140077391960888] INFO - Plex Media Server v1.40.3.8555-fef15d30c - TerraMaster TNAS F2-221 x86_64 - build: linux-x86_64 terramaster-tos5 - GMT 02:00
Jun 18, 2024 21:09:20.215 [140077391960888] INFO - Linux version: TOS 5.1.131-00123, language: en-US
Jun 18, 2024 21:09:20.215 [140077391960888] INFO - Processor: 2-core Intel(R) Celeron(R) CPU J3355 @ 2.00GHz
Jun 18, 2024 21:09:20.215 [140077391960888] INFO - Compiler is - Clang 11.0.1 (https://plex.tv 9b997da8e5b47bdb4a9425b3a3b290be393b4b1f)
Jun 18, 2024 21:09:20.215 [140077391960888] INFO - /Volume1/@apps/plex/plexmediaserver/Plex Media Server
Jun 18, 2024 21:09:20.212 [140077394504336] DEBUG - BPQ: [Idle] → [Starting]
Jun 18, 2024 21:09:20.213 [140077394504336] DEBUG - FeatureManager: Using cached data for features list
Jun 18, 2024 21:09:20.311 [140077394504336] DEBUG - [CERT] Subject name is /CN=*.c96c24f89b554164962bb494cd0c2886.plex.direct
Jun 18, 2024 21:09:20.311 [140077394504336] DEBUG - [CERT] Installed certificate with fingerprint 20:3e:72:ae:e4:2d:44:57:b0:f1:33:26:10:c6:20:94:12:0e:6b:c8.
Jun 18, 2024 21:09:20.311 [140077394504336] DEBUG - [CERT/OCSP] Stapling requests will be made to ‘http://r11.o.lencr.org/’.
Jun 18, 2024 21:09:20.311 [140077394504336] INFO - [CERT/OCSP] Successfully retrieved response from cache.
Jun 18, 2024 21:09:20.311 [140077394504336] DEBUG - HttpServer: Listening on IPv6 as well as IPv4.
Jun 18, 2024 21:09:20.311 [140077394504336] DEBUG - HttpServer: Listening on port 32400.
Jun 18, 2024 21:09:20.311 [140077394504336] DEBUG - HttpServer: Listening on port 32401.
Jun 18, 2024 21:09:20.312 [140077394504336] DEBUG - Running server…
Jun 18, 2024 21:09:20.312 [140077394504336] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.39.4, threadsafe=1
Jun 18, 2024 21:09:20.312 [140077379693368] DEBUG - HttpServer: Set up a thread pool with 2 threads.
Jun 18, 2024 21:09:20.926 [140077394504336] INFO - SQLITE3:0x80000001, 283, recovered 832 frames from WAL file /Volume1/Plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-wal
Jun 18, 2024 21:09:21.262 [140077394504336] INFO - Running migrations. (EPG 0)
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 0.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 1.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 2.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 3.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 4.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 5.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 6.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 7.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 8.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 9.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 10.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 11.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 12.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 13.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 14.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 15.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 16.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 17.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 18.
Jun 18, 2024 21:09:21.263 [140077394504336] DEBUG - Captured session 19.
Jun 18, 2024 21:09:21.714 [140077394504336] DEBUG - ChangestampAllocator: initialized to 450303
Jun 18, 2024 21:09:21.807 [140077394504336] DEBUG - Opening 2 database sessions to library (com.plexapp.plugins.library.blobs), SQLite 3.39.4, threadsafe=1
Jun 18, 2024 21:09:21.976 [140077394504336] INFO - SQLITE3:0x80000001, 283, recovered 403 frames from WAL file /Volume1/Plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.blobs.db-wal
Jun 18, 2024 21:09:22.113 [140077394504336] INFO - Running migrations. (EPG 0)
Jun 18, 2024 21:09:22.114 [140077394504336] DEBUG - Captured session 0.
Jun 18, 2024 21:09:22.114 [140077394504336] DEBUG - Captured session 1.
Jun 18, 2024 21:09:22.114 [140077394504336] INFO - Running forward migration 202312190800.
Jun 18, 2024 21:09:22.114 [140077394504336] DEBUG - Captured session 0.
Jun 18, 2024 21:09:22.114 [140077394504336] DEBUG - Captured session 1.
Jun 18, 2024 21:09:22.195 [140077387107128] DEBUG - [JobRunner] Job running: /Volume1/@apps/plex/plexmediaserver/CrashUploader “–directory=/Volume1/Plex/Library/Application Support/Plex Media Server/Crash Reports/1.40.3.8555-fef15d30c” --version=1.40.3.8555-fef15d30c --platform=Linux “–platformVersion=TOS 5.1.131-00123” --serverUuid=0bc3452e0a9046918a3cc2aef89e00635c0adb34 --userId=-- --sentryUrl=https://o17675.ingest.sentry.io/api/1233455/ --sentryKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --vendor=TerraMaster --model=x86_64 “–device=TNAS F2-221”
Jun 18, 2024 21:09:22.208 [140077387107128] DEBUG - [JobRunner] Jobs: Starting child process with pid 6558
Jun 18, 2024 21:09:22.234 [140077389749048] DEBUG - Jobs: ‘/Volume1/@apps/plex/plexmediaserver/CrashUploader’ exit code for process 6558 is 0 (success)
Jun 18, 2024 21:09:31.006 [140077366332216] DEBUG - MyPlex: mapping state set to ‘Unknown’.
Jun 18, 2024 21:09:31.023 [140077366332216] DEBUG - Relay: read 13 cached entries from hosts file
Jun 18, 2024 21:09:31.024 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /web (3 live) #1 GZIP
Jun 18, 2024 21:09:31.024 [140077382822712] DEBUG - Opening 1 database sessions to library (), SQLite 3.39.4, threadsafe=1
Jun 18, 2024 21:09:31.027 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /web (3 live) #1 GZIP 21ms 465 bytes (pipelined: 1)
Jun 18, 2024 21:09:31.381 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /favicon.ico (3 live) #6 GZIP
Jun 18, 2024 21:09:31.382 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /favicon.ico (3 live) #6 GZIP 0ms 465 bytes (pipelined: 2)
Jun 18, 2024 21:09:36.519 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /web (3 live) #7 GZIP
Jun 18, 2024 21:09:36.519 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /web (3 live) #7 GZIP 0ms 465 bytes (pipelined: 3)
Jun 18, 2024 21:09:36.684 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /favicon.ico (3 live) #8 GZIP
Jun 18, 2024 21:09:36.684 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /favicon.ico (3 live) #8 GZIP 0ms 465 bytes (pipelined: 4)
Jun 18, 2024 21:09:39.516 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /web (3 live) #9 GZIP
Jun 18, 2024 21:09:39.517 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /web (3 live) #9 GZIP 0ms 465 bytes (pipelined: 5)
Jun 18, 2024 21:09:39.658 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /favicon.ico (3 live) #a GZIP
Jun 18, 2024 21:09:39.659 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /favicon.ico (3 live) #a GZIP 0ms 465 bytes (pipelined: 6)
Jun 18, 2024 21:09:50.112 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /web (3 live) #b GZIP
Jun 18, 2024 21:09:50.112 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /web (3 live) #b GZIP 0ms 465 bytes (pipelined: 7)
Jun 18, 2024 21:09:50.263 [140077366332216] DEBUG - Request: [192.168.1.58:55089 (Subnet)] GET /favicon.ico (3 live) #c GZIP
Jun 18, 2024 21:09:50.263 [140077382822712] DEBUG - Completed: [192.168.1.58:55089] 503 GET /favicon.ico (3 live) #c GZIP 0ms 465 bytes (pipelined: 8)
Jun 18, 2024 21:09:50.981 [140077394504336] ERROR - SQLITE3:0x80000001, 11, database corruption at line 68825 of [a29f994989]
Jun 18, 2024 21:09:50.981 [140077394504336] ERROR - SQLITE3:0x80000001, 11, database corruption at line 68975 of [a29f994989]
Jun 18, 2024 21:09:50.981 [140077394504336] ERROR - SQLITE3:0x80000001, 11, statement aborts at 24: [update blobs set created_at = iif(typeof(created_at) in (‘integer’, ‘real’), created_at, strftime(‘%s’, created_at, ‘utc’))] database disk image is malformed
Jun 18, 2024 21:09:51.011 [140077384932152] DEBUG - Request: didn’t get any data from [::ffff:192.168.1.58]:55090: End of file
Jun 18, 2024 21:09:51.895 [140077394504336] ERROR - Exception inside transaction (inside=1) (/home/runner/actions-runner/_work/plex-media-server/plex-media-server/Library/DatabaseMigrations.cpp:342): sqlite3_statement_backend::loadOne: database disk image is malformed
Jun 18, 2024 21:09:52.420 [140077394504336] ERROR - Exception thrown during migrations, aborting: sqlite3_statement_backend::loadOne: database disk image is malformed

A little update: if I try to open PMS via bundled web app I get this error:

ERR_CONNECTION_REFUSED

Before that I see this message:

This XML file does not appear to have any style information associated with it. The document tree is shown below.

I didn’t change anything, the port is open, I just performed an update…

Is it possible that the update changed PMS communication port?

Just to bump this query because I have the exact same issue. The new update killed access to my server. I’m just working through troubleshooting right now and found myself here. If anyone else has had this problem, and found a solution, please post here.

Well, it autoresolved for me. I’m not sure how, but I did have to download the Plex Media Server App, and rebooted and then logged into to both. It is hard to know because this was not a repeatable issue.

Where did you download PMS App from? I tried to download it again but unsuccessfully… Did you delete the app before installing it again?
I’d like to repeat your steps to solve the issue.

I didn’t have the server app on my server computer before. I got the app from here: https://www.plex.tv/media-server-downloads/?cat=plex+desktop&plat=windows#plex-app

The database is corrupt.

You’ve three choices:

  1. Restore from backup
  2. Attempt repair
  3. Delete and start over

Restore from Backup

You can try restoring from a backup copy. See Restore a Database Backed Up via ‘Scheduled Tasks.

The two main database files are com.plexapp.plugins.library.db and com.plexapp.plugins.library.blobs.db and are located in the Plex Data Folder, in the Plug-in Support/Databases subdiretory.

You should also see backup versions of each file with the date appended to the file name.

Read the document, but the basic approach is:

  1. Stop Plex Media Server
  2. Rename the current files to .db.bak.
  3. Pick one of the backups and remove the date from the name so the files end in .db.
  4. Start Plex Media Server.

Hopefully PMS will start and you can login and access the server. If you see a “503 maintenance” message, that is Plex updating the database. Do not stop the process. Wait a few minutes and try again (it may take some time for the migration to complete).

It is not possible to tell when the database corruption occurred, so there is a chance that the backup is also corrupt. You can pull the server log files and look in Plex Media Server.log for the SQLite error messages that mention the database is corrupt or malformed.

If the backup is corrupt, you can repeat the process with a different backup.

If PMS is running normally, rescan all the libraries to pick up changes that occurred since the backup was taken.


Repair

The process is more involved than restoring from a backup. You will need to login to the NAS via SSH and issue commands via the Linux CLI.

See: Repair a Corrupted Database

The document does not provide the location of the Plex SQLite tool for Terramaster NAS.

Looking at the log snippet you provided, it seems to be somewhere in /Volume1/@apps/plex/plexmediaserver/ (I’m not familiar w/ Terramaster NAS, so not sure of exact location).

Read through the support document, but the basic approach is:

  1. cd to the database directory
  2. launch Plex SQLite and open the database: "/path/to/Plex SQLite" com.plexapp.plugins.library.db
  3. Issue the SQLite commands mentioned in the document.
    Perform the vacuum and reindex even if the integrity check says the file is OK.

Note that the commands are case sensitive. Use VACUUM;, not vacuum;. Also, the semi-colon is important.
Use .quit to exit Plex SQLite.

If those steps do not repair the database, you can also try the low level recovery. The process exports info from the database to a temporary file then reads it back into a new database file.

Delete & Start Over

If you’ve no valid backup and the db cannot be repaired, then you’ll have to delete things and start over.

  1. Uninstall Plex Media Server
  2. Delete the contents of the Plex Data Folder
  3. Reinstall Plex Media Server, claim the server, etc. (the same as when first installed).

Well, thanks for your answer.

Choice #1 failed, PMS didn’t open.

I have doubts about choice #2 (SQL): I tried to open db file but I get this errors…:

Error relocating /usr/lib/libcrypto.so.3: makecontext: symbol not found
Error relocating /usr/lib/libcrypto.so.3: setcontext: symbol not found
Error relocating /usr/lib/libcrypto.so.1.1: makecontext: symbol not found
Error relocating /usr/lib/libcrypto.so.1.1: setcontext: symbol not found
Error relocating /usr/lib/libldap-2.4.so.2: sys_errlist: symbol not found
Error relocating /usr/lib/libldap-2.4.so.2: sys_nerr: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_exchange_16: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_compare_exchange_16: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_load_16: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_store_16: symbol not found
Error relocating /lib/libresolv.so.2: __poll: symbol not found
Error relocating /lib/libresolv.so.2: __res_iclose: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_get_preinit: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_get_override: symbol not found
Error relocating /lib/libresolv.so.2: __gmtime_r: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_get: symbol not found
Error relocating /lib/libresolv.so.2: __sendmmsg: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_put: symbol not found
Error relocating /lib/libresolv.so.2: inet_nsap_ntoa: symbol not found
Error relocating /lib/libresolv.so.2: errno: symbol not found
Error relocating /lib/libresolv.so.2: __resp: symbol not found
Error relocating /lib/libresolv.so.2: __h_errno: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: drmGetDevices2: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: drmFreeDevices: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: curl_url_strerror: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_deserialize: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_error_offset: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_changes64: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_total_changes64: symbol not found
[Myrddid@MyrNAS Databases]# /Volume1/@apps/plex/plexmediaserver/Plex\ SQLite com.plexapp.plugins.library.db
Error relocating /usr/lib/libcrypto.so.3: makecontext: symbol not found
Error relocating /usr/lib/libcrypto.so.3: setcontext: symbol not found
Error relocating /usr/lib/libcrypto.so.1.1: makecontext: symbol not found
Error relocating /usr/lib/libcrypto.so.1.1: setcontext: symbol not found
Error relocating /usr/lib/libldap-2.4.so.2: sys_errlist: symbol not found
Error relocating /usr/lib/libldap-2.4.so.2: sys_nerr: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_exchange_16: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_compare_exchange_16: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_load_16: symbol not found
Error relocating /lib/libatomic.so.1: __atomic_store_16: symbol not found
Error relocating /lib/libresolv.so.2: __poll: symbol not found
Error relocating /lib/libresolv.so.2: __res_iclose: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_get_preinit: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_get_override: symbol not found
Error relocating /lib/libresolv.so.2: __gmtime_r: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_get: symbol not found
Error relocating /lib/libresolv.so.2: __sendmmsg: symbol not found
Error relocating /lib/libresolv.so.2: __resolv_context_put: symbol not found
Error relocating /lib/libresolv.so.2: inet_nsap_ntoa: symbol not found
Error relocating /lib/libresolv.so.2: errno: symbol not found
Error relocating /lib/libresolv.so.2: __resp: symbol not found
Error relocating /lib/libresolv.so.2: __h_errno: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: drmGetDevices2: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: drmFreeDevices: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: curl_url_strerror: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_deserialize: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_error_offset: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_changes64: symbol not found
Error relocating /Volume1/@apps/plex/plexmediaserver/Plex Media Server: sqlite3_total_changes64: symbol not found

…and SQL doesn’t open, I still get SSH prompt, not SQL prompt. Where am I wrong?

Run Plex Sqlite as root using sudo. Apologies. I forgot to mention that.

I ran the db repair steps on my Synology. The output is below. I added some comments to the output.

The db is not corrupt, but you can see the commands executing.

You will have to adjust for the different paths, but otherwise it should look the same on your system.

L0neWo1f@kiowa:~$ cd /volume1/PlexMediaServer/AppData/Plex\ Media\ Server/Plug-in\ Support/Databases/
L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ ls -l
total 1497400
drwxr-xr-x 1 PlexMediaServer PlexMediaServer       932 Jun 24 20:03  .
drwxr-xr-x 1 PlexMediaServer PlexMediaServer       100 Feb 10  2023  ..
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127426560 Jun 21 13:31  com.plexapp.plugins.library.blobs.db
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 126828544 Jun 13 15:53  com.plexapp.plugins.library.blobs.db-2024-06-13
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 126951424 Jun 16 04:06  com.plexapp.plugins.library.blobs.db-2024-06-16
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127238144 Jun 19 04:05  com.plexapp.plugins.library.blobs.db-2024-06-19
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127426560 Jun 22 02:12  com.plexapp.plugins.library.blobs.db-2024-06-22
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 179728384 Jun 24 20:03  com.plexapp.plugins.library.db
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 178122752 Jun 13 15:53  com.plexapp.plugins.library.db-2024-06-13
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 180240384 Jun 16 04:05  com.plexapp.plugins.library.db-2024-06-16
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 180260864 Jun 19 04:04  com.plexapp.plugins.library.db-2024-06-19
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 179105792 Jun 22 02:09  com.plexapp.plugins.library.db-2024-06-22
drwxr-xr-x 1 PlexMediaServer PlexMediaServer        82 May 25 15:45 'Music Analysis 222'
drwxr-xr-x 1 PlexMediaServer PlexMediaServer        82 May 25 15:45 'Music Analysis 257'

L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ sudo "/var/packages/PlexMediaServer/target/Plex SQLite" com.plexapp.plugins.library.db
Password:
SQLite version 3.39.4 2022-09-29 15:55:41
Enter ".help" for usage hints.
sqlite> PRAGMA integrity_check;
ok
sqlite> VACUUM;
sqlite> REINDEX;
sqlite>
sqlite> .output db-recover.sqlite   <-- this starts the low level recovery process
sqlite> .recover
sqlite> .quit

# rename the current database file

L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ sudo mv com.plexapp.plugins.library.db com.plexapp.plugins.library.db.save
Password:

# relaunch Plex Sqlite and import the data into a new database file.

L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ sudo "/var/packages/PlexMediaServer/target/Plex SQLite" com.plexapp.plugins.library.db
SQLite version 3.39.4 2022-09-29 15:55:41
Enter ".help" for usage hints.
sqlite>
sqlite> .read db-recover.sqlite
sqlite> .quit

# You can see the new database file.  However, it is owned by root, so that has to be corrected.

L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ ls -l
total 2007664
drwxr-xr-x 1 PlexMediaServer PlexMediaServer      1012 Jun 24 20:15  .
drwxr-xr-x 1 PlexMediaServer PlexMediaServer       100 Feb 10  2023  ..
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127426560 Jun 21 13:31  com.plexapp.plugins.library.blobs.db
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 126828544 Jun 13 15:53  com.plexapp.plugins.library.blobs.db-2024-06-13
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 126951424 Jun 16 04:06  com.plexapp.plugins.library.blobs.db-2024-06-16
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127238144 Jun 19 04:05  com.plexapp.plugins.library.blobs.db-2024-06-19
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127426560 Jun 22 02:12  com.plexapp.plugins.library.blobs.db-2024-06-22
-rw------- 1 root            root            177549312 Jun 24 20:14  com.plexapp.plugins.library.db
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 178122752 Jun 13 15:53  com.plexapp.plugins.library.db-2024-06-13
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 180240384 Jun 16 04:05  com.plexapp.plugins.library.db-2024-06-16
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 180260864 Jun 19 04:04  com.plexapp.plugins.library.db-2024-06-19
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 179105792 Jun 22 02:09  com.plexapp.plugins.library.db-2024-06-22
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 177496064 Jun 24 20:10  com.plexapp.plugins.library.db.save
-rw------- 1 root            root            347199111 Jun 24 20:12  db-recover.sqlite
drwxr-xr-x 1 PlexMediaServer PlexMediaServer        82 May 25 15:45 'Music Analysis 222'
drwxr-xr-x 1 PlexMediaServer PlexMediaServer        82 May 25 15:45 'Music Analysis 257'


# correct file permissions and ownership.  Also delete the temp file with exported data, as it is no longer needed.
# The file must be owned by the user:group that runs Plex Media Server.  On Synology, that is PlexMediaServer.  I do not know the user:group on Terramaster.

L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ sudo chmod a+r com.plexapp.plugins.library.db
L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ sudo chown PlexMediaServer:PlexMediaServer com.plexapp.plugins.library.db
L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ sudo rm db-recover.sqlite


# The ownership & permissions are now correct.  Plex Media Server can be started.

L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$ ls -l
total 1668600
drwxr-xr-x 1 PlexMediaServer PlexMediaServer       978 Jun 24 20:16  .
drwxr-xr-x 1 PlexMediaServer PlexMediaServer       100 Feb 10  2023  ..
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127426560 Jun 21 13:31  com.plexapp.plugins.library.blobs.db
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 126828544 Jun 13 15:53  com.plexapp.plugins.library.blobs.db-2024-06-13
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 126951424 Jun 16 04:06  com.plexapp.plugins.library.blobs.db-2024-06-16
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127238144 Jun 19 04:05  com.plexapp.plugins.library.blobs.db-2024-06-19
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 127426560 Jun 22 02:12  com.plexapp.plugins.library.blobs.db-2024-06-22
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 177549312 Jun 24 20:14  com.plexapp.plugins.library.db
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 178122752 Jun 13 15:53  com.plexapp.plugins.library.db-2024-06-13
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 180240384 Jun 16 04:05  com.plexapp.plugins.library.db-2024-06-16
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 180260864 Jun 19 04:04  com.plexapp.plugins.library.db-2024-06-19
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 179105792 Jun 22 02:09  com.plexapp.plugins.library.db-2024-06-22
-rw-r--r-- 1 PlexMediaServer PlexMediaServer 177496064 Jun 24 20:10  com.plexapp.plugins.library.db.save
drwxr-xr-x 1 PlexMediaServer PlexMediaServer        82 May 25 15:45 'Music Analysis 222'
drwxr-xr-x 1 PlexMediaServer PlexMediaServer        82 May 25 15:45 'Music Analysis 257'
L0neWo1f@kiowa:/volume1/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases$

You don’t need to apologize to me, I mean it, you’re providing the help that I need, and I thank you very much.

I will try db repair asap, I need to stay at home and give it the necessary time, I will report what I get.

May I ask you a question? I’m not a pro in these things, I’m trying to learn what I need to make things work… I can find many scripts to perform automatic backups stopping and restarting PMS: I just don’t understand what to do with them, where put them in my system… could you help me?

Regarding running the repair commands, my example is on a Synology NAS.

These should have the correct paths for Terramaster:

Change to the directory with the Plex database files:
cd "/home/plex/Library/Application Support/Plex Media Server/Plug-in Support/Databases"

Run Plex SQLite and open the Plex database. “sudo” will run the command as root. You will be asked for the root (admin) password.
sudo "/Volume1/@apps/plex/plexmediaserver/Plex SQLite" com.plexapp.plugins.library.db


Regarding backup scripts, etc. I'll help where I can. The issue is that every NAS is different. I've never used a Terramaster NAS, so I won't know the exact location of where to place things.

Regarding backups, on my Synology, I use Hyper Backup, their backup app, and back up the Plex Data Folder to an external drive once per week.

I do not stop Plex Media Server before running the backup.

There is some risk, as the database is still open. It will not corrupt the database files, but the backup of the open database files may not be valid (if Plex was writing to the db during the backup, it would cause a problem).

Personally, the risk is OK. I schedule the backup to run when there is minimal activity on the server. Also, the backups that Plex makes (the ones with the dates appended) will be backed up correctly. Worse case is that I use one of those files if I need to restore the database for some reason.

I see, too bad we use different NASs…

Entire Plex Data Folder is more than 5GB, I don’t know if I want to back up the entire folder. According to many users the only necessary files are com.plexapp.plugins.library.db, com.plexapp.plugins.library.blobs.db and preferences.xml. What do you think about it?

Backing up just those files is fine. I suggest you backup the entire Databases folder. That will also pick up the backups made by Plex every three days. That gives you fallback versions in case the primary version is corrupt.

OK, I get your suggestion, I will do it.

Now I have another problem: sudo command doesn’t work, because in TOS5 Terramaster deleted root user, I just can login only as admin.
I could have found a solution but I need to edit the ssh_service file and I have no clue on how to do it. I think I should donwload it on my pc, edit and then upload again on NAS… but again, I don’t know how.

EDIT: I apparently created root user and ran SQLite, but as I input the first command I get “unable to open file” and gone back to ssh (SQLite closed).

Grrr… Didn’t know that.

Does the sudo command exist?

If so, try sudo -u plex then the rest of the command. sudo -u plex "/Volume1/@apps.....

That will run the command as user “plex” which should have read/write access to the files.

Note: Just to verify things, in the directory with the database files, issue the command ls -l. That will show the owner of the files. I think it is plex, but double check to be sure (it is PlexMediaServer on Synology).


There is another option. You can use your PC to try to repair the database files.

You install PMS on the PC, copy the database files from the NAS to your PC, and use a utility from GitHub to try and repair the db files. If it works, move the db files back to the NAS.

FYI 1: The utility was written by a person that works for Plex.
FYI 2: It does not support Terramaster or I would have mentioned it earlier.

  1. Download and install Plex Media Server on your PC. Install the same version that is on the NAS.
    You do not need to claim the server. We just need the binaries installed on the PC.

  2. If Plex Media Server is running on the PC, stop it.
    Right click on the icon in the task bar, choose Exit.

  3. Copy the database files from the NAS to the Plex Data Folder on the PC: C:\Users\user_name\AppData\Local\Plex Media Server\Plug-in Support\Databases.
    The files to copy are: com.plexapp.plugins.library.db and com.plexapp.plugins.library.blobs.db.

  4. Copy the Windows version of the Plex DBRepair Utility to the PC.

  1. Run the bat file from a c:\ prompt: c:\DBRepair-Windows.bat.

The bat file issues all the SQL commands for you, instead of entering them manually.
The output will tell you if it was successful or not.

If it was successful:

  1. Copy the two db files back to the NAS.
    Make sure permissions and ownership is correct:
chown plex:plex com.plexapp.*  <-- sets ownership to plex
chmod a+r com.plexapp.*  <-- read only for everybody 
chmod o+rw com.plexapp.*  <-- read write for owner
  1. Start Plex Media Server on the NAS and see if it works.

Here is a sample output of the bat file.

c:\Temp>DBRepair-Windows.bat

NOTE: This script is being replaced with the PowerShell script DBRepair-Windows.ps1,
      which aims to better emulate DBRepair.sh (more options, interative mode, etc).
      Consider moving over to the new script.

15:52:46.88 --  ====== Session begins. (Wed 06/26/2024) ======
15:52:47.11 --  Exporting Main DB
15:52:47.41 --  Exporting Blobs DB
15:52:47.47 --  Exporting Complete.
15:52:47.48 --  Creating Main DB
15:52:47.66 --  Verifying Main DB
15:52:47.70 --  Main DB verification check is: ok
15:52:47.70 --  Main DB verification successful.
15:52:47.71 --  Creating Blobs DB
15:52:47.77 --  Verifying Blobs DB
15:52:47.80 --  Blobs DB verification check is: ok
15:52:47.80 --  Blobs DB verification successful.
15:52:47.81 --  Import and verification complete.
15:52:47.82 --  Reindexing Main DB
15:52:47.87 --  Reindexing Blobs DB
15:52:48.01 --  Reindexing complete.
15:52:48.02 --  Moving current DBs to DBTMP and making new databases active
        1 file(s) moved.
        1 file(s) moved.
        1 file(s) moved.
        1 file(s) moved.
15:52:48.03 --  Database repair/rebuild/reindex completed.
15:52:48.03 --  ====== Session completed. ======

c:\Temp>

Yes, it does.
I’ll try this tonight, but I think you’re right, it makes sense to me… Since Terramaster has cancelled root user, database files must belong to Plex (or PMS as on Synology, I’ll see later).

If it doesn’t work, I’m going to install PMS on my PC as you suggested.

Anyway, I’ll report here. Thanks a lot for now

Too bad, I’ve got an error on my NAS System and I might need to reinstall it…

I’ll do this bloody thing next weekend, so I must wait to attempt repairing Plex db.

See you soon

Update: I reinstalled NAS, repaired db via Windows and sent them back to NAS.
I have a doubt on setting permissions: chmod plex: plex com.plexapp.* desn’t work… am I missing something?