Transferring Plex like nothing ever happened....to FreeNAS 11.3

AltecBX

Patron
Joined
Nov 3, 2014
Messages
285
This is awesome. This visualizes what I did with help from another member. I think I did a few more steps as I didn't use that script but most of it is what I did minus naming folders. Thank you for putting this video together. I think it will help so many people for sure; I searched the forum for hours and couldn't find something this straightforward for people like me who don't thinker with FreeNAS every day.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Thank you for the kind words. When you asked for help, I said “no” with a purpose. I wanted to spend the time to create a resource that will help many; and I do not, as a matter of self preservation, touch other people’s machines. I learned the hard way that I then own any issue they have with it.
 

Naesstrom

Contributor
Joined
Jul 10, 2012
Messages
108
Just wanted to say thanks for the video to, even if I know my way around a shell video is easier sometimes! :D

N00b question, after doing the rsync and seeing that everything looks ok in the new plex I can just remove the old jail and files right?
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Yes indeed, once you know that everything is okay, you can just delete the old jail. That'll take the metadata inside the jail with it.
 

Naesstrom

Contributor
Joined
Jul 10, 2012
Messages
108
Sweet, after reading here today I realized I was running beta since when I started plexmediaserver-plexpass was the way to go! :D Feels good now when all metadata and settings are safe and secure in their own lite dataset!
 

tfran1990

Patron
Joined
Oct 18, 2017
Messages
294
I feel as if i will have to do this on my test server to save my plex meta data when i upgrade from 11.2 to 3.1.
I dont know why but when i first setup my plex i did it in a plugin.

Thank you for the video.
 

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
Thanks to Yorick for the great video.
I was planning to migrate my PLEX that way a long time ago.
With that video I found the courage to try it out.

Nevertheless I ran into some problems, but I tell you how I fixed it if somebody else runs into similar problems.
I had an old IOCAGE jail named plexmediaserver. I didn't had a user plex. So I first added a group plex with gid 972 and then a user plex with uid 972, the new plex group as primary group and the group of my media folders as auxiliary group.
But PLEX did not start right away.
The problem was lying in the group/user of plex_data which after rsync -ha wasn't plex/plex. I fixed that with find /mnt/plex_data -exec chown plex:plex {} \;.
After that it ran and I just deactivated my old PLEX, changed the IP to my old PLEX IP and mounted my certificate folder.
:D
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Interesting! So there was a version of Plex around at one point that didn't use the plex user.

BTW, you should be able to change permissions this way, too: chown -R plex:plex /path/to/plex_data
 

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
Since I got a Kaby Lake CPU I thought I give hardware transcoding a try.
So I installed the plex ruleset script and after a small heartattack (starting the script disabled my network cards for 1 minute) the dri device was there.
Code:
root@FREENAS-JEPSEN:~ # ls /dev/dri
card0           renderD128


But now the pkg could not be installed.
Code:
root@FREENAS-JEPSEN:~ # iocage console pms
Last login: Sat Apr 11 18:20:43 on pts/1
FreeBSD 11.3-RELEASE-p5 (FreeNAS.amd64) #0 r325575+8ed1cd24b60(HEAD): Mon Jan 27 18:07:23 UTC 2020

root@pms:~ # pkg install multimedia/libva-intel-media-driver
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 10 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        expat: 2.2.8
        gmmlib: 20.1.1
        libXfixes: 5.0.3_2
        libdrm: 2.4.99,1
        libepoll-shim: 0.0.20200223
        libpciaccess: 0.16
        libva: 2.7.0
        libva-intel-media-driver: 20.1.0.r
        pciids: 20200324
        wayland: 1.18.0_3

Number of packages to be installed: 10

The process will require 201 MiB more space.
30 MiB to be downloaded.

Proceed with this action? [y/N]: y
pkg: http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest/All/libva-intel-media-driver-20.1.0.r.txz: Not Found

root@pms:~ # pkg search multimedia/libva-intel-media-driver
multimedia/libva-intel-media-driver VAAPI driver for Intel HD 5000 (Gen8) or newer

root@pms:~ # pkg install expat
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        expat: 2.2.8

Number of packages to be installed: 1

124 KiB to be downloaded.

Proceed with this action? [y/N]: y
[pms] [1/1] Fetching expat-2.2.8.txz: 100%  124 KiB 127.2kB/s    00:01
Checking integrity... done (0 conflicting)
[pms] [1/1] Installing expat-2.2.8...
[pms] [1/1] Extracting expat-2.2.8: 100%
root@pms:~ #

My network is ok. As you can see I could install expat.
 

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
Looks like the archive libva-intel-media-driver-20.1.0.r.txz was replaced by libva-intel-media-driver-20.1.1.txz two days ago.
I had to do pkg update -f to force a reload of the pkg catalog.:confused:

