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

TheDubiousDubber

Contributor
Joined
Sep 11, 2014
Messages
193
Never mind. Did some more digging and I think I got it to work by following instructions on a different page of this thread:

In this example the group owner of the mounted storage is media, the ID of this group is 2000, which you can lookup in the accounts of the FreeNAS WebUI
To give plex access to this mount, you have to create the goup media, with id 2000 in the jail and add the plex user to the group. To do this, start by editing /etc/group with this command in the jail shell:
ee /etc/group

Then add this to the bottom of the file (without the line numver and dot):
Code (text):
Code:
media:*:2000:plex

to exit the editor, hit <Esc> and then in the menu that appears, hit <a>, you will be prompted to save the file

I just altered the group and GID to fit that of the permissions of my dataset
 

UF8FF

Dabbler
Joined
Jan 16, 2016
Messages
29
I must be a special kind of stupid because I have gone through everyone's advice on this, reformatted my pool 4 times now and I still cannot get my permissions to say root Media - it's always wheel. Should I be changing permissions of the datasets? Should I make new users via the GUI? When I make a Jail I don't see the Jail making users outside of itself.

https://youtu.be/6japrNWNTb8

I made that because I'm so damn lost I wanted to see if anyone can point out what I'm doing wrong. It's a short video.
 
Last edited:
Joined
Apr 9, 2015
Messages
1,258
For permission problems what I started doing is creating a new user in FreeNAS GUI and setting the ID to 972 (I think whichever one Plex sets up for itself in the jail) and then making sure that user is added to the same group as the CIFS group which is writing all the data to the directory shared to plex anyway. Then in the jail I create a group that has the same number as the CIFS group which I think was 1001 and manually add the Plex user to that group. It seems to pretty well allow Plex to delete files that were added to the shared storage via CIFS.

Plex when installed inside the jail sets up a group and user but it's only good inside the jail for permissions. When you go into the jail and look at the ownership of the directories where the storage is being added most of the time it will be something like 1001:1001 as that is the true owner but that user:group does not exist in the jail which is why I add the group manually. The user doesn't really matter as far as ownership as long as the group overall has read/write permissions for the directory in question.

I do have to note that plex should have NO PROBLEM reading from the files even if groups are not setup. The only reason why I even make the changes on mine is so that Plex can delete files out of the media. I mainly did this because I ended up with a lot of music that I have no clue where it came from and some of it is not that great. It's much easier to take and tell Plex to get rid of it rather than manually browse and find the file and delete them one at a time and hope I didn't goof at some point. If you do not care about deleting a file from within Plex I really wouldn't worry about the permissions step so much.
 

UF8FF

Dabbler
Joined
Jan 16, 2016
Messages
29
For permission problems what I started doing is creating a new user in FreeNAS GUI and setting the ID to 972 (I think whichever one Plex sets up for itself in the jail) and then making sure that user is added to the same group as the CIFS group which is writing all the data to the directory shared to plex anyway. Then in the jail I create a group that has the same number as the CIFS group which I think was 1001 and manually add the Plex user to that group. It seems to pretty well allow Plex to delete files that were added to the shared storage via CIFS.

Plex when installed inside the jail sets up a group and user but it's only good inside the jail for permissions. When you go into the jail and look at the ownership of the directories where the storage is being added most of the time it will be something like 1001:1001 as that is the true owner but that user:group does not exist in the jail which is why I add the group manually. The user doesn't really matter as far as ownership as long as the group overall has read/write permissions for the directory in question.

I do have to note that plex should have NO PROBLEM reading from the files even if groups are not setup. The only reason why I even make the changes on mine is so that Plex can delete files out of the media. I mainly did this because I ended up with a lot of music that I have no clue where it came from and some of it is not that great. It's much easier to take and tell Plex to get rid of it rather than manually browse and find the file and delete them one at a time and hope I didn't goof at some point. If you do not care about deleting a file from within Plex I really wouldn't worry about the permissions step so much.
Thank you, I'll try this and hopefully it works out.
 

