Video Library's Being Skipped Without Logging Event (Music Libraries Are Fine)

Hi everyone, I’ve had a perfectly working Ubuntu Plex server for a couple of years, and I’ve recently updated to version 18.04 of Ubuntu and a updated Plex from 1.16.0.1226.

It’s taken me a couple of weeks to notice that now Plex fails to scan media libraries with video content, it will music ones but not video (I have no photo libraries to test). Backend wise, when watching the “Plex Media Scanner.log” nothing happens when to select a video library to scan, but request a music library and the Scanner.log file goes crazy doing what it’s supposed to do.

As scanner.log is no help, I’ve “tail -f”'ed all Plex log files, and clicked scan, the attached log file is of only a few seconds pre and a several seconds after the button is pressed. I can’t see anything of assistance, but this is certainly the first time I’ve looked a Plex logs, so don’t really know what normal is either. https://www.dropbox.com/s/kqnxnk27bujz2te/plex_library_scan_fault.txt?dl=0

Anyone else having these issues on the latest build? Or anyone able to shed some light on the solution before I go back to backup.

Server Version#: 1.16.3.1402
Server OS: Ubuntu 18.04.2 LTS

Further info about my setup, I run the VM Plex server on an ESXi, and my media content is connected by a QNAP in fstab. This share contains all content, so I don’t believe it’s a permissions or share issue. Nothing has changes on the QNAP in this time.

This update process has also broken my DVR settings completely, and I’m unable to reset it up, it just sits there scanner for compatible devices, though the back end “Plex Tuner Service.log” identifies the devices as usable. Below is a “Setup Plex DVR” button press.

==> /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Tuner Service.log <==
Jul 27, 2019 07:15:14.175 [0x7fd1b2ffd700] INFO - [I] web_service_t::process_device_discovery
Jul 27, 2019 07:15:14.175 [0x7fd1b2ffd700] INFO - [I] device_reactor_t::get_device_list ()
Jul 27, 2019 07:15:14.175 [0x7fd1b2ffd700] INFO - [I] dvb_device_factory_t::get_device_list ()
Jul 27, 2019 07:15:16.178 [0x7fd1b2ffd700] INFO - [I] SAT2IP - discover_satip_servers(): no servers found
Jul 27, 2019 07:15:16.606 [0x7fd1b2ffd700] INFO - [I] dvb_device_factory_t::get_device_list. Id dvb#hdhr#0#286345693, Name HDHomeRun {tunetwoidenticationid}({tunertwoipaddress}) - 0, Standards 1
Jul 27, 2019 07:15:16.606 [0x7fd1b2ffd700] INFO - [I] dvb_device_factory_t::get_device_list. Id dvb#hdhr#1#286345693, Name HDHomeRun {tunetworidenticationid} ({tunertwoipaddress}) - 1, Standards 1
Jul 27, 2019 07:15:16.606 [0x7fd1b2ffd700] INFO - [I] dvb_device_factory_t::get_device_list. Id dvb#hdhr#0#304168725, Name HDHomeRun {tuneoneridenticationid} ({tuneroneipaddress}) - 0, Standards 3
Jul 27, 2019 07:15:16.606 [0x7fd1b2ffd700] INFO - [I] dvb_device_factory_t::get_device_list. Id dvb#hdhr#1#304168725, Name HDHomeRun {tuneoneridenticationid} ({tuneroneipaddress}) - 1, Standards 3
Jul 27, 2019 07:15:16.607 [0x7fd1b2ffd700] INFO - [I] v4l::DeviceGetList_impl. getting v4l device list
Jul 27, 2019 07:15:16.610 [0x7fd1b2ffd700] INFO - [I] onetv_factory::DeviceGetListEx >>
Jul 27, 2019 07:15:16.611 [0x7fd1b2ffd700] WARN - [W] onetv_factory::DeviceGetListEx. libusb_init returned an error -99
Jul 27, 2019 07:15:16.611 [0x7fd1b2ffd700] INFO - [I] device_manager_t::get_device_list. Device HDHomeRun {tunetworidenticationid} ({tunertwoipaddress}) - 0, id dvb#hdhr#0#286345693, tuners 1, state 0, standards 1
Jul 27, 2019 07:15:16.611 [0x7fd1b2ffd700] INFO - [I] device_manager_t::get_device_list. Device HDHomeRun {tunetworidenticationid} ({tunertwoipaddress}) - 1, id dvb#hdhr#1#286345693, tuners 1, state 0, standards 1
Jul 27, 2019 07:15:16.611 [0x7fd1b2ffd700] INFO - [I] device_manager_t::get_device_list. Device HDHomeRun {tuneoneridenticationid} ({tuneroneipaddress}) - 0, id dvb#hdhr#0#304168725, tuners 1, state 0, standards 3
Jul 27, 2019 07:15:16.611 [0x7fd1b2ffd700] INFO - [I] device_manager_t::get_device_list. Device HDHomeRun {tuneoneridenticationid} ({tuneroneipaddress}) - 1, id dvb#hdhr#1#304168725, tuners 1, state 0, standards 3**code**

