Plex Media Scanner crashes when running --list

my Plex Media server are crashing when I’m trying to list the folders from my terminal with --list command

I have no idea why…

[hellfire:/usr/lib/plexmediaserver]./Plex\ Media\ Scanner --list



terminate called after throwing an instance of 'soci::soci_error'
  what():  sqlite3_statement_backend::prepare: no such column: library_sections.content_changed_at for SQL: select library_sections.id as 'library_sections_id', library_sections.library_id as 'library_sections_library_id', library_sections.name as 'library_sections_name', library_sections.name_sort as 'library_sections_name_sort', library_sections.section_type as 'library_sections_section_type', library_sections.language as 'library_sections_language', library_sections.agent as 'library_sections_agent', library_sections.scanner as 'library_sections_scanner', library_sections.user_thumb_url as 'library_sections_user_thumb_url', library_sections.user_art_url as 'library_sections_user_art_url', library_sections.user_theme_music_url as 'library_sections_user_theme_music_url', library_sections.created_at as 'library_sections_created_at', library_sections.updated_at as 'library_sections_updated_at', library_sections.scanned_at as 'library_sections_scanned_at', library_sections.user_fields as 'library_sections_user_fields', library_sections.query_xml as 'library_sections_query_xml', library_sections.query_type as 'library_sections_query_type', library_sections.uuid as 'library_sections_uuid', library_sections.changed_at as 'library_sections_changed_at', library_sections.content_changed_at as 'library_sections_content_changed_at' from library_sections
****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /home/hellfire/Library/Application Support/Plex Media Server/Crash Reports/1.22.3.4523-daae39438/PLEX MEDIA SCANNER/2846483-7fa8-f624-391fc8e-232487a.dmp
Aborted
[hellfire:/usr/lib/plexmediaserver]Error in command line:the argument for option '--serverUuid' should follow immediately after the equal sign
Crash Uploader options (all are required):
  --directory arg       Directory to scan for crash reports
  --serverUuid arg      UUID of the server that crashed
  --userId arg          User that owns this product
  --platform arg        Platform string
  --platformVersion arg Platform version string
  --vendor arg          Vendor string
  --device arg          Device string
  --model arg           Device model string
  --sentryUrl arg       Sentry URL to upload to
  --sentryKey arg       Sentry Key for the project
  --version arg         Version of the product
  --allowRetries arg    Whether we will allow retries
[hellfire:/usr/lib/plexmediaserver]

Server Version#: 1.22.3.4523
Linux Version#:Ubuntu 18.04.5 LTs

Does the user you are running Plex Media Scanner as have permission to read the database? It may be easier to run it as the ~plex user.

Have you set the environment variables Plex needs?

Something like this may work:

sudo -u plex LD_LIBRARY_PATH=/usr/lib/plexmediaserver /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list

i have not set the environment variables, don’t know how to add them so they will stick.

I can also see that the files are root:root
going into su is triggering the same result.

The server is otherwise running and working without any issues

running with your command didn’t do anything, changing the -u Plex to -u root, did start the scanner, but with the same error code…

I don’t actually have an Ubuntu instance in front of me; my suggestions were based on some common guesses that might apply. :slight_smile:

Did you install Plex from a package? I believe the Plex package for Ubuntu would typically run as a ~plex user, which would also typically own the files.

Can you share a bit more about your system, such as the path to the DB files owned by root:root?

soci:: errors are usually in local/locale environment.

  1. You cannot run the scanner as root if Plex runs as another user. It will break the existing installation.
  2. Environment variables must be set, including LANG, LC_ALL. Locale must be valid.
  3. Look at the environment variables defined in the services file definition as a guideline.

well, Plex is everywhere…
I scanned for the Preference.xml file and found them here:

/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml
/home/hellfire/Preferences.xml
/home/hellfire/Library/Application Support/Plex Media Server/Preferences.xml

the path $PLEX_HOME/Library/Application Support/Plex Media Server/ don’t exist,I guess that $PLEX_HOME isn’t set, the installer probably never set it, and I have no idea how…

the Plex server has been running for at least 2 years without any issues, I have however never before tried to execute any terminal commands before…

if I’m not mistaken, upon the first installation it was installed on plex:plex, but nowadays the updates are runned by Webmin.

The installer sets all the environment variables.
All the required varibles are contained in /lib/systemd/system/plexmediaserver.service with exception of $HOME. $HOME provided by /etc/passwd.

Dont know what you have there but WOW.

Default installation configuration:

  1. HOME=/var/lib/plexmediiaserver (from /etc/passwd)
  2. PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/var/lib/plexmediaserver/Library/Application Support"
  3. PLEX_MEDIA_SERVER_HOME=/usr/lib/plexmediaserver
  4. PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
  5. LC_ALL=en_US.UTF-8
  6. LANG=en_US.UTF-8
  7. User=plex
  8. Group=plex

