Scripted installation of Plex Media Server

I scanned that Ip address and 32400 is not open, nor are any of the other Plex ports. I can ping it though.

Everything I read indicates it should “just work” but there is something crucial I am missing here.

Bump?
I there a guide on how to back out what I have done and re-do or follow another way of getting Plex working?

I apologize; I apparently let this slip through the cracks. So the Plex jail is running, but it kind of looks like Plex itself isn’t running. Let’s test that. From the FreeNAS shell, run iocage console pms, and once that loads, service plexmediaserver status. If it says it is not running, try starting it with service plexmediaserver start.

1 Like

No apology necessary. I appreciate the help. So, hmmm…

root@pms:~ # service plexmediaserver status
plexmediaserver does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

I knew this command was doomed to failure, but I couldn’t help myself.

root@pms:~ # service plexmediaserver start
plexmediaserver does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

So I went looking and indeed plexmediaserver does not exist in /etc/rc.d or /usr/local/etc/rc.d – it’s not a matter of executability, it’t not there. Maybe I should delete the jail (how?) and start over.
Other suggestions welcome. Thanks!

That does suggest something’s gone very badly wrong with the script. Just for kicks, what happens if you run (in the jail) pkg install plexmediaserver?

This is copy/paste overkill but the output is instructive:

root@pms:~ # pkg install plexmediaserver
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest, please wait…
Verifying signature with trusted certificate pkg.freebsd.org.2013102301… done
[pms] Installing pkg-1.14.6…
[pms] Extracting pkg-1.14.6: 100%
Updating FreeBSD repository catalogue…
[pms] Fetching meta.conf: 100% 163 B 0.2kB/s 00:01
[pms] Fetching packagesite.txz: 100% 6 MiB 627.5kB/s 00:10
[pms] Extracting pkg-1.14.6: 100%
Updating FreeBSD repository catalogue…
[pms] Fetching meta.conf: 100% 163 B 0.2kB/s 00:01
[pms] Fetching packagesite.txz: 100% 6 MiB 627.5kB/s 00:10
Processing entries: 100%
FreeBSD repository update completed. 30836 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
plexmediaserver: 1.19.4.2935
Number of packages to be installed: 1
The process will require 367 MiB more space.
96 MiB to be downloaded.
Proceed with this action? [y/N]: y
[pms] [1/1] Fetching plexmediaserver-1.19.4.2935.txz: 100% 96 MiB 685.4kB/s 02:27
Checking integrity… done (0 conflicting)
[pms] [1/1] Installing plexmediaserver-1.19.4.2935…
===> Creating groups.
Creating group ‘plex’ with gid ‘972’.
===> Creating users
Creating user ‘plex’ with uid ‘972’.
[pms] [1/1] Extracting plexmediaserver-1.19.4.2935: 100%
=====
Message from plexmediaserver-1.19.4.2935:

