Core Component Problems on FreeNAS jail install

Server Version#: 1.18.9.2578-513b381af
Player Version#: N/A (Server issue)
FreeBSD Version#: 11.3-RELEASE-p7
FreeNAS Version#: 11.3-U2.1

Hi there,

I’ve been trying to setup a Plex Media Server in a FreeNAS jail running FreeBSD 11.3 for the past few days. I’m trying to migrate my media from a previous Plex install on macOS, but I’m having a couple problems.

One problem is that the loading icon that shows up when you first setup a server stays there for a couple minutes, before showing this screen:

I’m able to click the menu items at the top, but when importing things to the Media library I have a problem whose symptoms are the same as this thread. I can’t seem to find a way to implement the fix since OP was running Windows. I am running a reverse proxy on a separate jail, but I haven’t put this Plex jail behind it yet. I’ve forwarded 32400 to the IP address I’ve given to the jail.

I went on the FreeNAS forums last night to get some help and changed the file permissions of the media to 0755 and gave ownership to user plex with uid 972 and group media

I’ve done many clean installs of Plex trying the plugin given by FreeNAS, installing manually from pkg, and using danb35’s automated script.

One of the suspicions we had last night on the FreeNAS forums was that it could be a plugin issue, since com.plexapp.system keeps getting killed and restarted because reading from configuration is timing out. However, I’m also having the same log messages when trying to save my library imports as the above thread.

Attached are my logs.

Thanks for any help!