Default configuation may be overridden by /etc/systemd/system/plexmediaserver.service.d/override.conf

That’s correct, that’s what my system says, but your guides points to $PLEX_HOME/Library/Application Support/Plex Media Server/ and $PLEX_HOME don’t exist…

but my issue might be because the Plex installation is own by root, not plex.
do I have to reinstall everything or is there anyway to reset the owner? and what do I need to reset?

You mean this?

$PLEX_HOME/Library/Application Support/Plex Media Server/Logs/PMS Plugin Logs/

That’s not a literal variable.

  1. Desktop Linux : /var/lib/plexmediaserver
  2. Docker: /config
  3. QNAP: /share/CACHEDEV1_DATA/.qpkg/PlexMediaServer
  4. Synology - DSM 6, /volume1/Plex
  5. Synology - DSM 7, /var/package/PlexMediaServer/home

Ref:

… amongst other… I always thought $PLEX_HOME was a variable, but that’s not the main issue that I’m having now, now it’s about the crashing media scanner…

I’m pretty sure Webmin doesn’t repackage Plex, and that the normal Ubuntu install details - of which Chuck is the expert - are still correct.


I think there are files in multiple locations because Plex has been started as a different user, without the environment set up.

Can you share the output of ls -la "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/" and ls -la "/usr/lib/plexmediaserver/"


Let’s change directions slightly. What’s your end goal? What do you want to accomplish from the CLI? Sometimes there are easier/better ways to interact with Plex.

I was simply trying to list the folders, so I can see the numbers, and then trigger an update of a specific folder.

here’s the other result:

[hellfire:~]ls -la "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/"
total 52
drwxr-xr-x 11 plex plex 4096 May 15 21:30  .
drwxr-xr-x  3 plex plex 4096 Dec 14 20:04  ..
drwxr-xr-x  6 plex plex 4096 May 16 17:05  Cache
drwxr-xr-x  4 plex plex 4096 Apr 29 16:25  Codecs
drwxr-xr-x  7 plex plex 4096 May 15 21:29 'Crash Reports'
drwxr-xr-x  2 plex plex 4096 Dec 31 02:02  Diagnostics
drwxr-xr-x  3 plex plex 4096 May 16 17:05  Logs
drwxr-xr-x  3 plex plex 4096 Dec 15 03:43  Media
drwxr-xr-x  4 plex plex 4096 Dec 24 22:35  Metadata
-rw-r--r--  1 plex plex    4 May 15 21:29  plexmediaserver.pid
drwxr-xr-x  3 plex plex 4096 Dec 14 20:08  Plug-ins
drwxr-xr-x  7 plex plex 4096 Dec 14 20:04 'Plug-in Support'
-rw-r--r--  1 plex plex 1279 May 15 21:30  Preferences.xml
[hellfire:~]ls -la "/usr/lib/plexmediaserver/"
total 57108
drwxr-xr-x  5  107 incron     4096 May 15 21:29  .
drwxr-xr-x 68 root root       4096 May 15 21:29  ..
drwxr-xr-x  2 root root       4096 Apr  5 21:19 "'."
-rwxr-xr-x  1 root root    1599960 May 12 06:17  CrashUploader
-rwxr-xr-x  1  107 incron  6553672 Jan 29  2020  hms
-rw-rw-r--  1  107 incron      205 Feb 26  2020  kk
drwxr-xr-x  3 root root      12288 May 15 21:29  lib
-rwxr-xr-x  1 root root     408520 May 12 05:59 'Plex Commercial Skipper'
-rwxr-xr-x  1 root root    4505352 May 12 06:14 'Plex DLNA Server'
-rwxr-xr-x  1 root root     138072 May 12 05:59 'Plex Media Fingerprinter'
-rwxr-xr-x  1 root root    7684728 May 12 06:17 'Plex Media Scanner'
-rwxr-xr-x  1 root root   25292128 May 12 06:18 'Plex Media Server'
-rwxr-xr-x  1 root root     746768 May 12 05:59 'Plex Relay'-rwxr-xr-x  1 root root      12576 May 12 05:59 'Plex Script Host'
-rwxr-xr-x  1 root root     271440 May 12 05:59 'Plex Transcoder'
-rwxr-xr-x  1 root root    4679632 May 12 05:59 'Plex Tuner Service'
-rwxr-xr-x  1  107 incron  6517048 Feb 19  2020  pms
drwxr-xr-x 10  107 incron    12288 May 15 21:29  Resources

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