Scripted installation of Plex Media Server

Dan, thanks for the clarifications.

Jonathan

Sorry Dan, another couple of questions for you. I seem to remember that Plex said to use Ports on FreeBSD to install the server, has this now changed to using pkg? Can’t see anything on the not-so-helpful Plex.tv support page.

As I want to move my old Plex metadata do I copy it to the new metadata location before or after running the script? And do I do it before accessing the 32400/web page?

Jonathan

I don’t remember ever seeing that, and I don’t see any reason to make this recommendation–other than that the port might be slightly more up-to-date.

I’d say before running the script would be best, though I don’t think there’s a strong argument either way.

No problems, I could swear I read it somewhere :), but pkg works just as well.

Will test this out tomorrow, thanks for putting up with my questions.

Jonathan

All working, thanks Dan!

1 Like

I followed the directions, created plex-config:

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

I put the shell script and the plex-config in the same folder and ran the script. It went off and did it’s thing and I went away and did something else for a while. When I came back, there were no errors, but the shell window of the web GUI did not seem to have any indication I had just done something.
I can see that there is a jail called pms with Release = 11.3-RELEASE-p10.
There are two mount points:

Source: /mnt/Pool.1-3TB/plex_data, Destination: /mnt/Pool.1-3TB/iocage/jails/pms/root/config

and

Source: /mnt/Pool.1-3TB/Media, Destination: /mnt/Pool.1-3TB/iocage/jails/pms/root/media

Under Storage, I see my pool structure.


Which looks sort of like I would expect it to (if I knew what to expect).
On my router I can see that the IP address 192.168.1.124 is in use and I can ping it.
When I go to

http://192.168.1.124:32400/web

I get nothing. The script instructions say to log in and configure my media server, but how to do that is left as an exercise to the interested reader.

Bottom line: I can’t tell if plex is running or not.

Suggestions?

Thanks,
–Jeff

Go to the Jails page in the GUI. See if the Plex jail is there (it will be called pms for Plex Media Server), and if it’s running.

Hi Dan, thanks for chiming in here.

Plex appears to be running. I have restarted it to no avail. EDIT drops a comprehensive menu of things I could change if I understood them.

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?