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

estebanraso

Cadet
Joined
Oct 6, 2018
Messages
5
How To Install Plex in a FreeNAS 11.0 Jail:

Once at a shell prompt within the jail, find out what the GroupID is of the group that is assigned permissions on the mount with this command:
ls -l /mnt

You’ll then see a list of mount points such as this one:
Code:
drwxrwx---+ 7 1002 1001 8 Mar 3 18:35 Media

Nothing shows at this point. /mnt of the jail is empty. I've already assigned the storage for the jails and status "mounted?" is "true" in the Storage tab

EDIT: You have to run "ls -l media" where media is the destination folder of your storage.
 
Last edited:

estebanraso

Cadet
Joined
Oct 6, 2018
Messages
5
first of all, i want to thank you for the job you've done with this tutorial. it really helps.

however, im having problems folliwing it: when i run the "jls" command it shows nothing at all.

do you have any idea what could be wrong?

You are running the "jls" command inside the jail (root@Plex). You have to run it from the host's shell (root@servername)
 

giacombum

Explorer
Joined
Jul 18, 2017
Messages
61
Hello, thank you for the guide! I followed all the hints and I can successfully run plex media server, but I have a problem with metadata (the agents don't download any metadata from internet). So I have a couple of questions: how can I check if my server is connected to the internet? And why if I look to the ports page http://www.freshports.org/multimedia/plexmediaserver/, the latest version is not that I have installed on my freenas?

Thank you in advance!
 

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
If you followed the guide at the beginning of this thread, it is very, very old and not correct for the current version of FreeNAS. Unless you know what you are doing, you should stay away from freshports.
 

sremick

Patron
Joined
Sep 24, 2014
Messages
323
Unless you know what you are doing, you should stay away from freshports.

Care to elaborate?

FreshPorts is not "dangerous"... it is just a web interface to the contents of the ports tree that Dan runs out of the goodness of his heart. It's not like you're installing anything from it. In the context of this thread and the OP, it's simply an easy way to see what the current version available in the ports tree so you can know if an update is available. In fact. I have a watch there set for Plex so that when the port maintainer updates it, I get an email alert and know that an update for me is actually ready (vs. the Plex back-end teasing me that there's an update I can't use yet because the port maintainer hasn't had the time to do his magic). Then a couple quick commands and voila... I'm upgraded.

I fail to see the danger in using Freshports in this manner, and aside from FreeNAS 11.2 (which I haven't had time to migrate to. iocage vs warden), the method outlined in the OP has been rock solid for me for over 4 years of running my FreeNAS box.
 

giacombum

Explorer
Joined
Jul 18, 2017
Messages
61
If you followed the guide at the beginning of this thread, it is very, very old and not correct for the current version of FreeNAS. Unless you know what you are doing, you should stay away from freshports.
Thank you for your hint: can you suggest me an updated guide to install Plex? The version available from the plugins is a bit out of date and probably there is a bug that prevents the download of metadata for movies with italian title.
 

giacombum

Explorer
Joined
Jul 18, 2017
Messages
61
Care to elaborate?

FreshPorts is not "dangerous"... it is just a web interface to the contents of the ports tree that Dan runs out of the goodness of his heart. It's not like you're installing anything from it. In the context of this thread and the OP, it's simply an easy way to see what the current version available in the ports tree so you can know if an update is available. In fact. I have a watch there set for Plex so that when the port maintainer updates it, I get an email alert and know that an update for me is actually ready (vs. the Plex back-end teasing me that there's an update I can't use yet because the port maintainer hasn't had the time to do his magic). Then a couple quick commands and voila... I'm upgraded.

