(Tutorial) How To Install Plex in a FreeNAS 11.2 Jail

anfieldroad

Dabbler
Joined
Dec 21, 2018
Messages
32
You will need to ssh into the jail or use the iocage console command.

In Preferences.xml:

entry should be comma separated ie
allowedNetworks="192.168.0.0/255.255.255.0,10.0.0.0/255.0.0.0"
 

Pheran

Patron
Joined
Jul 14, 2015
Messages
280
Does anyone know if the Plex 1.14.0 plug-in on FreeNAS 11.2U1 has all the necessary bits to allow hardware accelerated transcoding to work? I've been eyeballing that checkbox in the transcoder settings but I haven't tried it out yet.
 

ZiggyGT

Contributor
Joined
Sep 25, 2017
Messages
125
I recently consolidated some appliance level NAS devices to FreeNAS (11.2) as my sole media repository (HP Z400 with 3 x6TB drives. I have a lot of media installed. My Win7 Plex server is messed up after a windows update so I decided to install PLEX on FreeNas. I am using the new user interface because I cannot locate the PLEX plugin on the classic UIF screen. It shows no plugins to install. All the tutorials I found are setup for the classic UIF and I cannot figure out how to get PLEX to see the drive that already exist on FreeNAS that contain the media. On the Jails screen the I see "Activated Pool for Jail Manager; Vol1" which is my start of the tree I have all the media stored on. If I switch back to the classic screen I can locate Vol1 and add it but it does not seem to be persistent. When I go to Plex it cannot see Vol1. Please help me get my Plex media out of jail.

After posting I found this video. Really shows that part I was missing. Stop the server, map the freenas directory to the jail. still having some problems getting so that I only need to map to the top of the directory tree. https://youtu.be/hHCSCVHvMi8
If I try to map /mnt/Vol1 to /mnt/iocage/jails/pelx/root/media I get an error that they are not distinct paths Jail:/sbin/mount -[ nullfs -o rw /mnt/Vol1. I can Create a link from /mnt/Vol1/movies-scifi to /mnt/Vol1/iocage/jails/plex/root/Movies-SciFi. This allows me to get Plex runnin but I need to map each subdirectory on freeNAS spearately. not the easiest.
 
Last edited:

Eric Sweeney

Cadet
Joined
May 29, 2017
Messages
4
okay, I have a strange issue that started several months ago.
i was having an issue with my plexmediaserver on freenas and during the troubleshooting i believe i must have unassociated the server from my account. I could not figure out how to get it back so, as a stop gap, I installed plexmediaserver on my mac and have been running like that for a while. I am now trying to fix this again so that it runs on freenas to free up my mac.

So here is what I see. I launch plexmediaserver on the freenas and i launch the webpage for the freenas version of plex and the page opens, I log in and the only server it finds is the one running on the mac, and my buddies that he shares with me but, it does not see itself and I cannot figure out how to fix the fact that it cant see itself.
 

NAS777

Dabbler
Joined
Feb 15, 2017
Messages
28
How To Install Plex in a FreeNAS 11.2 Jail:

  1. Follow the instructions on how to create a jail, and set the following:
    1. Jail Name: plex
    2. Release: pick the latest
    3. VNET: checked
    4. IPv4 Interface: vnet0
    5. IPv4 Address: select something that is on your network and outside of your DHCP scope (e.g. 192.168.1.x)
    6. IPv4 Netmask: select the subnet mask of your network
      1. This is often 24 (equivalent to 255.255.255.0)
    7. IPv4 Default Router: set this to your router's IP address (e.g. 192.168.1.1)
    8. Auto-start: checked
  2. Once the jail is created, click on "Start" from the jail options menu (if it's not already started)
  3. Click on "Shell" from the jail options menu
  4. Once at a shell prompt, make sure your packages are up to date by running (this will also test that your network settings are correct):
    pkg update
    pkg upgrade
  5. To install Plex, run the following command:
    pkg install multimedia/plexmediaserver
  6. To setup Plex to start automatically when the jail starts, run the following command:
    sysrc plexmediaserver_enable=YES
  7. To start the Plex server, run the following command:
    service plexmediaserver start
  8. Plex is now ready to use and you can navigate to it with this URL (replace 192.168.x.x with the actual IP address assigned earlier):
    http://192.168.x.x:32400/web
  9. Once you tie a Plex account with your server, you will be able to access Plex internally and externally via:
    https://plex.tv/web

Accessing Mounted Storage In Your Jail With Plex:
  1. Follow the documentation to add additional storage in your jail
    1. Since Plex doesn't need to make modifications to your data, it's best to make the mount read-only as an additional protection
  2. After mounting the storage in your jail, it may be tempting to grant your files 777 access to give Plex access to them. Don’t do it though! There is an easy work around by creating groups in the jail with the same GroupID as the ones on the host system, and then adding the "plex" user to that group.
    1. To find out what the GroupID is of the group that is assigned permissions on the mount, run the following command in the jail (assuming you mounted the storage in /mnt in the jail):
      ls -l /mnt
    2. You’ll then see a list of mount points such as this one:
      Code:
      drwxrwx---+ 7 1002 1001 8 Mar 3 18:35 Media
    3. The column with 1002 is the UserID, and 1001 is the GroupID. If you want Plex to have access to the "Media" mount, you need need to create the "Media" (can be named anything) group in the jail with a GroupID of 1001, and add the plex user to that group. This can be done with the following command (replace 1001 with your actual group):
      pw groupadd Media -g 1001 && pw usermod plex -G plex,Media
    4. After running the previous command, you can look at the permissions of the mount again by using:
      ls -l /mnt
    5. You should now see the following instead:
      Code:
      drwxrwx---+  4 root  Media   4 Feb 21  2014 Media
    6. For Plex to have access to the mounts, you must restart Plex with the following command:
      service plexmediaserver restart
    7. You are now done. Plex will now have access to the "Media" mount. These steps can be repeated for other mounts that have different group permissions, but the "pw usermod" command will change slightly to include the additional group.

Upgrading Plex:

  1. Stop the Plex server with the following command:
    service plexmediaserver stop
  2. To update Plex, run the following command:
    pkg update && pkg upgrade multimedia/plexmediaserver
  3. Start Plex again with the following command:
    service plexmediaserver start


Thank you for creating this thread. It really helped me.....until I added storage to the jail and restarted.

Now I get this error

Code:

[root@freenas ~]# jls                                                                                                               
   JID  IP Address      Hostname                      Path                                                                          
     1                  plex                          /mnt/leftside/jails/plex                                                      
[root@freenas ~]# jexec 1 tcsh                                                                                                      
root@plex:/ # service plexmediaserver start                                                                                        
Starting plexmediaserver.                                                                                                          
login class 'daemon' non-existent, using default                                                                                    
su: pam_start: system error                                                                                                        
/usr/local/etc/rc.d/plexmediaserver: WARNING: failed to start plexmediaserver                                                      
root@plex:/ #         



Any ideas what the problem may be? Thanks in advance!
 

Berkyjay

Contributor
Joined
Nov 7, 2015
Messages
100
FreeNAS Version#: 11.2-U3

I just upgraded my Plex jail and now I can't get the service to start. I'm unsure where the logs live in my jail so can someone help me find them? Or at the very least is there a way I can revert to the previous build?
 

Mark Holtz

Contributor
Joined
Feb 3, 2015
Messages
124
FreeNAS Version#: 11.2-U3

I just upgraded my Plex jail and now I can't get the service to start. I'm unsure where the logs live in my jail so can someone help me find them? Or at the very least is there a way I can revert to the previous build?

What's the error when you start the jail? I know I encountered an issue in 11.3-U3 where, because there were spaces in the path (e.g. "Plex Media Server"), the jail refused to initialize. 11.2-U4 resolved the issue.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Why isn't this a sticky?
Because we don't generally make "how-to" threads sticky. Ordinarily they'd be submitted as resources instead.
 

Berkyjay

Contributor
Joined
Nov 7, 2015
Messages
100
What's the error when you start the jail? I know I encountered an issue in 11.3-U3 where, because there were spaces in the path (e.g. "Plex Media Server"), the jail refused to initialize. 11.2-U4 resolved the issue.

The issue is with the latest plex release. From what I can gather they changed the locations of some important files but failed to move those files to the right place in their update scripts. I just went ahead and made a new jail (with an older plex version) and migrated my metadata over.
 
Joined
Jun 17, 2019
Messages
1
How To Install Plex in a FreeNAS 11.2 Jail:

  1. Follow the instructions on how to create a jail, and set the following:
    1. Jail Name: plex
    2. Release: pick the latest
    3. VNET: checked
    4. IPv4 Interface: vnet0
    5. IPv4 Address: select something that is on your network and outside of your DHCP scope (e.g. 192.168.1.x)
    6. IPv4 Netmask: select the subnet mask of your network
      1. This is often 24 (equivalent to 255.255.255.0)
    7. IPv4 Default Router: set this to your router's IP address (e.g. 192.168.1.1)
    8. Auto-start: checked
  2. Once the jail is created, click on "Start" from the jail options menu (if it's not already started)
  3. Click on "Shell" from the jail options menu
  4. Once at a shell prompt, make sure your packages are up to date by running (this will also test that your network settings are correct):
    pkg update
    pkg upgrade
  5. To install Plex, run the following command:
    pkg install multimedia/plexmediaserver
  6. To setup Plex to start automatically when the jail starts, run the following command:
    sysrc plexmediaserver_enable=YES
  7. To start the Plex server, run the following command:
    service plexmediaserver start
  8. Plex is now ready to use and you can navigate to it with this URL (replace 192.168.x.x with the actual IP address assigned earlier):
    http://192.168.x.x:32400/web
  9. Once you tie a Plex account with your server, you will be able to access Plex internally and externally via:
    https://plex.tv/web

Accessing Mounted Storage In Your Jail With Plex:
  1. Follow the documentation to add additional storage in your jail
    1. Since Plex doesn't need to make modifications to your data, it's best to make the mount read-only as an additional protection
  2. After mounting the storage in your jail, it may be tempting to grant your files 777 access to give Plex access to them. Don’t do it though! There is an easy work around by creating groups in the jail with the same GroupID as the ones on the host system, and then adding the "plex" user to that group.
    1. To find out what the GroupID is of the group that is assigned permissions on the mount, run the following command in the jail (assuming you mounted the storage in /mnt in the jail):
      ls -l /mnt
    2. You’ll then see a list of mount points such as this one:
      Code:
      drwxrwx---+ 7 1002 1001 8 Mar 3 18:35 Media
    3. The column with 1002 is the UserID, and 1001 is the GroupID. If you want Plex to have access to the "Media" mount, you need need to create the "Media" (can be named anything) group in the jail with a GroupID of 1001, and add the plex user to that group. This can be done with the following command (replace 1001 with your actual group):
      pw groupadd Media -g 1001 && pw usermod plex -G plex,Media
    4. After running the previous command, you can look at the permissions of the mount again by using:
      ls -l /mnt
    5. You should now see the following instead:
      Code:
      drwxrwx---+  4 root  Media   4 Feb 21  2014 Media
    6. For Plex to have access to the mounts, you must restart Plex with the following command:
      service plexmediaserver restart
    7. You are now done. Plex will now have access to the "Media" mount. These steps can be repeated for other mounts that have different group permissions, but the "pw usermod" command will change slightly to include the additional group.

Upgrading Plex:

  1. Stop the Plex server with the following command:
    service plexmediaserver stop
  2. To update Plex, run the following command:
    pkg update && pkg upgrade multimedia/plexmediaserver
  3. Start Plex again with the following command:
    service plexmediaserver start

Hi, tried this on FreeNAS 11.1U7, exact same sequence for creating the jail and installing from PKG command and Plex will not start. The jail is running, I can ping it but the "service plexmediaserver start" command will not start the server. Any ideas?
 

ARAMP1

Dabbler
Joined
Mar 31, 2016
Messages
34
It's only allowing me to install 1.15.2.793_1 whether it's plexpass or not. Once it's installed, it's staying that it's up to date. Any ideas?

I'm using 11.2-U5
 

Attachments

  • PlexPass.jpg
    PlexPass.jpg
    235 KB · Views: 462

rknaub

Explorer
Joined
Jan 31, 2017
Messages
75
Hello, I followed this guide, but used -plexpass or _plexpass here or there to get that version. Unfortunately I am totally dumb if it isn’t a simple plugin jail. I was able to get Plex working with no issues. However, trying to update to the latest version says there is no update. I go into the shell (of the jail) and do a pkg update and a pkg upgrade but it doesn’t find anything new. My other jail (lidarr) did find an update today. The plugin version updated today too without issue, and it’s several versions ahead of the jail version I created with this guide. What should I look for or do, to get the plexpass jail updated?

EDIT: I followed the other guide in the Resources tab, and I am now in business.
 
Last edited:

artmat

Cadet
Joined
Oct 28, 2018
Messages
4
It's only allowing me to install 1.15.2.793_1 whether it's plexpass or not. Once it's installed, it's staying that it's up to date. Any ideas?

I'm using 11.2-U5
Hello have you solved your problem ?
If yes, how did you do.

I have the same with freenas 11.0 U4.

See you
 

ThreeDee

Guru
Joined
Jun 13, 2013
Messages
700
It's only allowing me to install 1.15.2.793_1 whether it's plexpass or not. Once it's installed, it's staying that it's up to date. Any ideas?

I'm using 11.2-U5
your pulling from quarterly (I thinks it quarterly) updated repos with the plugins. You'd have to change to "latest and greatest" repos in the plugin's jail settings to get the latest and greatest repos available for FreeBSD (there are directions buried here somewhere on how to do that if you are interested in modding your jail.. I've done it with mine but forget the steps I did to do so)
 

Ruff.Hi

Patron
Joined
Apr 21, 2015
Messages
271
I followed this ... very useful. I put my mount point(s) in the media directory.

Initially, I got this with part ll ...

root@plex2:/ # ls -l /media
total 2
drwxrwx---+ 3 1000 wheel 3 Oct 12 18:09 Movies-DVD
drwxrwx---+ 3 1000 wheel 3 Oct 12 18:08 TV Shows


... as other people have stated. That is because I set the PlexMedia dataset with a user of 'ruff' (ie FreeNAS created user) and group of 'wheel'. Thus the mount-points took those permissions too (ie 1000 = ruff and wheel = wheel). I went back and changed the dataset permissions to user=ruff and group=ruffgroup and now I have ...

drwxrwx---+ 3 1000 1000 3 Oct 12 18:09 Movies-DVD

... and I could use the 'add Media group' code to change the group to Media (and add plex to that group). Working now :)
 
Last edited:
Top