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

noobi3

Dabbler
Joined
May 2, 2014
Messages
24
I was able to install plex using your guide. I have mounted 2 datasets into the jail to import my media
I have an issue where the plex doe not show the root directory of the jail(as shown in the attachment)
I have set the Plex to run as media and the dataset is on media permission
I remember it use to have a root directory where i chose the mounted folder ( it was " \")
Just to clarify my situation, since Freenas corral support has been dropped i am moving back to Freenas 9.10
My current version is FreeNAS-11-MASTER-201704270409 (1631dde)
 

Attachments

  • Capture.PNG
    Capture.PNG
    27.9 KB · Views: 554

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
I was able to install plex using your guide. I have mounted 2 datasets into the jail to import my media
I have an issue where the plex doe not show the root directory of the jail(as shown in the attachment)
I have set the Plex to run as media and the dataset is on media permission
I remember it use to have a root directory where i chose the mounted folder ( it was " \")
Just to clarify my situation, since Freenas corral support has been dropped i am moving back to Freenas 9.10
My current version is FreeNAS-11-MASTER-201704270409 (1631dde)
Your looks funny, is your screen size strange? I have attached a screen shot of what it should look like. You can just manually change the path at the top and type in whatever you want. You can't just mount something to / you have to give it a empty folder to mount to.

I also see your didn't learn your lesson from corral. Why are you running the nighties? You are going to have to rebuild at some point if you run the nighty builds.

Sent from my Nexus 5X using Tapatalk
 

elforesto

Dabbler
Joined
Jan 16, 2013
Messages
20
I ran into an issue where my Plex jail was still using a template from FreeNAS 9.1 and was unable to update past 1.3.3 (ports stopped updating around that build for FreeBSD 9). Rebuilding against a new 10.3 jail on FreeNAS 9.10 is actually pretty easy.

  1. Go to Jails, Templates and click Add New Template.

    Name: whatever you want (I used FreeBSD 10.3-RELEASE)
    OS: FreeBSD
    Architecture: x64
    URL: http://download.freenas.org/jails/10/x64/freenas-pluginjail-10.3-RELEASE.tgz
    Mtree: http://download.freenas.org/jails/10/x64/freenas-pluginjail-10.3-RELEASE.mtree

    This is important to make sure the new jail will not be using a stale template.
  2. Go to Jails, Add Jail. Click Advanced and choose the new template from the dropdown. Give the jail a name (e.g. plex_new) and assign it an unused IP address (one will be autofilled based on your existing jail settings). Leave everything else at the defaults.
  3. Follow the most excellent steps in the OP to configure a new instance of Plex. Make sure you set up the same Storage in your new jail as your old one.
  4. Go to Jails, View Jails and stop both jails. If you don't do this, the next step will likely fail due to open files.
  5. Copy all of your metadata from the old jail to the new one replacing <volume name>, <jails location>, and <old jail name>/<new jail name> as appropriate.

    cp -R /mnt/<volume name>/<jails location>/<old jail name>/user/local/plexdata/Plex\ Media\ Server/ /mnt/<volume name>/<jails location>/<new jail name>/usr/local/plexdata/Plex\ Media\ Server/

    This can take a long time for bigger libraries, but you'll save all of your information such as On Deck, what's been watched, artwork, etc.
  6. Go to Jails, View Jails, and edit the new jail to steal the IP from the old jail.
  7. Start the new jail and verify functionality.
  8. Remove the old jail. If you want to keep it for some reason, change autostart to false to prevent having both jails come up.
Viola! Plex can now get the latest updates from ports and will be running on a fresher version of FreeBSD.
 
Last edited:
Joined
Feb 15, 2016
Messages
6
The owner group of my dataset is "wheel". Is adding the user "plex" to the wheel group in the jail the correct action to make my dataset available to Plex or is that problematic in some way?
 

elforesto

Dabbler
Joined
Jan 16, 2013
Messages
20
The owner group of my dataset is "wheel". Is adding the user "plex" to the wheel group in the jail the correct action to make my dataset available to Plex or is that problematic in some way?

It is generally a bad idea to use wheel any more than is absolutely necessary, especially for an unprivileged service account like plex. In my environment, I made sure all media folders are owned by the media group with rwx permissions. I then add users to that group who should have that access including plex.
 

nemisisak

Explorer
Joined
Jun 19, 2015
Messages
69
I ran into an issue where my Plex jail was still using a template from FreeNAS 9.1 and was unable to update past 1.3.3 (ports stopped updating around that build for FreeBSD 9). Rebuilding against a new 10.3 jail on FreeNAS 9.10 is actually pretty easy.

  1. Go to Jails, Templates and click Add New Template.

    Name: whatever you want (I used FreeBSD 10.3-RELEASE)
    OS: FreeBSD
    Architecture: x64
    URL: http://download.freenas.org/jails/10/x64/freenas-pluginjail-10.3-RELEASE.tgz
    Mtree: http://download.freenas.org/jails/10/x64/freenas-pluginjail-10.3-RELEASE.mtree

    This is important to make sure the new jail will not be using a stale template.
  2. Go to Jails, Add Jail. Click Advanced and choose the new template from the dropdown. Give the jail a name (e.g. plex_new) and assign it an unused IP address (one will be autofilled based on your existing jail settings). Leave everything else at the defaults.
  3. Follow the most excellent steps in the OP to configure a new instance of Plex. Make sure you set up the same Storage in your new jail as your old one.
  4. Go to Jails, View Jails and stop both jails. If you don't do this, the next step will likely fail due to open files.
  5. Copy all of your metadata from the old jail to the new one replacing <volume name>, <jails location>, and <old jail name>/<new jail name> as appropriate.

    cp -R /mnt/<volume name>/<jails location>/<old jail name>/user/local/plexdata/Plex\ Media\ Server/ /mnt/<volume name>/<jails location>/<new jail name>/user/local/plexdata/Plex\ Media\ Server/

    This can take a long time for bigger libraries, but you'll save all of your information such as On Deck, what's been watched, artwork, etc.
  6. Go to Jails, View Jails, and edit the new jail to steal the IP from the old jail.
  7. Start the new jail and verify functionality.
  8. Remove the old jail. If you want to keep it for some reason, change autostart to false to prevent having both jails come up.
Viola! Plex can now get the latest updates from ports and will be running on a fresher version of FreeBSD.

Hi, thanks for the mini guide however i just spent ages trying to figure the copy out because it wasn't working. Turns out my file path is slightly different. Where you have "user" I have "usr". took me a while to figure this out :').

Also bare in mind once you get the copy going the shell will just hang until it completes. Not entirely sure why but this is REALLY SLOW! I had 10Gb of meta data to copy and it took a while. Not sure why it took so long, maybe someone can shed some light? jails are both on the same volume.

Code:
cp -R /mnt/<Volume>/<jail location>/<old jail name>/usr/local/plexdata/Plex\ Media\ Server/ /mnt/<volume>/<jail location>/<new jail name>/usr/local/plexdata/Plex\ Media\ Server/ 
 
Last edited:

nick779

Contributor
Joined
Dec 17, 2014
Messages
189
stupid question, is it possible to run a 9.10 jail in a 9.3 base OS? I tried it, but there was something screwy with the NIC, it wouldnt pull an IP, in ifconfig it didnt list a inet parameter.

Im just really hesitant to move from 9.3 to 9.10 on my NAS
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977

nemisisak

Explorer
Joined
Jun 19, 2015
Messages
69
Huh im getting really confused now. Got plex running however new content that I added was not pulling the meta data in and just leaving a blank instance. Remote access and streaming work fine.

Instead of trying to figure out what went wrong I just tried to create a fresh jail and now I am getting errors trying to download the package from the repository.

"pkg: No packages available to install matching '-y' have been found in the repositories"
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
What command did you use? Looks like bad optional argument.

Sent from my Nexus 5X using Tapatalk
 

nemisisak

Explorer
Joined
Jun 19, 2015
Messages
69
pkg install multimedia/plexmediaserver -y

I used this which should definately work as I jsut used it a couple of hours ago. freshports is up and the location hasn't changed so not quite sure why its not working.

EDIT - Thats interesting. If you dont update the jail then plex will install. Though it doesnt look correct to me?


root@Test:/ # pkg install multimedia/plexmediaserver -y
Updating FreeBSD repository catalogue...
Repository FreeBSD has a wrong packagesite, need to re-create database
[Test] Fetching meta.txz: 100% 944 B 0.9kB/s 00:01
[Test] Fetching packagesite.txz: 100% 6 MiB 3.0MB/s 00:02
Processing entries: 100%
FreeBSD repository update completed. 26480 packages processed.
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
pkg: 1.6.4_1 -> 1.10.1

The process will require 553 KiB more space.
3 MiB to be downloaded.

Proceed with this action? [y/N]: y
[Test] Fetching pkg-1.10.1.txz: 100% 3 MiB 2.6MB/s 00:01
Checking integrity... done (0 conflicting)
[Test] [1/1] Upgrading pkg from 1.6.4_1 to 1.10.1...
You may need to manually remove /usr/local/etc/pkg.conf if it is no longer needed.
[Test] [1/1] Extracting pkg-1.10.1: 100%
Updating FreeBSD repository catalogue...
Repo "FreeBSD" upgrade schema 2012 to 2013: Add vital field
Repo "FreeBSD" upgrade schema 2013 to 2014: DROP TABLE pkg_search;
FreeBSD repository is up to date.
All repositories are up to date.
pkg: No packages available to install matching '-y' have been found in the repositories
 
Last edited:

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
All you need is pkg install plexmediaserver. Not sure why you are adding the -y.
 

nemisisak

Explorer
Joined
Jun 19, 2015
Messages
69
All you need is pkg install plexmediaserver. Not sure why you are adding the -y.
following the OP instructions

That worked much better though thanks.

Edit - However its still not pulling new meta data for some reason :'(
 
Last edited:

nemisisak

Explorer
Joined
Jun 19, 2015
Messages
69
Okay there has definately been some updates @Cosmo_Kramer if you could update your OP I have listed them. These are relevent for the latest 9.10.2 freenas iteration. Be aware that you will need to create a new jail to be able to update past 1.3.3.

1. create your jail the usual way giving it an appropriate name and IP (be aware for those on a .0 subnet the auto IP will be .1 so make sure this is correct or the next steps won't work)
2. ssh into your jail jls then whatever number your jail is just as normal e.g. jexec 1 tcsh
3. next update your Jail with the necessary files needed using portsnap fetch extract this will take a moment and create alot of text on screen
4. now to install plex using cd /usr/ports/multimedia/plexmediaserver/ && make install clean a blue screen will appear just press ok
5. next enable plex echo plexmediaserver_enable="YES" >> /etc/rc.conf
6. then start it service plexmediaserver start
7. next type exit
(If you are upgrading your plex due the outdated jail please read step 12 before going any further)
8. in the web gui navigate to your jail and select it, then click the add sotrage icon below
source --> where your media files are saved
Destination --> select the folder named "media"
then press "OK"
9. ssh back into your jail using step 2, next give the jail permission to access your media pw groupadd Media -g 1001 && pw usermod plex -G plex,Media
10. to check it has worked use either ls -l /mnt or ls -l, depending on your setup.
11. once you're happy restart the jail service plexmediaserver restart

Plex should now be functioning. navigate to the page using your select IP followed by :32400/web e.g. 192.168.0.10:32400/web

The following step if you are upgrading your plex is to transfer your metadata from your old jail to your new jail. I couldn't get this to work and I think I corrupted the metadata by being impatient which subsequently wouldn't allow me to gather any new metadata afterwards. Unfortunately I deleted my old plex jail before I realised as the transfer appeared to work, so I am unable to test if it was me or it causes some underlying problems. However for those who want to try see below, as marking things as watched is now my full time job :(. replace <volume name>, <jails location>, and <old plex name>/<new plex name> as appropriate

12. cp -R /mnt/<Volume name>/<Jail location>/<Old Plex Jail>/usr/local/plexdata/Plex\ Media\ Server/ /mnt/<Volume name>/<Jail location>/<New Plex Jail>/usr/local/plexdata/Plex\ Media\ Server/

Please be aware that if you mounted your storage in a different location other than "media" in your old jail then none of the file location tags are going to work and will need refreshing. Again im not sure if this was part of corrupting my data or not but the refresh still keeps your watched meta data and will correct the file locations. To be safe however I would set your destination location to the same as your old plex jail e.g. mine was initially in /mnt instead of /media.
 

elforesto

Dabbler
Joined
Jan 16, 2013
Messages
20
Hi, thanks for the mini guide however i just spent ages trying to figure the copy out because it wasn't working. Turns out my file path is slightly different. Where you have "user" I have "usr". took me a while to figure this out :').

Also bare in mind once you get the copy going the shell will just hang until it completes. Not entirely sure why but this is REALLY SLOW! I had 10Gb of meta data to copy and it took a while. Not sure why it took so long, maybe someone can shed some light? jails are both on the same volume.

Code:
cp -R /mnt/<Volume>/<jail location>/<old jail name>/usr/local/plexdata/Plex\ Media\ Server/ /mnt/<volume>/<jail location>/<new jail name>/usr/local/plexdata/Plex\ Media\ Server/ 

It was a typo. Fixed it in the OP.
 

nick779

Contributor
Joined
Dec 17, 2014
Messages
189
Okay there has definately been some updates @Cosmo_Kramer if you could update your OP I have listed them. These are relevent for the latest 9.10.2 freenas iteration. Be aware that you will need to create a new jail to be able to update past 1.3.3.

1. create your jail the usual way giving it an appropriate name and IP (be aware for those on a .0 subnet the auto IP will be .1 so make sure this is correct or the next steps won't work)
2. ssh into your jail jls then whatever number your jail is just as normal e.g. jexec 1 tcsh
3. next update your Jail with the necessary files needed using portsnap fetch extract this will take a moment and create alot of text on screen
4. now to install plex using cd /usr/ports/multimedia/plexmediaserver/ && make install clean a blue screen will appear just press ok
5. next enable plex echo plexmediaserver_enable="YES" >> /etc/rc.conf
6. then start it service plexmediaserver start
7. next type exit
(If you are upgrading your plex due the outdated jail please read step 12 before going any further)
8. in the web gui navigate to your jail and select it, then click the add sotrage icon below
source --> where your media files are saved
Destination --> select the folder named "media"
then press "OK"
9. ssh back into your jail using step 2, next give the jail permission to access your media pw groupadd Media -g 1001 && pw usermod plex -G plex,Media
10. to check it has worked use either ls -l /mnt or ls -l, depending on your setup.
11. once you're happy restart the jail service plexmediaserver restart

Plex should now be functioning. navigate to the page using your select IP followed by :32400/web e.g. 192.168.0.10:32400/web

The following step if you are upgrading your plex is to transfer your metadata from your old jail to your new jail. I couldn't get this to work and I think I corrupted the metadata by being impatient which subsequently wouldn't allow me to gather any new metadata afterwards. Unfortunately I deleted my old plex jail before I realised as the transfer appeared to work, so I am unable to test if it was me or it causes some underlying problems. However for those who want to try see below, as marking things as watched is now my full time job :(. replace <volume name>, <jails location>, and <old plex name>/<new plex name> as appropriate

12. cp -R /mnt/<Volume name>/<Jail location>/<Old Plex Jail>/usr/local/plexdata/Plex\ Media\ Server/ /mnt/<Volume name>/<Jail location>/<New Plex Jail>/usr/local/plexdata/Plex\ Media\ Server/

Please be aware that if you mounted your storage in a different location other than "media" in your old jail then none of the file location tags are going to work and will need refreshing. Again im not sure if this was part of corrupting my data or not but the refresh still keeps your watched meta data and will correct the file locations. To be safe however I would set your destination location to the same as your old plex jail e.g. mine was initially in /mnt instead of /media.

Did you have any issues getting back into the old plex server if you needed to spin it back up? Im having a hell of a time, even if I directly ip to it, I get the new system despite the new jail being a completely different IP.
Im assuming this has to do with the metadata copy.
 

nemisisak

Explorer
Joined
Jun 19, 2015
Messages
69
Did you have any issues getting back into the old plex server if you needed to spin it back up? Im having a hell of a time, even if I directly ip to it, I get the new system despite the new jail being a completely different IP.
Im assuming this has to do with the metadata copy.
Nope, I could access both instances of plex at the same time. If they are on seperate IP's im unsure of the problem. Setting up a new Plex jail shouldnt affect the original. You can try restarting the jails and see if that helps.
 

nick779

Contributor
Joined
Dec 17, 2014
Messages
189
Nope, I could access both instances of plex at the same time. If they are on seperate IP's im unsure of the problem. Setting up a new Plex jail shouldnt affect the original. You can try restarting the jails and see if that helps.

Just tried it, I suppose maybe the metadata copy causes a unique ID to be copied over. Not 100% sure. I also found that all of the Movie posters that I had to manually add are now missing. I figured that would copy with the metadata copy.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I've recently upgraded from 9.3.1 to 9.10.1, so needed to rebuild my PMS jail so I could continue to update moving forward.

Took much longer than expected, but the old and new look identical now. Some potential mistakes to avoid:
  • your plexdata folder might be huge! Mine took almost 2 hours to copy from /mnt/pool/jails/old_jail/usr/local/plexdata to /mnt/pool/jails/new_jail/usr/local. Probably best to SSH into your FreeNAS box as the WUI shell will likely timeout.
  • you'll need to reset the permissions on the plexdata folder when it's copied or you won't even be able to connect the the Plex WUI > chown -R plex:plex /usr/local/plexdata
I also have PlexPy and PlexEmail running in their own jails, so needed to update the mount points to the log folder and plexdata folders respectively.
 

nick779

Contributor
Joined
Dec 17, 2014
Messages
189
I've recently upgraded from 9.3.1 to 9.10.1, so needed to rebuild my PMS jail so I could continue to update moving forward.

Took much longer than expected, but the old and new look identical now. Some potential mistakes to avoid:
  • your plexdata folder might be huge! Mine took almost 2 hours to copy from /mnt/pool/jails/old_jail/usr/local/plexdata to /mnt/pool/jails/new_jail/usr/local. Probably best to SSH into your FreeNAS box as the WUI shell will likely timeout.
  • you'll need to reset the permissions on the plexdata folder when it's copied or you won't even be able to connect the the Plex WUI > chown -R plex:plex /usr/local/plexdata
I also have PlexPy and PlexEmail running in their own jails, so needed to update the mount points to the log folder and plexdata folders respectively.
Did it copy any manually added movie posters?
 
Top