If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

[Ubuntu Server 17.04] Running PMScanner Commands from CLI Result in Error

eric_graueric_grau Posts: 219Members, Plex Pass Plex Pass

I am running PMS 1.9.6.4401.

I was trying to look to see if from the cli you can run commands and get if there's an active stream. I came along this Article for Plex Media Scanner via Command Line. Sure that's not what I originally intended but I have another use for it.

Anyways, I tried running some of the commands testing it out and it has raised an error:
I tried running:

user@MediaServer:/usr/lib/plexmediaserver$ /usr/lib/plexmediaserver/Plex\ Media\ Scanner -l (to get a list of media?)

and it resulted in the following error:

/usr/lib/plexmediaserver/Plex Media Scanner: error while loading shared libraries: libboost_atomic.so.1.59.0: cannot open shared object file: No such file or directory

I have checked the PMServer/Scanner log file and there has been no addition to it when running the commands.

Is it just a missing file or some other issue?

The latest Headless Ubuntu Server running the latest Plex Pass version. 202TB of storage. Roku, Nexus Player, Nvidia Shield, Windows 10, Android, iPad, PS4, Plex for Kodi.

Best Answer

Answers

  • eric_graueric_grau Posts: 219Members, Plex Pass Plex Pass

    @ChuckPA said:
    1. must be run as user plex
    2. LD_LIBRARY_PATH=/usr/lib/plexmediaserver
    3. PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/var/lib/plexmediaserver/Library/Application Support"

    Perfect, thanks!

    To run it as user plex is su - plex -c "/usr/lib/plexmediaserver/Plex\ Media\ Scanner -l" sufficient? I tried that and it asks for a password. Is there a 'plex' user password?

    The latest Headless Ubuntu Server running the latest Plex Pass version. 202TB of storage. Roku, Nexus Player, Nvidia Shield, Windows 10, Android, iPad, PS4, Plex for Kodi.

  • ChuckPAChuckPA Posts: 17,697Members, Plex Pass, Plex Ninja, Plex Team Member Plex Team Member

    you can't invoke a login (su -) session.

    You must be root and then su plex

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support forums: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility List

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • jasonmicronjasonmicron Posts: 45Members, Plex Pass Plex Pass
    edited November 15

    That implies the plex user needs a valid shell for login. That's a security risk.

    Edit: I just checked and yep, the plex user has a bash shell in /etc/passwd. Is there a technical reason as to why that user account needs a shell? Not asking for a detailed explanation, just a high level reason.

    Edit2: To the OP: You could always change the plex user password, unless @ChuckPA has a reason as to why that would be a Bad Idea(tm).

  • ChuckPAChuckPA Posts: 17,697Members, Plex Pass, Plex Ninja, Plex Team Member Plex Team Member

    @jasonmicron said:
    That implies the plex user needs a valid shell for login. That's a security risk.

    Edit: I just checked and yep, the plex user has a bash shell in /etc/passwd. Is there a technical reason as to why that user account needs a shell? Not asking for a detailed explanation, just a high level reason.

    Edit2: To the OP: You could always change the plex user password, unless @ChuckPA has a reason as to why that would be a Bad Idea(tm).

    Thanks to SELinux and bash enhanced security, it had to be done as it is (look at /lib/systemd/system/plexmediaserver.service). I could not pass all the environment variables I needed (LD_LIBRARY_PATH) and launch directly. This being the premise, you will find there is an invalid (hence impossible to log into) password set by default

    Re the OP:

    Setting a password for debugging purposes is ok.
    When complete, edit /etc/shadow directly and set the password for plex back to x (which is an impossible encrypted password result) for maximum security.

    While launching PMS directly is optimal, it also requires a policy file. Not everyone uses SELinux. As previously stated elsewhere, making it all work on all the different systems is a 'bag of hurt'.

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support forums: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility List

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
  • eric_graueric_grau Posts: 219Members, Plex Pass Plex Pass

    @ChuckPA said:
    you can't invoke a login (su -) session.

    You must be root and then su plex

    Oh okay, thanks!

    @jasonmicron said:
    That implies the plex user needs a valid shell for login. That's a security risk.

    Edit: I just checked and yep, the plex user has a bash shell in /etc/passwd. Is there a technical reason as to why that user account needs a shell? Not asking for a detailed explanation, just a high level reason.

    Edit2: To the OP: You could always change the plex user password, unless @ChuckPA has a reason as to why that would be a Bad Idea(tm).

    Never thought of that.

    @ChuckPA said:

    @jasonmicron said:
    That implies the plex user needs a valid shell for login. That's a security risk.

    Edit: I just checked and yep, the plex user has a bash shell in /etc/passwd. Is there a technical reason as to why that user account needs a shell? Not asking for a detailed explanation, just a high level reason.

    Edit2: To the OP: You could always change the plex user password, unless @ChuckPA has a reason as to why that would be a Bad Idea(tm).

    Thanks to SELinux and bash enhanced security, it had to be done as it is (look at /lib/systemd/system/plexmediaserver.service). I could not pass all the environment variables I needed (LD_LIBRARY_PATH) and launch directly. This being the premise, you will find there is an invalid (hence impossible to log into) password set by default

    Re the OP:

    Setting a password for debugging purposes is ok.
    When complete, edit /etc/shadow directly and set the password for plex back to x (which is an impossible encrypted password result) for maximum security.

    While launching PMS directly is optimal, it also requires a policy file. Not everyone uses SELinux. As previously stated elsewhere, making it all work on all the different systems is a 'bag of hurt'.

    Oh okay, I understand.

    The latest Headless Ubuntu Server running the latest Plex Pass version. 202TB of storage. Roku, Nexus Player, Nvidia Shield, Windows 10, Android, iPad, PS4, Plex for Kodi.

  • EddieAEddieA Posts: 375Members ✭✭✭

    Don't you also need to export FFMPEG_EXTERNAL_LIBS in order to run the Scanner from the command line.

    Cheers.

  • ChuckPAChuckPA Posts: 17,697Members, Plex Pass, Plex Ninja, Plex Team Member Plex Team Member

    You do not.

    Please DISABLE Verbose logging until requested

    Please search before posting

    Primary support forums: Linux, Synology, and QNAP

    Please remember to report back. This benefits others.

    Useful links

     Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

     Handling TV Specials | Handling Movie extras  |  Nas Compatibility List

     Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

     

    Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

    No technical support via PM unless offered

    Please remember to mark the appropriate answer(s) which solved your issue.

     
Sign In or Register to comment.