Plex Media Scanner --list does not return anything

@mrobplex said:
@Ajki

Is the Plex Server you are having issues with the Command Line interface returning results in part of a Plex Home?

Don’t think so, I have default .deb installation with default user.
( how can I check if its part of Plex home )

Here is my result
plex@plex ~/scripts $ whoami
plex
plex@plex ~/scripts $ grep plex /etc/passwd
plex:x:1000:1000:Plex,:/home/plex:/bin/bash
plex@plex ~/scripts $ cd /usr/lib/plexmediaserver/
plex@plex /usr/lib/plexmediaserver $ export LD_LIBRARY_PATH=pwd
plex@plex /usr/lib/plexmediaserver $ ./Scanner --list
plex@plex
plex@plex /usr/lib/plexmediaserver $ curl -X GET "http://127.0.0.1:32400/library/sections?X-Plex-Token=
**"
<?xml version="1.0" encoding="UTF-8"?> <MediaContainer size="3" allowSync="0" identifier="com.plexapp.plugins.library" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1481837967" title1="Plex Library"> <Directory allowSync="1" art="/:/resources/movie-fanart.jpg" composite="/library/sections/3/composite/1481900722" filters="1" refreshing="0" thumb="/:/resources/video.png" key="3" type="movie" title=".Read Me" agent="com.plexapp.agents.none" scanner="Plex Video Files Scanner" language="xn" uuid="1e21c14f-806c-43af-8392-50e98d7d0a18" updatedAt="1481900722" createdAt="1481897657"> <Location id="3" path="/storage/media-unionfs/readme" /> </Directory> <Directory allowSync="1" art="/:/resources/movie-fanart.jpg" composite="/library/sections/1/composite/1482707272" filters="1" refreshing="0" thumb="/:/resources/movie.png" key="1" type="movie" title="Movies" agent="com.plexapp.agents.imdb" scanner="Plex Movie Scanner" language="en" uuid="58153197-5672-420d-896b-3885dcc543e4" updatedAt="1482707272" createdAt="1478256649"> <Location id="1" path="/storage/media-unionfs/movies" /> </Directory> <Directory allowSync="1" art="/:/resources/show-fanart.jpg" composite="/library/sections/2/composite/1481794562" filters="1" refreshing="0" thumb="/:/resources/show.png" key="2" type="show" title="TV Shows" agent="com.plexapp.agents.thetvdb" scanner="Plex Series Scanner" language="en" uuid="53c4441b-ebb8-4340-a6f2-b83217f73e10" updatedAt="1481794562" createdAt="1478256681"> <Location id="2" path="/storage/media-unionfs/series" /> </Directory> </MediaContainer>

@ChuckPa

Thanks for your help. I was able to recover from this near disaster and learned a valuable lesson about editing /etc/passwd file in this manor without a backup user with admin privileges.

Meanwhile back at the ranch…

Based on your help, I think @Ajki and myself are having a similar issue in that the Plex Server URL Command interface works but directly interacting on the server with the Plex Scanner Command Line isn’t producing any results (probably an error being swallowed).

Other things that I can gather are similar between @Ajki setup and mine:

  1. Running Ubuntu 16.04 LTS
  2. Both did standard install using the plex.deb package from the website

Differences in our setup:

  1. I am running my service (via override) as non-standard user (mrplex).
  2. @Ajki service is running as the default plex server.

My initial thoughts that the issue was an authentication token issue related to Plex Home has been debunked by you as the Plex Scanner Command Line doesn’t require this. Not sure where to go from here in order to discover what the underlying issue is as I am scared to make modifications again to /etc/passwd.

@ChuckPa Any other ways you can think of to troubleshoot this and track down the underlying issue?

On a side note, I have a second Plex Server running on Ubuntu 14.04 LTS that belongs to the same Plex Home and the Plex Scanner Command Line works perfectly. That installation is running the same version of Plex Server (latest) and also under a non-standard user (mrplex). Do we think this might be an issue related to Ubuntu 16.04?