[Logs.zip|attachment](upload://qJutSXyk2uTGebJmLEpUXJPPDWu.zip) (129.9 KB)

Edit: It seems that the upload button isn’t attaching my zip full of logs; the errors are the same as linked thread. I was able to attach the zip to my FreeNAS post, which can be found here

Yeah the error it self suggests that something went wrong with the python scripts, likely the system bundle.

Can you upload pms logs?

Also are you right now using pkg or some install/update script?

Oh nvm I missed the link to the logs when I was first reading on mobile, sorry.

I will take a peak in a bit.

For the most recent install I used pkg and the config is in /usr/local/plexdata inside the jail (not mounted using a dataset from the zfs pool)

The logs are from a previous install, but the errors are the same. If needed I can pull the logs from the most recent install

Hey, were you able to take a look at the logs?

Not until today sorry, can do an ls on theses dirs:

ls -l /usr/local/share/plexmediaserver/Resources
ls -l /usr/local/plexdata/Plex\ Media\ Server

In the first there should only be one plugins dir if not Its easy to fix, on the other do you actually have a plugins dir there? And if so can you then ls that one dir?

There is one plugins dir in /usr/local/share/plexmediaserver/Resources, with -513b381af appended at the end of the directory name. (So the full path is /usr/local/share/plexmediaserver/Resources/Plug-ins-513b381af)

I created a plugins dir in /usr/local/plexdata/Plex\ Media\ Server while looking for what could’ve caused problems. It wasn’t there before and is currently empty

Also, the broken plex is hogging a lot of resources while it’s running, to the point where it takes a couple minutes to just connect to the machine thru ssh and basically makes the FreeNAS web control unusable, if that helps with any diagnosis.

That is the expected case for the install dir, it should only have on and with should have an hash in the name so that’s fine.

You don’t need the Plugins dir on the other one for sure the log does complain about being unable to access it which could be because it was created with bad permissions but that’s unlikely.

Lets try this:

  • Remove the dir you created.
  • Stop PMS
  • pkg remove plexmediaserver
  • rm -rf /usr/local/share/plexmediaserver (don’t worry this is just the install dir no user data is saved here).
  • chown -R plex /usr/local/plexdata/
  • install plexmediaserver again and restart the service

No luck, I still arrive at the same page.

Also, I can confirm that it’s indeed the plexmediaserver service causing the lack of resources, since as soon as I stopped it the CPU usage shown on the FreeNAS cp went from 100% to 3%. Again, I’m not sure if that helps with anything but it’s a bit weird, especially since it worked perfectly fine on macOS.

Attached are the most recent logs
Archive.zip (9.8 KB)

This is comment is mostly for if someone else has this problem;

I have a pi-hole running and thought it could be blocking domain resolutions to Plex, so I changed the nameservers on the jail just to 1.1.1.1. For my setup with pi-hole looping back to a unbound server on the raspberry pi, it didn’t help and I still arrive at the same page.

@nnhien the resource usage is for sure suspicious, but I run on BSD my self (not FreeNAS) and doesn’t see this, my jail is on 12.0 though, but there’s also no other reports of this on 11.3.

Can you update to 1.19.1 first since that seems to be available on bsd now and let me know if it just magically fixes it (there’s not expected fix on the changelog for that) but there some changes in curl/openssl libs that I’m just hoping maybe help ( its a long shot for sure).

If with 1.19.1 it still happens than we will need to dig deeper.

Still broken

I think I assumed incorrectly that plex was hogging resources though. I checked the larger history of resource usage and it’s actually pretty ok. It was probably just a coincidence for the times that I looked at the resource usage it went from 100% to 0% right after I turned off the service.

Good to know we don’t have a bug there :sweat_smile:

Now back to you’re issues lets try to start PMS manually. There’s a start.sh script along side the binaries but it will default to the standard application_support_data_path.

Edit the start.sh script and use this:

#!/bin/sh

# Set identification variables for FreeNAS; with fallback to FreeBSD
if [ -f "/etc/version" ]; then
  export PLEX_MEDIA_SERVER_INFO_VENDOR="$(cat /etc/version|cut -d- -f1)"
  export PLEX_MEDIA_SERVER_INFO_DEVICE=NAS
  export PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"
  export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$(cat /etc/version|cut -d- -f2-)"
else
  export PLEX_MEDIA_SERVER_INFO_VENDOR=FreeBSD
  export PLEX_MEDIA_SERVER_INFO_DEVICE=PC
  export PLEX_MEDIA_SERVER_INFO_MODEL="$(uname -m)"
  export PLEX_MEDIA_SERVER_INFO_PLATFORM_VERSION="$(uname -r)"
fi

export plexmediaserver_support_path="/usr/local/plexdata/"
export SUPPORT_PATH="${plexmediaserver_support_path}"
export HOME="${plexmediaserver_support_path}/Plex Media Server"
SCRIPT=$(readlink -f $0)
SCRIPTPATH=$(dirname ${SCRIPT})
export LD_LIBRARY_PATH="${SCRIPTPATH}/lib"
export PLEX_MEDIA_SERVER_HOME="${SCRIPTPATH}"
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS=6
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export PYTHONHOME="${SCRIPTPATH}/Resources/Python"
export PATH="${SCRIPTPATH}/Resources/Python/bin:${PATH}"
ulimit -s 3000
./Plex\ Media\ Server

Alternatively just make sure to add this lines before SCRIPT=$(readlink -f $0)

export plexmediaserver_support_path="/usr/local/plexdata/"
export SUPPORT_PATH="${plexmediaserver_support_path}"
export HOME="${plexmediaserver_support_path}/Plex Media Server"

1- Stop PMS
2- cd /usr/local/share/plexmediaserver
3. chmod +x start.sh
4. ./start.sh

Hm, I’m experiencing the resource hogging again. I tried starting it manually like you said and I still reach the same page.

Edit: It seems like it starts out with reasonable resource usage, but then as time goes on it slowly starts spawning sh instances that I can see in top which causes the resource bottleneck

Edit 2: Aha, I found where the resource hogging starts; when the core component problem page gets pushed, at least 4 instances of sh are spawned, and the CPU is maxed out. Also, when the “please wait a moment” page shows, an additional sh is spawned, which is probably expected behavior since the CPU isn’t maxed out at that point (it’s just at around 50%)

What is running on those “sh” instances? can you check that with maybe ps auxwww to get full cmd params.

Btw have you tried installing into a new jail and see if this just works?

Here’s the top 7 lines of ps auxwww after the core component page appears:

USER   PID %CPU %MEM    VSZ   RSS TT  STAT STARTED    TIME COMMAND
plex  3984 70.4  0.0   7068  2668  -  RJ   02:42   6:10.12 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmp41q3HU -luuid
plex  4058 69.6  0.0   2972  2480  -  RJ   02:45   3:10.42 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpp8iXmg -luuid
plex  4107 58.3  0.0   2972  2508  -  RJ   02:48   0:11.62 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpI8MQUH -luuid
plex  4113 57.5  0.0    440   352  -  RJ   02:48   0:11.48 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpxX0O5O -luuid
plex  4112 56.3  0.0   7068  2588  -  RJ   02:48   0:11.26 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmp5Ixauz -luuid
plex  4111 56.0  0.0   7068  2668  -  RJ   02:48   0:11.31 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmp4GoUKC -luuid

I remember trying to install something on a different jail and json wouldn’t compile; maybe this is ultimately a FreeNAS or a FreeBSD problem with cpp.

I’ve also tried installing it on fresh jails and it still wouldn’t work.

This is for sure not something started by PMS!

It might be the plex user for sure but I have no idea what is happening here.

I would suggest creating a new jail and moving “plexdata” over.

Still the same.

Here’s the entire current output of that command:

USER  PID %CPU %MEM    VSZ   RSS TT  STAT STARTED    TIME COMMAND
plex 7917 69.8  0.0    696   536  -  RJ   03:27   0:40.83 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpofqk5x -luuid
plex 7919 69.8  0.0    440   352  -  RJ   03:27   0:40.69 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpSp4Fl0 -luuid
plex 7915 69.4  0.0    712   536  -  RJ   03:27   0:40.20 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpMhejhy -luuid
plex 7788 64.4  0.0   2972  2492  -  RJ   03:21   6:39.34 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpTXAbAx -luuid
plex 7921 63.1  0.0   2972  2524  -  RJ   03:27   0:40.39 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmpAQ8Ysw -luuid
plex 7856 62.7  0.0      0    16  -  RJ   03:24   3:38.52 /bin/sh /usr/bin/c++ -Wl,-t -o /tmp/tmp2E3bxB -luuid
root 7226  0.0  0.0   6420  2460  -  IsJ  03:16   0:00.00 /usr/sbin/syslogd -c -ss
root 7282  0.0  0.0   6460  2340  -  IsJ  03:16   0:00.00 /usr/sbin/cron -J 15 -s
plex 7785  0.0  0.4 133804 69604  -  IsJ  03:21   0:01.82 /usr/local/share/plexmediaserver/Plex_Media_Server (Plex Media Server)
plex 7854  0.0  0.1  27788 20420  -  IJ   03:24   0:00.04 /usr/local/share/plexmediaserver/Plex Tuner Service /usr/local/share/plexmediaserver/Resources/Tuner/Private /usr/local/share/plexmediaserver/Resources/Tuner/Shared 1.19.1.2701-6327e27bf 32600 /waitmutex
plex 7910  0.0  0.2  37128 30416  -  IJ   03:27   0:01.01 Plex Plug-in [com.plexapp.system] /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server-version 1.19.1.2701-6327e27bf /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/System.bundle (Plex Script Host)
plex 7911  0.0  0.2  37128 30416  -  IJ   03:27   0:01.02 Plex Plug-in [com.plexapp.agents.movieposterdb] /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server-version 1.19.1.2701-6327e27bf /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/MoviePosterDB.bundle (Plex Script Host)
plex 7912  0.0  0.2  37128 30416  -  IJ   03:27   0:01.02 Plex Plug-in [org.musicbrainz.agents.music] /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server-version 1.19.1.2701-6327e27bf /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/Musicbrainz.bundle (Plex Script Host)
plex 7913  0.0  0.2  37128 30416  -  IJ   03:27   0:01.02 Plex Plug-in [com.plexapp.agents.localmedia] /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/Framework.bundle/Contents/Resources/Versions/2/Python/bootstrap.py --server-version 1.19.1.2701-6327e27bf /usr/local/share/plexmediaserver/Resources/Plug-ins-6327e27bf/LocalMedia.bundle (Plex Script Host)
root 7756  0.0  0.0   6948  2852  0  IJ   03:21   0:00.01 login [pam] (login)
root 7757  0.0  0.0   7488  3716  0  SJ   03:21   0:00.01 -csh (csh)
root 7932  0.0  0.0   7000  2820  0  R+J  03:28   0:00.00 ps auxwww

Edit: When stopping the service, the pids of the C++ sh instances are enumerated as child processes

This is in a new fresh jail? I really have no idea what could be calling that and if it shipped with PMS I’m sure others would notice :confused:

pgrep -g `cat /var/run/plex/plex.pid`  

does that list those “c++ process” ?

If so the start time is suspicious as it seems to be the same as the Python Processes!