New music not detected

server-linux

#1

Hi there,

Since about a week, PMS no longer detects new music being loaded in my library
Even forcing a scan (music > scan library files) does not help

I'm on PMS 1.13.0.5023 on CentOS 7
For an unkown reason, I did not manage to attach the logs here --> https://we.tl/cPTxsobXXu

Could this be due to a limitation on the number of albums or tracks?

Thanks!


#2

Did you go back from a Plex server version 1.13.2 to 1.13.0 ?
Your logs are full of errors like
SQLITE3:0x10, 1, no such collation sequence: naturalsort

I’m afraid, you may need to revert a change in the database, which occured in PMS 1.13.1 and above.
Perform the database repair procedure as listed in this forum post.
Attention: these instructions have 2 crucial lines more than in the official documentation!
http://forums.plex.tv/discussion/comment/1678319/#Comment_1678319


#3

Another important question:
Are you running low on diskspace for the Plex data folder
or did you in the past?
There appear to be damages in other database files as well, which are usually caused by either insuffcient diskspace or RAM constraints.


#4

Hi Otto,

Thanks a bunch for your support !!

Yes, I upgraded first to 1.13.2 a few days ago, but then PMS appeared to be stuck for something like 20-30 minutes, while the CPU remained at 100%
As I suspected a bug, I downgraded back to 1.13.0

I have plenty of disc space available, but we’re having very frequent power cuts over here
I guess this does not really support DB integrity…

Anyway, one way or another, I have a nicely messed up DB… So, let’s fix it now
First question: do I have to first upgrade to 1.13.2 before following your instructions?

Also, after stopping PMS, I have just run an integrity check which said “ok” without any other comment…
Is the DB REALLY messed up then ??

Thanks!

