Scripted installation of Plex Media Server

You should be running this command inside the jail, not at the TrueNAS shell. iocage console pms, then service plexmediaserver status.

1 Like

Looks like I’m still getting the same error.

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

Looks like the issue is it isn’t installing the pkg and keeps timing out. I’m not sure how to manually download the files or place a “pre-built version”

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:12:amd64/latest, please wait…
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest/Latest/pkg.txz: Operation timed out
A pre-built version of pkg could not be found for your system.
Consider changing PACKAGESITE or installing it from ports: ‘ports-mgmt/pkg’.
root@pms:~ #

That does look like the problem. Do you have network connectivity in the jail? Try ping google.com inside the jail.

What does your plex-config file look like?

1 Like

Okay clearly its the IP I’m using. I was told to use one out side of my DHCP Range, should I just use one within it??

PLEX-CONFIG:

JAIL_IP=“192.168.2.4”
DEFAULT_GW_IP=“192.168.2.1”
POOL_PATH=“/mnt/tank”
PLEX_MEDIA_PATH=“/mnt/tank/media”

root@pms:~ # ping google.com
PING google.com (216.58.193.142): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
google.com ping statistics —
32 packets transmitted, 0 packets received, 100.0% packet loss

It’s good practice to choose an IP outside of the DHCP range, but it does need to be on the same network as your router. Is that (192.168.2.1) the correct IP address for your router?

I use 192.168.1.1 to get into my router but everything else including my server and subnet is 192.168.2.XXX

I’m not sure that makes much sense to me. Do you have a Windows machine on your network? If so, what’s the output of ipconfig on that machine?

1 Like

From what you sent (which isn’t really sensitive, particularly this part):

Default Gateway . . . . . . . . . : fe80::46d9:e7ff:fe9e:1026%20
192.168.2.254

This makes it look like your default gateway is 192.168.2.254, not 192.168.2.1. If that’s the case, I’d suggest editing plex-config accordingly, destroying the jail, and re-running the script.

1 Like

That was it! I should have known that…

You are a legend man, Thank you!

1 Like

I’m having an issue where my plex jail hasn’t updated itself in a very long time. My current Plex version is 1.24.2.4973. But the latest version seems to be 1.27.0.5849. Is it possible to manually initiate the update script? Or maybe check to see if the cron job has stopped?

OK, so I missed this comment from last year. So I ran pk upgrade in the jail shell but I got this error:

Sorry for the screen grab, but I’m using the shell in the FreeNAS web UI and it won’t let me copy and paste properly.

So it looks like DNS is failing inside the jail. Do you have a DNS server configured for your server? It’d be under Network → Global Configuration. If you don’t have one, try entering 1.1.1.1 for Nameserver 1, and 1.0.0.1 for Nameserver 2.

Hey Dan,

So I didn’t have the DNS set. I did as you suggested and performed a reboot. But I’m still getting the same errors.

So when you go into the jail and run pkg upgrade, you’re still getting errors?

Yeah. I did recently update to TrueNAS 12.0. I’m wondering if I should just create a fresh jail and copy over my data from the old jail.

So I created a new jail using TrueNAS 12.3-RELEASE (which was the only option available). But when I ran your script to create the plex server I got the following error:

root@freenas:/mnt/Media/plex_install/freenas-iocage-plex # ./plex-jail.sh
Netmask not set, defaulting to /24 (255.255.255.0)
Plex media path not set, please mount media directory manually when done
Not configuring hardware transcode
Using beta-release plexmediaserver code
Creating jail PlexServer. This may take a minute, please be patient.
12.2-RELEASE was not found!
Failed to create jail

EDIT:

OK two things. First, I had to go into your plex-jail.sh and hardcode the RELEASE variable to use “12.3-RELEASE”. My current installed version is 12.2, which is what your code parsed. But for some reason you can only create new jails with 12.3.

The second thing was that I created the jail manually first. I had forgotten that the script creates it for you. That was my bad. But now everything worked once I took care of those two issues. You might need to create new logic for the jail creation to account for the issue I ran into.

Thanks!

1 Like

Dan -

And for all - this script still works great on Truenas 13 - thank you. Like many others I was on a much older Freenas plugin version that quit working when I upgraded. After poking around some, I bit the bullet and deleted the old plug-in and used your script. It is the bomb. 30 minutes later all back and my kids are smiling across the country.

Regards,
Dean

1 Like

My need is similar to that of the previous poster - I have been running Plex for a few years inside a jail I created using the plugin. I’ve been using PMS_Updater.sh to periodically update the server, and that has been working great. I am a long time computer professional, though virtually none of it has been on Unix/Linux, so I’m more than a bit handicapped in that area. (My background is PDP-11 RSTS/E, RSX-11M, TOPS-20, VAX/VMS, Windows-NT (and derivates), TCP/IP, etc.)

Recently I decided that I should update the jail to 13.1-RELEASE from the 12.1 based version it was running, even though Plex seemed to be running OK. That was probably a big mistake - now I can’t get the plexmediaserver-plexpass to start. It says it starts and I forced a reinstall using ./PMS_Updater.sh -vv -f, but still not working.

At this point I want just build a new jail using your script and I’m sure that will not be very hard. I’ll create a dataset first to hold the metadata and then create the appropriate config files and/or edit the script. (I copied it to my Windows machine and that part looks straightforward).

Whet I need help with is copying all my metadata from inside the current plex jail to the new dataset outside the jail. I’ve done some searches and all the posts I’ve found assume the reader is a Unix guru and just look like some really bizarre foreign language. Can anyone provide some guidance about where I find the metadata and where I copy it to? Thanks!

Hi,

Long time but if you still are around can you tell me how you got it working in 13.1.
Thanks