multimedia/plexmediaserver includes an RC script:
/usr/local/etc/rc.d/plexmediaserver
TO START PLEXMEDIASERVER ON BOOT:
sysrc plexmediaserver_enable=YES
START MANUALLY:
service plexmediaserver start
Once started, visit the following to configure:
http://localhost:32400/web
@@@ INTEL GPU OFFLOAD NOTES @@@
If you have a supported Intel GPU, you can leverage hardware
accelerated encoding/decoding in Plex Media Server on FreeBSD 12.0+.
The requirements are as follows:
* Install multimedia/drm-kmod: e.g., pkg install drm-fbsd12.0-kmod
* Enable loading of kernel module on boot: sysrc kld_list+=“i915kms”
** If Plex will run in a jail, you must load the module outside the jail!
* Load the kernel module now (although reboot is advised): kldload i915kms
* Add plex user to the video group: pw groupmod -n video -m plex
* For jails, make a devfs ruleset to expose /dev/dri/* devices.
e.g., /dev/devfs.rules on the host:
[plex_drm=10]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_jail
add path ‘dri*’ unhide
add path ‘dri/’ unhide
add path 'drm
’ unhide
add path ‘drm/*’ unhide
* Enable the devfs ruleset for your jail. e.g., devfs_ruleset=10 in your
/etc/jail.conf or for iocage, iocage set devfs_ruleset=“10”
Please refer to documentation for all other FreeBSD jail management utilities.
* Make sure hardware transcoding is enabled in the server settings
@@@ INTEL GPU OFFLOAD NOTES @@@
root@pms:~ #

Well that looks better. Now I try and start plex:

root@pms:~ # service plexmediaserver start
Cannot ‘start’ plexmediaserver. Set plexmediaserver_enable to YES in /etc/rc.conf or use ‘onestart’ instead of ‘start’.
root@pms:~ # service plexmediaserver onestart
Starting plexmediaserver.
root@pms:~ # service plexmediaserver status
Cannot ‘status’ plexmediaserver. Set plexmediaserver_enable to YES in /etc/rc.conf or use ‘onestatus’ instead of ‘status’.
root@pms:~ # service plexmediaserver onestatus
plexmediaserver is not running.
root@pms:~ #

I am not yet out of the woods and into the Movies yet. I will spend some time tinkering later today.

Thanks.

That’s… odd. The script should have set plexmediaserver_enable=YES too. Obviously there are a number of things that should have happened, that didn’t. At this point, I’d say destroy the jail, and run the script again. Post the output here and let’s see if we can spot what went wrong.

Jail is deleted, repo cloned, config created. Do I need to clean this stuff up before I run the script again?

JAIL_IP=“192.168.1.124”
DEFAULT_GW_IP=“192.168.1.1”
POOL_PATH="/mnt/Pool.1-3TB"
PLEX_MEDIA_PATH="/mnt/Pool.1-3TB/Media"

No, all that can stay.

This just keeps getting stranger. The script runs, the jail is created and I am asked

root@cervinia[~/gitplex]# ./plex-jail.sh
Netmask not set, defaulting to /24 (255.255.255.0)
Plex metadata path not set, defaulting to /mnt/Pool.1-3TB/plex_data
Plex media path is /mnt/Pool.1-3TB/Media, the script will mount this into /media inside the Plex jail
Not configuring hardware transcode
Using stable-release plexmediaserver code
Creating jail pms. This may take a minute, please be patient.
pms successfully created!
No default gateway found for ipv6.
* Starting pms
+ Started OK
+ Using devfs_ruleset: 5
+ Configuring VNET OK
+ Using IP options: vnet
+ Starting services OK
+ Executing poststart OK
Successfully added mount to pms’s fstab
Source: /root/gitplex/configs does not exist!
Successfully added mount to pms’s fstab
cp: /configs/pkg.conf: No such file or directory
Command: cp /configs/pkg.conf /usr/local/etc failed!
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest, please wait…
Verifying signature with trusted certificate pkg.freebsd.org.2013102301… done
[pms] Installing pkg-1.14.6…
[pms] Extracting pkg-1.14.6: 100%
Updating FreeBSD repository catalogue…
[pms] Fetching meta.conf: 100% 163 B 0.2kB/s 00:01
[pms] Fetching packagesite.txz: 100% 6 MiB 1.3MB/s 00:05
Processing entries: 11%packet_write_wait: Connection to 192.168.1.93 port 22: Broken pipe
Firenze:~ jm$

I am ssh’d in from an iMac (Firenze) and get dropped out. I haven’t the foggiest notion why the connection to 192.168.1.93 is a problem because there is nothing with that IP address on my network. FreeNAS is .1.97, and I can ping the jail IP.
I have stopped and deleted the jail three times and re-run the script. It stops at a different place in the script each time, but always with the same error.
So I got out a keyboard and monitor, ran the script again and with the exception of these lines (possibly more, they scrolled up) it succeeded:

sed: /root/gitplex/configs/update_packages: No such file or directory
crontab: /configs/update_packages: no such file or directory
Command: crontab /configs/update_packages failed!
No matching fstab entry

If you have any closing comments on the crontab messages, I am all ears.

Plex is up and running it would appear, now I need to figure out what to do with it.

Thanks!

Excellent. I’ll need to look further into the update_packages question.

Does this script support Plex Pass installation?

Also, is it possible to put in multiple PLEX_MEDIA_PATH entries?

The “Plex Pass” version of the server software is beta software. If you want to install that, use the USE_BETA flag, as described in the README.

Not with the script. You’d need to add the additional mountpoints to the jail after the script finishes.

1 Like

Hey I’m trying to set the PLEX_CONFIG_PATH to take advantage of a dataset. But when I run the script it ends up pointing to the iocage location:

/mnt/Media/iocage/jails/PlexPass/root/config

Here is my plex-config file:

JAIL_IP="192.168.1.40"
DEFAULT_GW_IP="192.168.1.1"
POOL_PATH="/mnt/Media"
PLEX_CONFIG_PATH="/mnt/Media/Storage/Plex/plex_data"
JAIL_NAME="PlexPass"
USE_BETA="1"

What am I doing wrong here?

I’m not quite sure I understand what’s going on. From your FreeNAS box, what’s the output of iocage fstab -l PlexPass?

Here ya go:

+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| INDEX |                                                                    FSTAB ENTRY                                                                    |
+=======+===================================================================================================================================================+
| 0     | /mnt/Media/iocage/releases/11.3-RELEASE/root/bin        /mnt/Media/iocage/jails/PlexPass/root/bin       nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 1     | /mnt/Media/iocage/releases/11.3-RELEASE/root/boot       /mnt/Media/iocage/jails/PlexPass/root/boot      nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 2     | /mnt/Media/iocage/releases/11.3-RELEASE/root/lib        /mnt/Media/iocage/jails/PlexPass/root/lib       nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 3     | /mnt/Media/iocage/releases/11.3-RELEASE/root/libexec    /mnt/Media/iocage/jails/PlexPass/root/libexec   nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 4     | /mnt/Media/iocage/releases/11.3-RELEASE/root/rescue     /mnt/Media/iocage/jails/PlexPass/root/rescue    nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 5     | /mnt/Media/iocage/releases/11.3-RELEASE/root/sbin       /mnt/Media/iocage/jails/PlexPass/root/sbin      nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 6     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/bin    /mnt/Media/iocage/jails/PlexPass/root/usr/bin   nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 7     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/include        /mnt/Media/iocage/jails/PlexPass/root/usr/include       nullfs  ro      0       0 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 8     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/lib    /mnt/Media/iocage/jails/PlexPass/root/usr/lib   nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 9     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/libexec        /mnt/Media/iocage/jails/PlexPass/root/usr/libexec       nullfs  ro      0       0 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 10    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/sbin   /mnt/Media/iocage/jails/PlexPass/root/usr/sbin  nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 11    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/share  /mnt/Media/iocage/jails/PlexPass/root/usr/share nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 12    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/libdata        /mnt/Media/iocage/jails/PlexPass/root/usr/libdata       nullfs  ro      0       0 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 13    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/lib32  /mnt/Media/iocage/jails/PlexPass/root/usr/lib32 nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 14    | /mnt/Media/Storage/Plex /mnt/Media/iocage/jails/PlexPass/root/config    nullfs  rw      0       0                                                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+

This all looks as it should. What exactly is the problem?

Isn’t the plex_data directory supposed to go into the specified directory in the config file? Right now it’s putting it into the iocage/jail directory like a default Plex install.

So I just decided to try setting the POOL_PATH instead rather than trying to use the CONFIG_PATH.

POOL_PATH="/mnt/Media/Storage/Plex"

Seems like that worked. Hopefully it will help resolve me separate issue of not being able to migrate my old data over to the new jail.

UPDATE:

And it worked!!! Everything migrated just fine. :smiley:

Hey quick question. How is updating handled with the jail created by your script? Does the jail update button in the FreeNAS work or does it have to be handled via command prompt?