[patrick@plex Databases]# pwd
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases
[patrick@plex Databases]#
[patrick@plex Databases]# ls -l
total 23549204
-rw-r–r-- 1 plex plex 69632 9 déc 2017 com.plexapp.dlna.db
-rw-r–r-- 1 plex plex 32768 9 déc 2017 com.plexapp.dlna.db-shm
-rw-r–r-- 1 plex plex 292552 9 déc 2017 com.plexapp.dlna.db-wal
-rw-r–r-- 1 plex plex 519112704 15 jun 11:13 com.plexapp.plugins.library.blobs.db
-rw-r–r-- 1 plex plex 464977920 3 jun 23:05 com.plexapp.plugins.library.blobs.db-2018-06-03
-rw-r–r-- 1 plex plex 483724288 6 jun 23:05 com.plexapp.plugins.library.blobs.db-2018-06-06
-rw-r–r-- 1 plex plex 503869440 9 jun 23:03 com.plexapp.plugins.library.blobs.db-2018-06-09
-rw-r–r-- 1 plex plex 513624064 12 jun 23:04 com.plexapp.plugins.library.blobs.db-2018-06-12
-rw-r–r-- 1 plex plex 3003015168 15 jun 11:13 com.plexapp.plugins.library.db
-rw-r–r-- 1 plex plex 882180096 19 jan 2017 com.plexapp.plugins.library.db-2017-01-15-tmp
-rw-r–r-- 1 plex plex 1024 15 jan 2017 com.plexapp.plugins.library.db-2017-01-15-tmp-journal
-rw-r–r-- 1 plex plex 991198208 28 jan 2017 com.plexapp.plugins.library.db-2017-01-27-tmp
-rw-r–r-- 1 plex plex 1024 27 jan 2017 com.plexapp.plugins.library.db-2017-01-27-tmp-journal
-rw-r–r-- 1 plex plex 843062272 3 fév 2017 com.plexapp.plugins.library.db-2017-01-30-tmp
-rw-r–r-- 1 plex plex 1024 30 jan 2017 com.plexapp.plugins.library.db-2017-01-30-tmp-journal
-rw-r–r-- 1 plex plex 1087966208 8 fév 2017 com.plexapp.plugins.library.db-2017-02-05-tmp
-rw-r–r-- 1 plex plex 1024 5 fév 2017 com.plexapp.plugins.library.db-2017-02-05-tmp-journal
-rw-r–r-- 1 plex plex 1033899008 18 fév 2017 com.plexapp.plugins.library.db-2017-02-17-tmp
-rw-r–r-- 1 plex plex 1024 17 fév 2017 com.plexapp.plugins.library.db-2017-02-17-tmp-journal
-rw-r–r-- 1 plex plex 966007808 22 fév 2017 com.plexapp.plugins.library.db-2017-02-20-tmp
-rw-r–r-- 1 plex plex 1024 20 fév 2017 com.plexapp.plugins.library.db-2017-02-20-tmp-journal
-rw-r–r-- 1 plex plex 911326208 12 mar 2017 com.plexapp.plugins.library.db-2017-03-07-tmp
-rw-r–r-- 1 plex plex 1024 7 mar 2017 com.plexapp.plugins.library.db-2017-03-07-tmp-journal
-rw-r–r-- 1 plex plex 2941981696 3 jun 23:05 com.plexapp.plugins.library.db-2018-06-03
-rw-r–r-- 1 plex plex 2981365760 6 jun 23:04 com.plexapp.plugins.library.db-2018-06-06
-rw-r–r-- 1 plex plex 2986904576 9 jun 23:03 com.plexapp.plugins.library.db-2018-06-09
-rw-r–r-- 1 plex plex 2999659520 12 jun 23:04 com.plexapp.plugins.library.db-2018-06-12
[patrick@plex Databases]# df -h
Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur
/dev/mapper/centos_plex-root 50G 9,9G 41G 20% /
devtmpfs 3,8G 0 3,8G 0% /dev
tmpfs 3,8G 2,3M 3,8G 1% /dev/shm
tmpfs 3,8G 11M 3,8G 1% /run
tmpfs 3,8G 0 3,8G 0% /sys/fs/cgroup
/dev/mapper/centos_plex-home 408G 120G 288G 30% /home
/dev/sda2 497M 253M 244M 51% /boot
/dev/sda1 200M 9,8M 191M 5% /boot/efi
//192.168.1.200/series 11T 7,1T 3,7T 66% /home/plex/Séries
//192.168.1.200/videos 11T 7,1T 3,7T 66% /home/plex/Vidéos
//192.168.1.200/mp3 11T 7,1T 3,7T 66% /home/plex/Musique
tmpfs 775M 32K 775M 1% /run/user/1000
tmpfs 775M 0 775M 0% /run/user/0
[patrick@plex Databases]#
[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db “PRAGRA integrity_check”
Error: near “PRAGRA”: syntax error
[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db “PRAGMA integrity_check”
ok


#5

@“patrick@derwael.be” said:
First question: do I have to first upgrade to 1.13.2 before following your instructions?

No, the point is to remove the incompatible collation, so it runs in 1.13.0

But, it may be worth updating again, now that we have a clean database.

Also, after stopping PMS, I have just run an integrity check which said “ok” without any other comment…

That is non-conclusive. Your DB may be in a weird state with half of the tables migrated to a newer revision of the DB schema. Those errors in your logs must be caused by something.
I’d recommend performing the repair procedure anyway. It can’t hurt and is a good preparation for the update to 1.13.2

While you have Plex server shut down, please erase the gracenote database files.
They are defective as well.
(Don’t worry, they will be restored automatically in the first hours after the restart.)
in the folder /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache
erase these files:

gn_cachq.gdb
gn_colls.gdb
gn_lists.gdb

#6

Ok, done all that now, but the result is not quite what I was expecting: PMS does not restart after the data export/import…

I’m a bit worried about the “DELETE from schema_migrations where version=‘20180501000000’”, but as the instructions were saying " exactly as written", so did I…

[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db “DROP index ‘index_title_sort_naturalsort’”
Error: no such index: index_title_sort_naturalsort
[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db “DELETE from schema_migrations where version=‘20180501000000’”
[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db “PRAGMA integrity_check”
ok
[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db .dump > dump.sql
[patrick@plex Databases]# ls -l dump.sql
-rw-r–r-- 1 root root 2270907824 15 jun 12:00 dump.sql
[patrick@plex Databases]# mv com.plexapp.plugins.library.db com.plexapp.plugins.library.db.original
[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db < dump.sql
[patrick@plex Databases]# sqlite3 com.plexapp.plugins.library.db “PRAGMA integrity_check”
ok
[patrick@plex Databases]# systemctl start plexmediaserver.service
[patrick@plex Databases]# systemctl status plexmediaserver
? plexmediaserver.service - Plex Media Server for Linux
Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since ven 2018-06-15 12:11:57 CEST; 24s ago
Process: 30823 ExecStart=/bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver “/usr/lib/plexmediaserver/Plex Media Server” (code=exited, status=255)
Process: 30820 ExecStartPre=/bin/sh -c /usr/bin/test -d “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” || /bin/mkdir -p “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” (code=exited, status=0/SUCCESS)
Main PID: 30823 (code=exited, status=255)

jun 15 12:11:52 plex.mydomain systemd[1]: Unit plexmediaserver.service entered failed state.
jun 15 12:11:52 plex.mydomain systemd[1]: plexmediaserver.service failed.
jun 15 12:11:57 plex.mydomain systemd[1]: plexmediaserver.service holdoff time over, scheduling restart.
jun 15 12:11:57 plex.mydomain systemd[1]: start request repeated too quickly for plexmediaserver.service
jun 15 12:11:57 plex.mydomain systemd[1]: Failed to start Plex Media Server for Linux.
jun 15 12:11:57 plex.mydomain systemd[1]: Unit plexmediaserver.service entered failed state.
jun 15 12:11:57 plex.mydomain systemd[1]: plexmediaserver.service failed.
[patrick@plex Databases]#


#7

you still have the backup in the file com.plexapp.plugins.library.db.original
save it in a different location, just in case.

How big is the file dump.sql ?
is it several dozens megabytes or very small?

Was Plex server totally stopped while you were performing the repair procedure?


#8

@OttoKerner said:
you still have the backup in the file com.plexapp.plugins.library.db.original
save it in a different location, just in case.

Done that -

How big is the file dump.sql ?
is it several dozens megabytes or very small?

It is about 2.2Gb
[patrick@plex Databases]# ls -l dump.sql
-rw-r–r-- 1 root root 2270907824 15 jun 12:00 dump.sql
[patrick@plex Databases]#

Was Plex server totally stopped while you were performing the repair procedure?

I guess it was as I did not get any feedback from systemctl stop plexmediaserver, but I must admit I did not cross check with ps


#9

2.2 GB is a lot. Do you have many items in Plex?

What is the size of the reimported com.plexapp.plugins.library.db?

What happened exactly after you tried to restart Plex?
any log files?


#10

It is expected that the first start after the procedure takes longer, because all the index tables need to get recreated, which were dropped by the repair procedure.
Perhaps you were just impatient?


#11

@OttoKerner said:
2.2 GB is a lot. Do you have many items in Plex?

Something like 60K albums plus a few 100’s of movies

What is the size of the reimported com.plexapp.plugins.library.db?

It is about 3GB, which makes sense in regards of the dump (2.2Gb)

[patrick@plex Databases]# ls -l com.plexapp.plugins.library.db
-rw-r–r-- 1 root root 3003328512 15 jun 12:06 com.plexapp.plugins.library.db
[patrick@plex Databases]# ls -l dump.sql
-rw-r–r-- 1 root root 2270907824 15 jun 12:00 dump.sql

What happened exactly after you tried to restart Plex?

Actually, nothing at all, so I tried to start it again and then checked the status

[patrick@plex Databases]# systemctl status plexmediaserver
? plexmediaserver.service - Plex Media Server for Linux
Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since ven 2018-06-15 12:11:57 CEST; 24s ago
Process: 30823 ExecStart=/bin/sh -c LD_LIBRARY_PATH=/usr/lib/plexmediaserver “/usr/lib/plexmediaserver/Plex Media Server” (code=exited, status=255)
Process: 30820 ExecStartPre=/bin/sh -c /usr/bin/test -d “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” || /bin/mkdir -p “${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}” (code=exited, status=0/SUCCESS)
Main PID: 30823 (code=exited, status=255)

jun 15 12:11:52 plex.mydomain systemd[1]: Unit plexmediaserver.service entered failed state.
jun 15 12:11:52 plex.mydomain systemd[1]: plexmediaserver.service failed.
jun 15 12:11:57 plex.mydomain systemd[1]: plexmediaserver.service holdoff time over, scheduling restart.
jun 15 12:11:57 plex.mydomain systemd[1]: start request repeated too quickly for plexmediaserver.service
jun 15 12:11:57 plex.mydomain systemd[1]: Failed to start Plex Media Server for Linux.
jun 15 12:11:57 plex.mydomain systemd[1]: Unit plexmediaserver.service entered failed state.
jun 15 12:11:57 plex.mydomain systemd[1]: plexmediaserver.service failed.

any log files?

Which ones, where to look for them?


#12

@“patrick@derwael.be” said:
Which ones, where to look for them?

All of them. Just when you attached them to your initial posting above.


#13

Here they are


#14

Oh, I forgot to tell you:

com.plexapp.plugins.library.db-shm
com.plexapp.plugins.library.db-wal

these two files need to be moved out of the folder.
Place them beside your backed up com.plexapp.plugins.library.db.original

Afterwards the start should be successful.


#15

There is no such files over there
com.plexapp.plugins.library.db-shm
com.plexapp.plugins.library.db-wal

But I have these:
com.plexapp.dlna.db
com.plexapp.dlna.db-shm
com.plexapp.dlna.db-wal

Should I move them out of the way before trying to restart?


#16

Just to be crystal clear, the 3 files I have just mentioned reside in /var/lib/plexmediaserver/Library/Application Support/Plex Media/server/Plug-in Support/Databases


#17

@“patrick@derwael.be” said:
com.plexapp.dlna.db
com.plexapp.dlna.db-shm
com.plexapp.dlna.db-wal

No, they don’t matter.


#18

There are these errors in the logs, which indicate that the database file is still locked.

Jun 15, 2018 12:57:29.909 [0x7f4b83947840] DEBUG - Opening 20 database sessions to library (com.plexapp.plugins.library), SQLite 3.13.0, threadsafe=1
Jun 15, 2018 12:57:29.914 [0x7f4b83947840] ERROR - SQLITE3:0x10, 8, statement aborts at 1: [PRAGMA journal_mode=WAL] attempt to write a readonly database
Jun 15, 2018 12:57:29.914 [0x7f4b83947840] ERROR - Database corruption: sqlite3_statement_backend::loadOne: attempt to write a readonly database
Jun 15, 2018 12:57:29.914 [0x7f4b83947840] ERROR - Error: Unable to set up server: sqlite3_statement_backend::loadOne: attempt to write a readonly database (N4soci10soci_errorE)

did you close any instances of sqlite3 or other database editors, which may have this database open?

May I see a full listing of the files in
/var/lib/plexmediaserver/Library/Application Support/Plex Media/server/Plug-in Support/Databases
?
ls -ail to show access permissions


#19

@OttoKerner said:

did you close any instances of sqlite3 or other database editors, which may have this database open?

Absolutely:
[patrick@plex Databases]# ps -aef | grep sql
root 22332 12986 0 14:55 pts/0 00:00:00 grep --color=auto sql

May I see a full listing of the files in
/var/lib/plexmediaserver/Library/Application Support/Plex Media/server/Plug-in Support/Databases
?
ls -ail to show access permissions

Here we go:
[patrick@plex Databases]# ls -ail
total 23549456
536871078 drwxr-xr-x 3 plex plex 4096 15 jun 14:52 .
170 drwxr-xr-x 7 plex plex 91 24 déc 2016 …
536871080 -rw-r–r-- 1 plex plex 69632 9 déc 2017 com.plexapp.dlna.db
536871082 -rw-r–r-- 1 plex plex 32768 9 déc 2017 com.plexapp.dlna.db-shm
536871081 -rw-r–r-- 1 plex plex 292552 9 déc 2017 com.plexapp.dlna.db-wal
540827503 -rw-r–r-- 1 plex plex 519112704 15 jun 11:13 com.plexapp.plugins.library.blobs.db
539318934 -rw-r–r-- 1 plex plex 464977920 3 jun 23:05 com.plexapp.plugins.library.blobs.db-2018-06-03
552744039 -rw-r–r-- 1 plex plex 483724288 6 jun 23:05 com.plexapp.plugins.library.blobs.db-2018-06-06
539100131 -rw-r–r-- 1 plex plex 503869440 9 jun 23:03 com.plexapp.plugins.library.blobs.db-2018-06-09
540068761 -rw-r–r-- 1 plex plex 513624064 12 jun 23:04 com.plexapp.plugins.library.blobs.db-2018-06-12
538580681 -rw-r–r-- 1 root root 3003328512 15 jun 12:06 com.plexapp.plugins.library.db
538646242 -rw-r–r-- 1 plex plex 882180096 19 jan 2017 com.plexapp.plugins.library.db-2017-01-15-tmp
538646243 -rw-r–r-- 1 plex plex 1024 15 jan 2017 com.plexapp.plugins.library.db-2017-01-15-tmp-journal
538107852 -rw-r–r-- 1 plex plex 991198208 28 jan 2017 com.plexapp.plugins.library.db-2017-01-27-tmp
538107853 -rw-r–r-- 1 plex plex 1024 27 jan 2017 com.plexapp.plugins.library.db-2017-01-27-tmp-journal
539877177 -rw-r–r-- 1 plex plex 843062272 3 fév 2017 com.plexapp.plugins.library.db-2017-01-30-tmp
539929243 -rw-r–r-- 1 plex plex 1024 30 jan 2017 com.plexapp.plugins.library.db-2017-01-30-tmp-journal
540387525 -rw-r–r-- 1 plex plex 1087966208 8 fév 2017 com.plexapp.plugins.library.db-2017-02-05-tmp
540388751 -rw-r–r-- 1 plex plex 1024 5 fév 2017 com.plexapp.plugins.library.db-2017-02-05-tmp-journal
539099658 -rw-r–r-- 1 plex plex 1033899008 18 fév 2017 com.plexapp.plugins.library.db-2017-02-17-tmp
539102670 -rw-r–r-- 1 plex plex 1024 17 fév 2017 com.plexapp.plugins.library.db-2017-02-17-tmp-journal
539442811 -rw-r–r-- 1 plex plex 966007808 22 fév 2017 com.plexapp.plugins.library.db-2017-02-20-tmp
539613869 -rw-r–r-- 1 plex plex 1024 20 fév 2017 com.plexapp.plugins.library.db-2017-02-20-tmp-journal
543063545 -rw-r–r-- 1 plex plex 911326208 12 mar 2017 com.plexapp.plugins.library.db-2017-03-07-tmp
543112913 -rw-r–r-- 1 plex plex 1024 7 mar 2017 com.plexapp.plugins.library.db-2017-03-07-tmp-journal
546882990 -rw-r–r-- 1 plex plex 2941981696 3 jun 23:05 com.plexapp.plugins.library.db-2018-06-03
539161116 -rw-r–r-- 1 plex plex 2981365760 6 jun 23:04 com.plexapp.plugins.library.db-2018-06-06
539603590 -rw-r–r-- 1 plex plex 2986904576 9 jun 23:03 com.plexapp.plugins.library.db-2018-06-09
540068756 -rw-r–r-- 1 plex plex 2999659520 12 jun 23:04 com.plexapp.plugins.library.db-2018-06-12
658947 drwxr-xr-x 2 plex plex 116 15 jun 14:52 repair
[patrick@plex Databases]# ls -ail repair
total 8083320
658947 drwxr-xr-x 2 plex plex 116 15 jun 14:52 .
536871078 drwxr-xr-x 3 plex plex 4096 15 jun 14:52 …
536871079 -rw-r–r-- 1 plex plex 3003015168 15 jun 11:13 com.plexapp.plugins.library.db
539575097 -rw-r–r-- 1 plex plex 3003328512 15 jun 12:46 com.plexapp.plugins.library.db_after_repair_attempt
538188985 -rw-r–r-- 1 plex plex 2270907824 15 jun 12:00 dump.sql
[patrick@plex Databases]#


#20

OK, this is a typical Linux issue.

540068761 -rw-r--r-- 1 plex plex 513624064 12 jun 23:04 com.plexapp.plugins.library.blobs.db-2018-06-12
538580681 -rw-r--r-- 1 root root 3003328512 15 jun 12:06 com.plexapp.plugins.library.db

Since Plex Server is running as the linux user plex, it now has no access permissions to the database file.
Because you performed the repair procedure logged in as user root, the restored database file now belongs to user root.
You need to change ownership of the database file back to plex, just like all other files in this folder are.

please see http://forums.plex.tv/discussion/comment/1581947/#Comment_1581947