mka

Contributor
Joined
Sep 26, 2013
Messages
107
My Plex Jail is pretty busy: from the snapshots I see it's write 200MB per day without any activity to the server . No one is logged in, no recently added media, no one is watching but a zfs diff between today and yesterday generates a 1MB list of changed files.

Almost all activity, with thousand of changed files in:
+ /mnt/tank1/jails/plex/var/spool/clientmqueue/...

What is going on there?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I don't know, but I just checked my PMS jail snapshots and my daily ones are anywhere from 36MB to 900 MB (average probably around 400MB).

I wouldn't worry about it if it's working OK, and if you need the extra 200MB of storage it's time for some more/bigger drives :D
 

mka

Contributor
Joined
Sep 26, 2013
Messages
107
I was wondering what that jail is doing there, since it isn't doing this since /ever/. There is constant write activity to the SSD 24/7 and it create 20000 files per day. I didn't find a clou that plex is usually doing this and none of my other drives is doing it.
 

dTardis

Dabbler
Joined
Jan 29, 2016
Messages
24
I'm trying to following the instructions in the 1st post... I have gotten to this part of the instructions:



I've added two storage locations:
Freenas_3_zpsuropq9t5.jpg


However when I run the ls -l command, I don't see quite the same information returned
Freenas_4_zpsf5vt8plf.jpg

as the example given in the tutorial
Freenas_5_zpszb1rbcyr.jpg

And if I use the command ls - /mnt I get nothing.
Freenas_6_zpsf94s2uf6.jpg


I'm not sure whether I've done something wrong or whether the output of the ls command has changed between the FreeNAS version that @Cosmo_Kramer was using when he wrote his guide and the version that I'm using (9.3).

That's kind of where I am at right now.
 

dTardis

Dabbler
Joined
Jan 29, 2016
Messages
24
I have some of the same issues seen in post #170 and I'm afraid those suggestions are too vague to be of any help. I have created the source destination using the add storage button under jails. I'm not sure how you're supposed to add storage to a jail without it being user root and group wheel. I'm not sure what you mean by going into the jail and manually creating the directories. I used the GUI to add storage and the result is the same. So the issue remains, according to this guide I should see something similar to:

Code:
drwxrwx---+ 7 1002 1001 8 Mar 3 18:35 Media


but instead I see something like this:

Code:
drwxrwxrwx 2 root wheel 2 Jan 2016 08:24 plexmovies
drwxrwxrwx 2 root wheel 2 Jan 2016 08:24 plexmusic
drwxrwxrwx 2 root wheel 2 Jan 2016 08:24 plextv


Given that the rest of the guide does not make sense since the next command is based on the output being the same as the example, I'm not sure how to proceed.


Yes. I had that issue also. Although Plex can access the mounted media and read from it. It can't delete it.
 

dTardis

Dabbler
Joined
Jan 29, 2016
Messages
24
I think I found my solution. Again I had to very carefully read documentation. As I have little exp with Linux and therefor even less with FreeBSD I had to try many times to get what I think I needed. If any of this is completely wrong please let me know. Also I don't know how to insert pictures here so text only for now.

Create new Dataset.

SSH into your way into the jail.

Find out what user and group Plex is using.

There are many ways to do this. For example, ‘cat /etc/passwd’ for users and group. In my example 972 for both. You can also ‘cat /etc/group’ for a list of groups with their numbers.

So now you have 972 for both, again in my example.

In Freenas go to account and create a new account. I called my Plex and gave it a user and group ID of the same 972.

Now go back to storage and change permissions on the Dataset. Change group owner from Wheel to Plex (again in my example) and allow the group full permissions.
Next under jails add storage to the Plex jail.

Back in your jail if you do a ls –al you should see this:

drwxr-xr-x 3 root wheel 3 Feb 8 10:30 .
drwxr-xr-x 17 root wheel 21 Feb 4 15:01 ..
drwxrwxr-x 4 root plex 4 Feb 8 10:40 media
root@Plex-PlexPass:/mnt #

So now Plex should be all set to talk to the storage, but how do you get the data in. If you’re a windows person you need to set that folder to a CIFS share.

So what I did is to setup another user. I added the plex group to that users auxiliary groups list. Then in sharing I added the Dataset as a CIFS share. Now Windows can also see the Dataset and you should be able to move your files in!


My next challenge is to allow several jails to access the Dataset at the same time.

I also want to thank everyone in this thread. Very helpful!
 

JohnnyFreeNAS

Dabbler
Joined
Feb 11, 2016
Messages
24
I run DHCP for everything in my environment. I was wondering why the requirement to use an IP that is not in the DHCP scope? does it not have the ability to get an IP from the DHCP server?
 

dTardis

Dabbler
Joined
Jan 29, 2016
Messages
24
I run DHCP for everything in my environment. I was wondering why the requirement to use an IP that is not in the DHCP scope? does it not have the ability to get an IP from the DHCP server?
It does, but their is a possibility that it will get a different IP at some point which might break other apps you could at talking to Plex. Easy solution create a DHCP reservation for Plex
 

dTardis

Dabbler
Joined
Jan 29, 2016
Messages
24
So I have created a simple script to update my plex install:

service plexmediaserver_plexpass stop
pkg update && pkg upgrade multimedia/plexmediaserver-plexpass
service plexmediaserver_plexpass start


Can someone help me create a cron job that would run once a day?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
On the plexpass train my advice would be to upgrade manually when you know the latest version works ;)
 

dTardis

Dabbler
Joined
Jan 29, 2016
Messages
24
On the plexpass train my advice would be to upgrade manually when you know the latest version works ;)

I thought about that. I am taking snapshots every day and keeping them for 2 weeks. If a new update messes it up I "should" be able to roll back a snapshot and then disable the update script. Right?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Right! I guess I'm in the 'want it to work' camp these days rather than testing the latest and greatest cutting edge release. I have a plexpass subscription but still prefer to manually upgrade on the plex path, and only then when it's needed for something else (like the iOS update or for aTV4) or there's some new functionality I want. A manual upgrade on a port install only takes about 10 minutes.
 

JJT211

Patron
Joined
Jul 4, 2014
Messages
323
Anyone know how to downgrade plex to an earlier version?

Im suddenly getting a "server network not fast enough" error when streaming remotely. Ive never had this issue in the past. My LAN is 50/5 and my remote network is 30/5. In the past I could trnascode multiple streams at 3Mbps and now I cant stream a single one. I have to lower my network stream speed to 512Kbps before it gets smooth again.

I just recently upgraded my Plex and I believe that may be the issue.
 
Last edited:

JJT211

Patron
Joined
Jul 4, 2014
Messages
323
OK nevermind, I figured it out. Turning off HTTP Pipelining did the trick....
 

JJT211

Patron
Joined
Jul 4, 2014
Messages
323
My question still stands however, how would I downgrade if needed?

I use this command to update
pkg update && pkg upgrade multimedia/plexmediaserver-plexpass\

Are there commands to install a specific version?
 

Intel

Explorer
Joined
Sep 30, 2014
Messages
51
Edit2: Reinstalled Plex in a fresh jail, got "Plex media Server - This media server is unavailable to you" - I missed that the first time round b/c I didnt have a Plex account yet and thought that was it...

Found the fix here:
http://forums.freenas.org/index.php?threads/plex-media-freenas-9-1-1.15676/

Basically run
vi "/usr/local/plexdata/Plex Media Server/Preferences.xml"
and add disableRemoteSecurity="1" before />

Thanks so much, was scratching my head for a couple hours until your comment showed up. It may be since my clients are not in the same network (different VLANS) thats why its hidden from clients that do not share the same netblock.
 
Top