Now the correct package libva-intel-media-driver-20.1.1.txz was installed. :D

Hardware transcoding is up and running.
The results are quite amazing.

Without it a 1080p movie streamed to mobile needed 80-100% CPU for some minutes before going down to 0-20%.
Now the same setup needs 20-30% for 1:30 and the going down to trickle below 5%. :cool:
 
Last edited:

mantis_man

Cadet
Joined
May 22, 2019
Messages
5
Hiya Yorick,

I've been using FreeNAS and Plex for years but have found the Plugins slow to update and a pain when I have to recreate the metadata for some of the unusual stuff I have in my Plex library. Your guide looked like the answer to my prayers but I'm running into problems with running Danb35's script. I must confess to not knowing a lot about the FreeBSD command line or scripting but I am learning as I go.

I've created a test instance of FreeNAS 11.3-U2 but I get the following error at the completion of the execution of the script:

pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:11:amd64/latest/Latest/pkg.txz: Operation timed out
A pre-built version of pkg could not be found for your system.
Consider changing PACKAGESITE or installing it from ports: 'ports-mgmt/pkg'.
Command: pkg install plexmediaserver failed!
Failed to install plexmediaserver package
* Stopping pms
+ Executing prestop OK
+ Stopping services OK
+ Tearing down VNET OK
+ Removing devfs_ruleset: 5 OK
+ Removing jail process OK
+ Executing poststop OK
Destroying pms

I'm assuming that this implies some issue with the pkg installer. Can you point me in the right direction to troubleshoot further. Tx.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
This means the jail cannot communicate. I’d create a jail manually that exactly matches what the script does - same name, same IP, same netmask and gateway, vnet check and Berkeley filter unchecked - and see how it behaves and why it can’t communicate.

The script is just meant to simplify things a little. It assumes static IP, and that IP has to be on the network, and outside the DHCP range so your DHCP server won’t assign it elsewhere and create a conflict.
 

mantis_man

Cadet
Joined
May 22, 2019
Messages
5
Thanks for the prompt reply Thorsten - must be pretty early in the US.

I'll try manually creating the jail, as you suggest. Would I be right in suspecting that my problem likely comes down to the vnet bridging not working correctly between the jail and the host IP networks? Would you have any suggestions on where I find the relevant .conf files that define this bridge and what tools would be the most useful to troubleshoot?

I might know a lot about FreeBSD but I do know about IP networking and they joys of getting packets to cross routed boundaries.

Tx.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
I've never had to troubleshoot vnet. "It just works" here.

How did you set up Plex before? DHCP with a static assignment? There's nothing wrong with not using a script and taking the steps in the script manually, just DHCP instead of static, if that works better in your environment. There aren't that many steps - create the jail, install plexmediaserver, sysrc so it's on; and then for good measure set FreeBSD to latest instead of quarterly and set an update cronjob. That's it. I've done it manually and am mounting my metadata dataset into the Plex default location at /usr/local/plexdata.

One thing I noticed during testing of the script is that if a jail is up and running, plugin or otherwise, that had the name of the replacement jail at some point in its lifetime - 'plex' in my testing - that will stop the new jail from communicating. I never got to the bottom of whether that's a FreeNAS or CPE issue.
 

mantis_man

Cadet
Joined
May 22, 2019
Messages
5
Previous Plex installs have been using ixSystems plugin but, as I said earlier, I was getting a bit annoyed about the delay in the release of new versions. IP addressing was using DHCP to allocate a fixed address to the jail bridge.

Will try doing the stuff in the script manually and see what I learn. It’s been a useful learning experience - and I need some little projects to keep me occupied in these days of Covid isolation.

Given that I built a clean 11.3-U2 environment to do my testing (and I rebuild it each time things don’t work out as I want) I don’t think that there should be any “relics” of previous Plex installs to complicate things.

I’m just a bit pedantic and I liked the idea of having a neat little script that I could run to do all the hard work in a nice, repeatable, way now and in the future. Maybe I’ll get to the bottom of this and can then offer something useful back to the wider community in the end.

Thank you for your suggestions; as well as to all the others who’s work I’ve learnt from over the years.
 

FJep

Dabbler
Joined
Mar 7, 2019
Messages
38
BTW, you should be able to change permissions this way, too: chown -R plex:plex /path/to/plex_data
I just saw a line similar to this is already in DanBs script, but since I first ran the script and then did rsync -ha it didn't help.
Perhaps one should use a rsync command which keeps permissions and links but changes group/user to 972/972 on the fly.
Or copy first and then run the script.
 
Top