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

shetu

Dabbler
Joined
Mar 20, 2013
Messages
24
Hello,
I can not start plex in jail

Starting plexmediaserver.
su: /bin/csh: Permission denied
/usr/local/etc/rc.d/plexmediaserver: WARNING: failed to start plexmediaserver
 

Dariusz1989

Contributor
Joined
Aug 22, 2017
Messages
185
All I get is this >
1571394099471.png

:- ((((
 
Joined
Jul 2, 2019
Messages
648
Interesting.... I was trying to install Syncthing last nigh (evening of Oct 18) through the GUI and was getting a somewhat similar error in the repository could not be found. I could resolve the the address on the FreeNAS box using dig or nslookup but the installer could not find the server. Same issue?
 

skodik

Cadet
Joined
Oct 17, 2019
Messages
4
Hi all, I am not able to install plex media server on my system. I have all set up but when I am inside my plex jail and
Code:
pkg update
update i get following error: /var/db/pkg wrong user or group ownership (expected 0/0 versus actual 1000/1000). I have already checked all ownerships on my pool an dataset. Do you have any ideas what I've done wrong? Thanks
 

Monkey_Demon

Explorer
Joined
Nov 11, 2016
Messages
85
How To Install Plex in a FreeNAS 11.2 Jail:
.... snip ...
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
... snip ...
I'm still having trouble.

First, I followed the instructions in the 11.2-U6 UG 14.3.3 and added a mount point w/ Source of /mnt/Volume1/Media and Destination of /mnt/iocage/jails/plex/root/mnt. But in the jail, instead of seeing "Media" in the jail's /mnt (as in the example), I see the directories underneath it: Movies, Music, and TV Shows. Also, I thought I had set this up to inherit users & groups, but initially everything belonged to root in group "wheel."

Then I realized the two mount points must be similar. So I deleted the first mount point and created one with Source = /mnt/Volume1 and Destination = /mnt/iocage/jails/plex/root/mnt. This was a little better in that I could now see the Media folder. But although in the FreeNAS shell ls -l /mnt/Volume1 gives:
Code:
drwxrwx---+ 5 media media 7 Oct 23 20:18 Media

in the jail's shell ls -l /mnt looks like:
Code:
drwxrwx---+ 2 root wheel 3 Oct 22 20:43 Media

(I'm suspicious of the timestamp being earlier in the jail than in FreeNAS; the mount point was added after any changes to the dataset.

I thought it would be easy to make the changes with chown media /mnt/* and chgrp media *, but I guess not. In my first attempt I had botched things up, so I used vi to edit /etc/passwd & /etc/group. Now cat /etc/group | grep media yields
Code:
media:*:8675309:plex
which is what I want (I think).

Nonetheless, in the jail issuing ls -l /mnt does not change anything; the result is just as before: Media's owner and group remain root and wheel.

To make matters worse, in the FreeNAS shell issuing ls -l /mnt/Volume1/Media yields:
Code:
-rwxrwx---+ 1 media  media  10244 Oct 25 00:52 .DS_Store
-rwxrwx---+ 1 media  media      0 Oct 24 16:01 .windows
drwxrwx---+ 2 media  media      3 Oct 23 17:57 Movies
drwxrwx---+ 5 media  media      7 Oct 24 15:48 Music
drwxrwx---+ 2 media  media      3 Oct 23 18:00 TV Shows

but in the jail ls -l /mnt/Media only yields:
Code:
total 1-rwxrwx---+ 1 root  wheel  0 Oct 22 20:43 .windows

I suspect this has something to do with root & wheel being Media's owner & group, but plex's are plex & media respectively. Plex therefore lacks permission to look inside Media. If this is correct, then fixing the owner & group issue might solve the problem.

But I've spent the past day & 1/2 on this and have a train to catch tomorrow. I'm hoping to fix this before I leave. Hence, this post asking for your sage advice.
 

shetu

Dabbler
Joined
Mar 20, 2013
Messages
24
I copied files from windows box to freenas. (user root). Every time i need to run chmod 755 /mnt/media at freenas plex plugins folder for update plex media library. How do I copy file to freenas or what type of folder permission need at plex ?
 

David Simpson

Dabbler
Joined
Nov 24, 2015
Messages
26
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

What about plexpass? I tried adding _plexpass to the instructions but it didn't work
 

Amsoil_Jim

Contributor
Joined
Feb 22, 2016
Messages
175
What about plexpass? I tried adding _plexpass to the instructions but it didn't work
it looks like plexpass version is missing from the repo at the moment, I just did a search from my server and only the regular version showed up.
 
Last edited:

Spiceman

Dabbler
Joined
Oct 4, 2017
Messages
24
What about plexpass? I tried adding _plexpass to the instructions but it didn't work
The last Plex Pass package had problems and they pulled it. You can use regular Plex if you have a Plex Pass account. All the features are there.
 

NasKar

Guru
Joined
Jan 8, 2016
Messages
739
I think the problem you are having is the _ should be a dash for the install command only. pkg install plexmediaserver-plexpass
As previously mentioned the plexpass version had some issues recently and it is the beta not stable code. You can install the regular plexmediaserver version and still have all the plexpass features as it's tied to you email address.
 
Top