I fail to see the danger in using Freshports in this manner, and aside from FreeNAS 11.2 (which I haven't had time to migrate to. iocage vs warden), the method outlined in the OP has been rock solid for me for over 4 years of running my FreeNAS box.
Thank you for the reply: why the version that I install from the ports is not the latest available at that link? Is it possible to install the latest version available from that link with this method?
 

sremick

Patron
Joined
Sep 24, 2014
Messages
323
Thank you for the reply: why the version that I install from the ports is not the latest available at that link? Is it possible to install the latest version available from that link with this method?

That's not what I said. FreshPorts reflects what you have available to install in the FreeBSD ports system. This can lag behind the latest version mentioned on the Plex site as you need to wait for the FreeBSD port maintainer to package it up into the ports system.
 

giacombum

Explorer
Joined
Jul 18, 2017
Messages
61
That's not what I said. FreshPorts reflects what you have available to install in the FreeBSD ports system. This can lag behind the latest version mentioned on the Plex site as you need to wait for the FreeBSD port maintainer to package it up into the ports system.
No, probably I explained badly (as usual!): the version that I find in my system, installed using the guide at the beginning of this post, is 1.13.8.5395, while in the ports website the latest version reported is 1.14.0.5470. Why? Do am I wrong with something?
 

sremick

Patron
Joined
Sep 24, 2014
Messages
323
No, probably I explained badly (as usual!): the version that I find in my system, installed using the guide at the beginning of this post, is 1.13.8.5395, while in the ports website the latest version reported is 1.14.0.5470. Why? Do am I wrong with something?

You either need to upgrade your port, or upgrade your ports tree first then upgrade your port. If you are unfamiliar with the FreeBSD ports system, start here: https://www.freebsd.org/doc/handbook/ports-using.html

Because you are manually creating the jail and its contents, you also then are responsible for manually maintaining/upgrading them. It does not happen automatically, and the GUI method in Plex will not help you here. Don't try to use it... it doesn't apply to FreeBSD. Nor is there anything you do in the FreeNAS GUI for this (it's not a plugin, so intimate control of what's happening inside the jail is beyond the scope of what FreeNAS does). FreeNAS made you your jail, its job is done and the rest is up to you via terminal outside of FreeNAS.

This would all be done within a terminal connected to your jail. Basically the same one/method you used to manually set up Plex inside the jail to begin with. You do not want to be doing this from the main FreeNAS terminal. Many people get confused here. Think of your jail like a virtual machine (though it very much isn't, the concept of isolation is the same and it has its own IP address).

I would advise against trying to automate the ports upgrade process using a cron job. Do it manually while you're around to babysit the process, in case something breaks or there's an alert.
 

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
Care to elaborate?

FreshPorts is not "dangerous"... it is just a web interface to the contents of the ports tree that Dan runs out of the goodness of his heart. It's not like you're installing anything from it. In the context of this thread and the OP, it's simply an easy way to see what the current version available in the ports tree so you can know if an update is available. In fact. I have a watch there set for Plex so that when the port maintainer updates it, I get an email alert and know that an update for me is actually ready (vs. the Plex back-end teasing me that there's an update I can't use yet because the port maintainer hasn't had the time to do his magic). Then a couple quick commands and voila... I'm upgraded.

I fail to see the danger in using Freshports in this manner, and aside from FreeNAS 11.2 (which I haven't had time to migrate to. iocage vs warden), the method outlined in the OP has been rock solid for me for over 4 years of running my FreeNAS box.
I believe your post immediately preceeding this one makes my point... It is more complicated than other approaches and provides lots of ways for things to go wrong if you don't know what you are doing. As for an easier way to manually maintain updates in a jail, I use pkg updates.

To @giacombum: look for a tutorial for installing Plex in an iocage jail using the pkg system. Some searching on the forum will turn up helpful advice - but be certain you follow advice in a recent thread as there will be many old posts that will not be correct for FreeNAS 11.2 and iocage. Learning how to do this will actually help you understand the system a little better. If you don't want to take the time, then just use the plugin. For the vast majority of people, the plugin will be just fine.
 

sremick

Patron
Joined
Sep 24, 2014
Messages
323
I believe your post immediately preceeding this one makes my point... It is more complicated than other approaches and provides lots of ways for things to go wrong if you don't know what you are doing.

I guess I disagree. The two commands it takes to update a port from the FreeBSD command line pales in comparison to the technical skill necessary to set up FreeNAS and all its nuances. If someone can get this far and has an operational FreeNAS box, I think they can handle portsnap fetch update ; portmaster -a
 

SweetAndLow

Sweet'NASty
Joined
Nov 6, 2013
Messages
6,421
No, probably I explained badly (as usual!): the version that I find in my system, installed using the guide at the beginning of this post, is 1.13.8.5395, while in the ports website the latest version reported is 1.14.0.5470. Why? Do am I wrong with something?
The reason for the older version when using pkg is that your jail is setup to use the 'quartly' release of the packages not the 'latest'. If you look in /etc/pkg/FreeBSD.conf in your jail you will see the quartly url. You can change it to latest if you want and it will download the 1.14 release.
 

raidflex

Guru
Joined
Mar 14, 2012
Messages
531
I guess I disagree. The two commands it takes to update a port from the FreeBSD command line pales in comparison to the technical skill necessary to set up FreeNAS and all its nuances. If someone can get this far and has an operational FreeNAS box, I think they can handle portsnap fetch update ; portmaster -a

The pkg's are usually up to to date for the most part, I fail to see a reason to use ports? I have been using a standard jail for years with both warden and iocage and have always updated with pkg without issues or waiting long periods of time for new versions.
 

sremick

Patron
Joined
Sep 24, 2014
Messages
323
The pkg's are usually up to to date for the most part, I fail to see a reason to use ports? I have been using a standard jail for years with both warden and iocage and have always updated with pkg without issues or waiting long periods of time for new versions.
Packages are quick, ports are more reliable.
Packages are precompiled for the lowest-common denominator. Ports compile on your system for your environment. For this situation, the time necessary to compile Plex is minuscule and hardly a hindrance.
Packages make assumptions. Ports let you choose options at build time.
Packages are built from from ports. Ports come first, packages are built later. So ports will get the updates first, package will sometimes lag behind
Packages have baked-in dependencies on specific versions in other packages. Ports depend on what versions you actually have.

Been using FreeBSD since the early 1990s. Ports were the way originally. Packages came later because people got impatient and wanted to infect FreeBSD with "the Linux way". Next they'll insist FreeBSD use systemd...
 

raidflex

Guru
Joined
Mar 14, 2012
Messages
531
Packages are quick, ports are more reliable.
Packages are precompiled for the lowest-common denominator. Ports compile on your system for your environment. For this situation, the time necessary to compile Plex is minuscule and hardly a hindrance.
Packages make assumptions. Ports let you choose options at build time.
Packages are built from from ports. Ports come first, packages are built later. So ports will get the updates first, package will sometimes lag behind
Packages have baked-in dependencies on specific versions in other packages. Ports depend on what versions you actually have.

While I understand were you are coming from concerning reliability/compatibility, I have yet to have an issue with a package for the many years I have been installing software in jails. I have complied ports in the past when a package was not available. I think for most people here though that do not have experience with Freebsd in general or are new to Freenas, using standard jails with packages should be sufficient.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
Ports compile on your system for your environment.
...only if they have the source code to begin with, which the Plex port doesn't (Plex is a closed-source commercial application, after all). The only benefit to the Plex port over the package is that it's going to be slightly more up-to-date. If have a pathological need for your Plex installation to be as current as possible, ports would be a slight benefit compared to packages.
 

giacombum

Explorer
Joined
Jul 18, 2017
Messages
61
I still cannot fetch metadata for my library: I thought it was a permission problem, so I've modified the owners of the Plex folder, that now appears like this

Code:
root@plex:/mnt/Movies/Pippo # ls -lrth
total 4203652
-rwxrwxr-x+ 1 root  Media   4.0G Dec 10 21:29 20 Sigarette (2010).mkv


and plex user belongs to Media group
Code:
root@plex:/mnt/Movies/Pippo # getent group Media
Media:*:1001:plex


Do you have any suggestion? It could be possible that the jail (and therefore the Plex server) is not connected to the internet (but only to my home network): how can I verify that?
 
Last edited:

JJT211

Patron
Joined
Jul 4, 2014
Messages
323
JJT211 said:
Anyone having problems deleting media from the Plex client UI? When I try to delete using icon I get this message "Unable to delete media. Please check your file permissions"

I used to be able to do this with my old Plex warden jail but can no longer do it since I've gone to an iocage jail installation. I definitely have "Allow media deletion" checked in the server settings. I tried setting 777 permissions on my media shares but im still getting the same message. I think it has something to do with the permissions inside of the actual Plex jail but I know from the past that you need to be careful with permissions inside of jails.

Anyone have any ideas?

When you mounted the data folders in your jail, did you mount them as read-only, or read-write? That could make a difference.

Sorry for the uber late reply.

Im not sure but its a good guess. I believe I just followed the guide in resources section. Below is what I see when I browse through Putty to the folder I have my shares mounted inside jail. All shares are mounted to the /plex/mnt directory inside jail

Code:
root@plex:/mnt # ls -ld
drwxr-xr-x  7 root  wheel  7 Feb  7  2018 .


And here's the share itself

Code:
root@plex:/mnt/movies # ls -ld
drwxrwxrwx  1592 nobody  nogroup  1599 Dec 15 00:02 .


Looks like in the first example, the folder that contains my shares is missing a write permission. Im a little hesistant to change that permission as its the actual jail and in the past ive screwed things up messing with those. Does that look like why I cant delete movies from the Plex client? If so, what's the syntax to change permission of that mount directory? Im guessing its chmod 777 inside /mnt directory.

EDIT:
Ok, I just tried changing permission of the /plex/mnt directory to chmod 777 and im still getting the same permissions issue
 
Last edited:

pschatz100

Guru
Joined
Mar 30, 2014
Messages
1,184
I suspect that, at the end of the day, the issue is related to running Plex in a jail, but your media is actually outside of the jail. The mounts would need r/w access to be able to modify the original media files. You might try the Plex forum for more discussion about deleting media. Look for posts about running on Linux or FreeBSD.

But for my curiosity, why would you want to allow the Plex client to delete media? I manage my media from the same shares I use to upload.
 
Top