@mrobplex said:
Do we think this might be an issue related to Ubuntu 16.04?

Iam pretty sure thats the issue as i just installed a temp vps with Ubuntu server 16.04 LTS + default Plex install and nothing else is on the server and cli scanner still does not return the results.

Testing across multiple Linux distributions this morning yielded different results.

The strangest of all: A Ubuntu 16.04 native installation does not work as expected while Docker Plex (which is also a Ubuntu 16.04 user space) works 100% as it should.

This is strong implication there are faulty / mismatched / incompatible (pick any word you like :smiley: ) versions of runtime libraries in circulation.

Two issues have been written up (I thank you all for your input here and have referenced it) and submitted to the dev team for their verification, feedback, and ultimate resolution.

@ChuckPa

Thanks for your hard work and dedication tracking this down! I appreciate you sticking with me until the wee hours of the morning to bring my machine back to life. I have my fingers crossed that the developers will get this resolved relatively soon and looking forward to your followup with the resolution info. Awesome Work!

@Ajki

Thanks for originally bringing to light this issue and your insight in debugging the root cause.

It will be interesting to see the true root cause. Based on what I can determine, boost libraries are different across platform offerings and most notably Windows/Linux/OS X boundaries. I will report back what the devs’ findings are.

Word back from the dev team is:

  1. --tree requires a --section argument.
  2. --list, if not using the default location for your Library on that platform, specify environment variable PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR

Please let me know your results as we’ve (Ninjas and myself) resolved our issues here.

@ChuckPa said:
Word back from the dev team is:

  1. --tree requires a --section argument.
  2. --list, if not using the default location for your Library on that platform, specify environment variable PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR

Please let me know your results as we’ve (Ninjas and myself) resolved our issues here.

So whats the proper command line to do it ?

in whatever command line shell you wish

  1. export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR to the environment
  2. export LD_LIBRARY_PATH to the environment
  3. /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list
  4. /usr/lib/plexmediaserver/Plex\ Media\ Scanner --tree --section n Where n is the section number from the preceding output.

This is result
plex@plex /usr/lib/plexmediaserver $ export LD_LIBRARY_PATH=pwdplex@plex /usr/lib/plexmediaserver $ export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=pwdplex@plex /usr/lib/plexmediaserver $ /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list terminate called after throwing an instance of 'boost::filesystem::filesystem_error' what(): boost::filesystem::create_directory: Not a directory: "/usr/lib/plexmediaserver/Plex Media Server/Logs" ****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /usr/lib/plexmediaserver/Plex Media Server/Crash Reports/1.3.3.3148-b38628e/PLEX MEDIA SCANNER/1c122349-1e9a-4392-655f32dd-1295852e.dmp terminate called recursively ****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /usr/lib/plexmediaserver/Plex Media Server/Crash Reports/1.3.3.3148-b38628e/PLEX MEDIA SCANNER/1c122349-1e9a-4392-655f32dd-1295852e.dmp Aborted

When I change
plex@plex /var/lib/plexmediaserver/Library/Application Support/Plex Media Server $ export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=pwdplex@plex /var/lib/plexmediaserver/Library/Application Support/Plex Media Server $ /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list plex@plex /var/lib/plexmediaserver/Library/Application Support/Plex Media Server $

boost::filesystem::create_directory: Not a directory: "/usr/lib/plexmediaserver/Plex Media Server/Logs"

The tail end of this Plex Media Server/Logs is what is appended to what should be defined by

"${PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR}/Plex Media Server/Logs"

you forgot to point PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR to where your library at.

@ChuckPa

Thanks for staying on top of this and reporting the dev team’s findings!

Specifying PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR was the key.

Here are my results on Ubuntu 16.04:

mrplex@HS:~$ LD_LIBRARY_PATH=/usr/lib/plexmediaserver PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/var/lib/plexmediaserver/Library/Application\ Support /usr/lib/plexmediaserver/Plex\ Media\ Scanner --list
  1: Movies
  2: TV Shows
mrplex@HS:~$

Once again… Thank You!

:thumbs_up: