Plex Media Scanner CRASHED - Permission issue? [See images attached]

Hi, i have been running my script which calls the scanner for a week with no problem.

Now I receive the following crash msg.

 what():  Codecs: Initialize: 'boost::filesystem::create_directory: Permission denied: "/volume1/Plex/Library/Application Support/Plex Media Server/Codecs/7814ac9-1285-linux-ubuntu-x86_64"'

 ****** PLEX MEDIA SCANNER CRASHED, CRASH REPORT WRITTEN: /volume1/Plex/Library/Application Support/Plex Media Server/Crash Reports/1.12.1.4885-1046ba85f/PLEX MEDIA SCANNER/5a83d655-5aa1-29ef-0e9cf7a1-27984d90.dmp

 ./callLibraryScan.sh: line 18: 20907 Aborted  ./Plex\ Media\ Scanner --list

This is what I see
when I call the scanner script (callLibraryScan.sh) from SSH terminal:

and this is the content of my script(callLibraryScan.sh) … Of course when i’m not debugging I replace the --list with --scan --refresh --section $1.

ALSO:

When I try to execute it as root with sudo -i, it also fails with a different error:

MY-NAS-USER@GeoICT-NAS:/volume1/@appstore/Plex Media Server$ sudo -i
Password:
root@GeoICT-NAS:~# cd "/volume1/@appstore/Plex Media Server"
root@GeoICT-NAS:/volume1/@appstore/Plex Media Server# ./Plex\ Media\ Scanner --list
./Plex Media Scanner: error while loading shared libraries: libboost_atomic.so.1.59.0: cannot open shared object file: No such file or directory

Did I F’ something up?

Disclaimer. There was some stupid think i did where i called a rm -rf on files smaller than 100kb in an attempt to clean up some files (I removed this script since). This may or may not have affected the scanner. I don’t know. (yes… i am an idiot, but forgive me because im very new to this).

This could be completely unrelated tho.

Ut Oh!

You’ve been playing as user admin, root, or your username?

Via ssh , you’re admin, not plex. That’s the no-no

Via SSH it asks me which user to log in as a user (I can log in as admin or MyUserName, or even plex)…

You’ve been playing as user admin, root, or your username?
Via ssh , you’re admin, not plex. That’s the no-no

I am not sure what your answer (or question is)?

Sorry for my ignorance. I’m trying to learn, and attempting as much as possible before posting for help here.

Thanks for your response tho.

I was hoping you’d find my humor. I apologize if not.

Synology is very strict on usernames. This is why only admin is allowed to sign in via SSH.

For you to make this work, you need the chain:

ssh -l admin addr.ip.of.syno
--sign in--

sudo sh    # elevate to root
-- password --

# now export the  environment variables needed  
#(I will use defaults here.. yours  will be different if installed on volume2, et)
export PLEX_DIR="/volume1/Plex/Library/Application Suppport"

su plex -s /bin/sh -c "LD_LIBRARY_PATH='/var/packages/Plex Media Server/target' ; PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR='$PLEX_DIR'; /var/packages/Plex\ Media\ Server/target/Plex\ Media\ Scanner " `       # Put your options after 'Scanner'

Bash doesn’t allow passing of certain variables via the environment anymore… We have to front-load it when bash/sh starts… Ugly but works

Regarding what’s happened to your Plex share, as root

cd /volume1/Plex
chown -r plex:users . &

This will churn a while but is in the background. You can leave in the foreground if you wish.
It’s best to do this part with Plex stopped.

Thanks Chuck… ahhaha and no need to apologize. I am grateful you are trying to help me.

I am confused because the script I was using before (that was triggered by admin) was WORKING PERFECTLY.

I set all the Env Vars correctly in the Shell Script (is “Bash” and “Shell Script” the same thing?) as you did in your example in the above comment.

I am only trying to debug through SSH, but I want all the commands to be triggered through these scripts(callLibraryScan.sh)

As you can see in the image, the content of my script is:

#!/bin/sh
PLEX_DIR="/volume1/@appstore/Plex Media Server"
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/volume1/Plex/Library/Application Support"
export LD_LIBRARY_PATH="${PLEX_DIR}"
export PLEX_MEDIA_SERVER_HOME="${PLEX_DIR}"
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
ulimit -s 3000
cd "/volume1/@appstore/Plex Media Server/"
./Plex\ Media\ Scanner --list

When I try to run the command exactly as you have shown i still get “Permission Denied”

Im sorry if i did not understand your answer.

I guess what I want to know is:

  • What has changed now that I am unable to run this (callLibraryScan.sh) which ran with no problem before?

admin can’t invoke su. insufficient privilege (Synology security)

Thank you kindly for all your help.

The script started working independently again. It’s a mystery but I will not look a gift horse in the mouth. Although it’s concerning when something breaks for an unknown reason.

I really appreciate the support and your patience with a novice that doesn’t have a lot of the fundamental knowledge.

Sorry… my mistake, still wont work

If you wish to this in this, from a shell script which then performs su plex -c , I suggest putting the script in as a scheduled task which you can then schedule or manually run at you wish. Scheduled Tasks run as root.