Thank you

First: please turn DEBUG logging back on. (It’s the default condition. it does’t use more space for DEBUG but it helps us a huge amount) please keep VERBOSE turned off (too much info)

Second: Restart plex and give it a moment to get started. There will be DEBUG messages I need to see. I’m looking for INOTIFY errors

Next: Scan files and let’s see what comes up

Last, Settings - Server - Troublehooting - Download Logs

Attach that ZIP file here so I can see what is happening.

I suspect you have more than 8192 directories being monitored by Plex (easily done).
Linux’s default is 8192. It’s easy to expand this. I have a how-to / procedure already written out.

Thanks for your reply ChuckPA, I’ve done a quick count at my folder structure and I’m thinking I only just have 6,000 in the full library, so I think your first thought might not be it ;( but certainly interested in knowing how to increase the Linux limit.

root@{servername}:/media/multimedia# find {completemediacollection} * -mindepth 1 -maxdepth 30 -type d | wc -l
6006
root@{servername}:/media/multimedia# find TV\ Series\ * -mindepth 1 -maxdepth 30 -type d | wc -l
703
root@{servername}:/media/multimedia# find Video\ Movies/ -mindepth 1 -maxdepth 30 -type d | wc -l
1234

I have completed the steps you’ve asked for, but do you mind if I upload to Dropbox instead, I’m not so fond of the idea of that much data about my Plex server out there.

I did do another tail -f *.log of the duration of time between click and action, and this file is attached.plex_library_scan_fault_enabled.txt (106.9 KB)

Thank you for your assist and the use of your time.

Increasing the Linux directory limit.

Very simple integer math

  1. Determine the total number of directories in use (from top to bottom)
sudo find /dir1 /dir2 /dir3 (as many as needed here)  -type d -print | wc -l
  1. This results in a number. Add 32767 to that number
  2. Divide by 32768 (modular units)
  3. Add 1 (allocate another 32K )
  4. Multiply back out for the iNotify value
  5. Add to /etc/sysctl.conf

Looks like

[chuck@lizum /vie.258]$ find ./movie* ./tv* ./*music* ./*ani* ./uhd ./4k -type d -print | wc -l
16313
[chuck@lizum /vie.259]$ expr 16313 + 32767
49080
[chuck@lizum /vie.260]$ expr 49080 / 32768
1
[chuck@lizum /vie.261]$ expr 1 + 1
2
[chuck@lizum /vie.262]$ expr 2 \* 32768
65536
[chuck@lizum /vie.263]$ sudo sh
sh-4.4# echo fs.inotify.max_user_watches=65536 >> /etc/sysctl.conf
sh-4.4# sysctl -p
fs.inotify.max_user_watches = 65536
sh-4.4#

Thanks for this ChuckPA, I have completed this change even though the logs didn’t suggested the issue and I still can’t update my video libraries.

Anyone else with some ideas. I’m thinking this weekend i’ll restore to backup (36 hours’ish).

Bit of a different topic, if I copy the database files over that’ll in theroy keep my watched history, sounds right?

Thanks everyone who is reading.

The DB maintains the watch history however there must also be supporting metadata files in place for the watched history to reference.

PMS’s database is a combination of SQLite3 and files. Copying only one part of it will result in data loss.

It is possible to bring the watched history table from one system to another because doing this injects new data into an existing, and otherwise fully functional, database/data tree.

As far as updating the video libraries, I believe it’s time to start taking bigger steps with restoring this. Such steps might be to just delete the section and recreate it if the number of missing exceeds the number of movies found / shown. IF the quantity is low, and the list known, Plex Dance those items.

I liked that idea, so I’ve attempted to remove one of the folders within the tv series library, and when clicking save, recieved a “Your changes could not be saved.” message. Opening the logs I’ve finally managed to find q database corruption message, yay a real issue found.

Aug 02, 2019 22:01:08.423 [0x7f23b77fe700] DEBUG - Request: [{clientipaddress}:50433 (Allowed Network (Subnet))] OPTIONS /library/sections/1?name=TV%20Shows&type=show&agent=com.plexapp.agents.thetvdb&scanner=Plex%20Series%20Scanner&language=en&importFromiTunes=&enableAutoPhotoTags=&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20ABCD&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20EFGH&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20IJKL&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20MNOP&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20QRST (24 live) TLS GZIP Signed-in Token ()
Aug 02, 2019 22:01:08.424 [0x7f2498862700] DEBUG - Completed: [{clientipaddress}:50433] 200 OPTIONS /library/sections/1?name=TV%20Shows&type=show&agent=com.plexapp.agents.thetvdb&scanner=Plex%20Series%20Scanner&language=en&importFromiTunes=&enableAutoPhotoTags=&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20ABCD&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20EFGH&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20IJKL&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20MNOP&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20QRST (24 live) TLS GZIP 0ms 301 bytes
Aug 02, 2019 22:01:08.425 [0x7f2498862700] DEBUG - Request came in with unrecognized domain / IP '{plexhostname}.{domainname}' in header Referer; treating as non-local
Aug 02, 2019 22:01:08.425 [0x7f2498862700] DEBUG - Auth: authenticated user 1 as {plexuserid}
Aug 02, 2019 22:01:08.426 [0x7f243affd700] DEBUG - Request: [{clientipaddress}:50436 (Allowed Network (Subnet))] PUT /library/sections/1?name=TV%20Shows&type=show&agent=com.plexapp.agents.thetvdb&scanner=Plex%20Series%20Scanner&language=en&importFromiTunes=&enableAutoPhotoTags=&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20ABCD&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20EFGH&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20IJKL&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20MNOP&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20QRST (24 live) TLS GZIP Signed-in Token ({plexuserid})
Aug 02, 2019 22:01:08.506 [0x7f243affd700] DEBUG - It took 70.000000 ms to retrieve 362 items.
Aug 02, 2019 22:01:08.506 [0x7f243affd700] DEBUG - Soft-deleting media item 5910.
Aug 02, 2019 22:01:08.507 [0x7f243affd700] ERROR - SQLITE3:(nil), 11, database corruption at line 70391 of [bf8c1b2b7a]
Aug 02, 2019 22:01:08.507 [0x7f243affd700] ERROR - SQLITE3:(nil), 11, statement aborts at 35: [update media_parts set deleted_at=? where media_item_id=?] database disk image is malformed
Aug 02, 2019 22:01:08.507 [0x7f243affd700] ERROR - Exception inside transaction (inside=1) (../Library/MediaItem.cpp:531): sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 02, 2019 22:01:08.507 [0x7f243affd700] ERROR - Exception inside transaction (inside=1) (../Library/Scanner/SectionLocation.cpp:58): sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 02, 2019 22:01:08.507 [0x7f243affd700] ERROR - Exception inside transaction (inside=1) (../Library/LibraryRequestHandler.cpp:3723): sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 02, 2019 22:01:08.507 [0x7f243affd700] ERROR - Soci Exception handled: sqlite3_statement_backend::loadOne: database disk image is malformed
Aug 02, 2019 22:01:08.508 [0x7f2498862700] DEBUG - Completed: [{clientipaddress}:50436] 500 PUT /library/sections/1?name=TV%20Shows&type=show&agent=com.plexapp.agents.thetvdb&scanner=Plex%20Series%20Scanner&language=en&importFromiTunes=&enableAutoPhotoTags=&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20ABCD&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20EFGH&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20IJKL&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20MNOP&location=%2Fmedia%2Fmultimedia%2FTV%20Series%20QRST (24 live) TLS GZIP 82ms 484 bytes (pipelined: 11)

I’ve had a 15 minute look around for sqlite3 commands to repair the database, but there seems to be hundreds of questions in the forum, with nearly as many varying degrees of success and command structure. Is there a real support document advising what to do?

I have tried the Plex > Troubleshooting > Optimize Database.

Thank you again for your assistance, it’s greatly appreciated.

https://support.plex.tv/articles/201100678-repair-a-corrupt-database/

Thank you heaps ChuckPA, I’ve finally managed to get it working. The problem I was having with the database repair I was logged in as root. So the steps documented made the new database with root:root ownership. So I couldn’t restart the service after the steps. I finally noticed the Database corruption: sqlite3_statement_backend::loadOne: attempt to write a readonly database and worked out my error.
So a quick chown plex:plex com.plexapp.plugins.library.db and I was back up and running.
Might be something that needs to be added to the linux document for those noob’s, or 15+ years linux experts that simply aren’t focused at what their doing :wink:
Thanks again, back to video watching :slight_smile:

I will see what I can do for that. :wink:

Noobs have an excuse.
15+ year veterans get something slapped :rofl:

Hahaha, true dat!

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