Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

How to: Migrate Plex (plexpass version) from a Warden jail to an iocage jail

Western Digital Drives - The Preferred Drives of FreeNAS and TrueNAS CORE
Status
Not open for further replies.

ryanakata

Explorer
Joined
Jul 26, 2015
Messages
62
OLD DATA - root@freenas:/mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex\

Media\ Server/

#New Config Directory outside of the jail
Code:
mkdir /mnt/jailssd/apps/
mkdir /mnt/jailssd/apps/plex

#Change iocage jail location to SSD or preferred storage
Code:
iocage activate jailssd
iocage fetch

#Install Plex, mount you media
Code:
mkdir /mnt/jailssd/apps/
mkdir /mnt/jailssd/apps/plex
echo '{"pkgs":["plexmediaserver-plexpass","ca_root_nss"]}' > /tmp/pkg.json
iocage create -n "plex" -p /tmp/pkg.json -r 11.1-RELEASE ip4_addr="vnet0|192.168.1.100/24" defaultrouter="192.168.1.1" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
iocage fstab -a plex /mnt/jailssd/apps/plex /config nullfs rw 0 0
iocage fstab -a plex /mnt/phobos/plex_media /media nullfs ro 0 0
iocage exec plex chown -R plex:plex /config
iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES"
iocage exec plex sysrc plexmediaserver_plexpass_support_path="/config"
iocage exec plex "mkdir -p /usr/local/etc/pkg/repos"
iocage exec plex "vi /usr/local/etc/pkg/repos/FreeBSD.conf"

Code:
FreeBSD: {
	url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}

Ctrl+z+z

#Start Plex so the folder structure is created
Code:
iocage exec plex service plexmediaserver_plexpass start

#Stop Plex
Code:
iocage exec plex service plexmediaserver_plexpass stop

#Verify and copy your old config folder to your new one
Code:
cp -Ripv -f "/mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/jailssd/apps/plex"

#Start Plex
Code:
iocage exec plex service plexmediaserver_plexpass start
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
13,067

ryanakata

Explorer
Joined
Jul 26, 2015
Messages
62

NasKar

Guru
Joined
Jan 8, 2016
Messages
732
Nice, I'll blow out my configuration later and try it out. I actually am back on the warden jail due to my pms updater script grabs the latest release the second it is released
Would you be willing to share your PMS updater script?
 

sretalla

Hall of Famer
Joined
Jan 1, 2016
Messages
6,799
I have had a hack at the PMS_updater.sh and got it to work inside an iocage jail with little modification.

2 tricks needed:

  1. you need to ensure that you do a pkg install inside the jail for both wget and ca_root_nss
  2. you need to replace PMSPARENTPATH="/usr/pbi/plexmediaserver-amd64/share" with PMSPARENTPATH="/usr/local/share"
A third trick is needed if you are running the plexpass version, where you need to replace the following lines:
PMSLIVEFOLDER="plexmediaserver" with PMSLIVEFOLDER="plexmediaserver-plexpass"

PMSBAKFOLDER="plexmediaserver.bak" with PMSBAKFOLDER="plexmediaserver-plexpass.bak" #Actually this one is optional as it's just a backup

service plexmediaserver stop 2>&1 | LogMsg with service plexmediaserver_plexpass stop 2>&1 | LogMsg #line 183

service plexmediaserver start with service plexmediaserver_plexpass start #line 201

I have had it work for me in both cases of plexpass and standard.

You can run it anytime to update whenever plex is telling you there's an update and to install it manually.

You should also re-run it after doing a pkg update && pkg upgrade in your jail.
 

ryanakata

Explorer
Joined
Jul 26, 2015
Messages
62
Bringing back the thread from the dead. I've changed the install commands and Plex will launch, however the migration of the warden data to the newly created iocage plugin data is not working. Currently troubleshooting this, as well as once it is working, I'd like to fork the old script using the modifications that @sretalla has made to ensure this updates without an issue on the new releases.

If anyone can point me to copying my old data to the new one and how to have plex pick it up, it would be greatly appreciated!

I'll need to do the same to Tautulli, however I may just move that to my VM with Unifi and PiHole once I can figure out what is causing that to halt randomly.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,746
If anyone can point me to copying my old data to the new one and how to have plex pick it up, it would be greatly appreciated!
This should work.
Code:
cp -Ripv "/mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass"
 

ryanakata

Explorer
Joined
Jul 26, 2015
Messages
62
This should work.
Code:
cp -Ripv "/mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass"

Gave that one a shot with no luck. Started Plex and get hit with the new user prompt to setup a new server. Hopefully tomorrow I can figure out what I'm missing.
 

Nightowl805

Explorer
Joined
May 12, 2014
Messages
77
OLD DATA - root@freenas:/mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex\ Media\ Server/

NEW PATH - root@freenas:/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass/Plex\ Media\ Server/

#Change iocage jail location to SSD or preferred storage
iocage activate jailssd
iocage fetch

#Install Plex, mount you media
echo '{"pkgs":["multimedia/plexmediaserver-plexpass","security/ca_root_nss"]}' > /tmp/pkgs.json
iocage create -r 11.1-RELEASE -p /tmp/pkgs.json -n plex ip4_addr="vnet0|192.168.1.100/24" defaultrouter=192.168.1.1 vnet=on boot=on allow_raw_sockets=1
iocage exec plex sysrc plexmediaserver_plexpass_enable=YES

#Verify and copy your old config folder to your new one
cp -Ripv /mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex\ Media\ Server/ "/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass/Plex\ Media\ Server/"

#Start Plex
iocage exec plex service plexmediaserver_plexpass start


CAUTION: The command to copy the plex configuration from the warden jail to the newly create iocage jail is not working for me at the moment as is currently being troubleshot.

Question, Your new path as described is :
NEW PATH - root@freenas:/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass/Plex

I have the same except for after Plexdata-plexpass/ I have two folder paths to choose from. 1. Plexdata-plexpass/Plex or 2. Plexdata-plexpass/Plex Media Server

Option 2 has a bunch of nested folders.

When I attempted to run this I got:
[root@freenas ~]# cp -Ripv /mnt/jails/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass

cp: Server /mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass is not a directory

I guess it wants me to choose one of those two folder options but not sure which one.

Also, I am attempting to do this migration from the Legacy UI shell. does that matter?
 

sretalla

Hall of Famer
Joined
Jan 1, 2016
Messages
6,799
What you really want to do is get that database out of your jail and keep it out, so next time you need to switch jail systems or just want to rebuild the jail you don't have to go digging around inside the jail for your data.

The excellent setup resource https://forums.freenas.org/index.php?resources/fn11-1-iocage-jails-plex-tautulli-sonarr-radarr-lidarr-jackett-ombi-transmission-organizr.58/ already accounts for it to be like that.

What you need to make sure of is that you have your "Plex Media Server" directory right under the level you set with the fstab mapping of the /config directory.

So, if you make a directory on your jails pool called apps, then one called plex inside that... copy your warden jail data ( "/mnt/jails/plexmediaserver_1/var/db/plexdata/Plex Media Server" ) to it, then use:

iocage fstab -a plex /mnt/tank1/apps/plex /config nullfs rw 0 0

to put that data into the jail.

Then make sure your permissions are good as described in the resource and you're all set.
 

ryanakata

Explorer
Joined
Jul 26, 2015
Messages
62
Question, Your new path as described is :
NEW PATH - root@freenas:/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass/Plex

I have the same except for after Plexdata-plexpass/ I have two folder paths to choose from. 1. Plexdata-plexpass/Plex or 2. Plexdata-plexpass/Plex Media Server

Option 2 has a bunch of nested folders.

When I attempted to run this I got:
[root@freenas ~]# cp -Ripv /mnt/jails/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass

cp: Server /mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass is not a directory

I guess it wants me to choose one of those two folder options but not sure which one.

Also, I am attempting to do this migration from the Legacy UI shell. does that matter?

Shell doesn't matter. Use the one in the GUI or SSH over via putty or something.

I can confirm this is the correct copy command and it gets all my files there.

cp -Ripv "/mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/iocage/jails/plex/root/usr/local/plexdata-plexpass/Plex Media Server"


However when I launch Plex, it still acts like it is a brand new server. I'm out of ideas.
What you really want to do is get that database out of your jail and keep it out, so next time you need to switch jail systems or just want to rebuild the jail you don't have to go digging around inside the jail for your data.

The excellent setup resource https://forums.freenas.org/index.php?resources/fn11-1-iocage-jails-plex-tautulli-sonarr-radarr-lidarr-jackett-ombi-transmission-organizr.58/ already accounts for it to be like that.

What you need to make sure of is that you have your "Plex Media Server" directory right under the level you set with the fstab mapping of the /config directory.

So, if you make a directory on your jails pool called apps, then one called plex inside that... copy your warden jail data ( "/mnt/jails/plexmediaserver_1/var/db/plexdata/Plex Media Server" ) to it, then use:

iocage fstab -a plex /mnt/tank1/apps/plex /config nullfs rw 0 0

to put that data into the jail.

Then make sure your permissions are good as described in the resource and you're all set.

Thank you so much for that information. This is exactly what I have been wanting to do.

As soon as my wife comes home in a couple of hours to help watch our son then I will give this a shot. Fingers crossed.
 

ryanakata

Explorer
Joined
Jul 26, 2015
Messages
62
Actually got my son to sleep by a miracle somehow.

I recreated the jail and installed Plex.

I am now about to copy the entire plex folder over to my newly created config folder which is
Code:
/mnt/jailssd/apps/plex


Using the command
Code:
cp -Ripv -f "/mnt/jailssd/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/jailssd/apps/plex"


It prompted for an overwrite of the existing db so that's better than before and why I added the -f. As soon as this is done copying, I will start it up and hope it works.
 

ryanakata

Explorer
Joined
Jul 26, 2015
Messages
62
All is up and working. I had to mount the media to match my existing warden mounts. First post is being updated. Now to figure out how to update this thing to the latest release.
 

kypdurron5

Dabbler
Joined
Oct 18, 2018
Messages
19
I have found this copying of the plexdata server files via other sources and tried it multiple ways (including tar copy). However, every time I do the copy from the warden plexdata files to the iocage server the iocage server fails to load. It's not just that the iocage plex server fails to boot, it's that it seems to crash the entire thing on reboot including the GUI web interface. When I delete the iocage Plex and reinstall, it works just fine (obviously a blank Plex server though). I do the copy of plexdata files from old to new and nothing boots. Any suggestions?
 

sretalla

Hall of Famer
Joined
Jan 1, 2016
Messages
6,799
it seems to crash the entire thing on reboot including the GUI web interface
I think you're going to need to show us what commands you're using to copy it. If it's causing the whole FreeNAS server to stop booting properly, something isn't right.
 

kypdurron5

Dabbler
Joined
Oct 18, 2018
Messages
19
I think you're going to need to show us what commands you're using to copy it. If it's causing the whole FreeNAS server to stop booting properly, something isn't right.
No, no. It's not freezing the entire freenas server or even the jail. I can start the jail from CLI or GUI just fine. It's just that when I copy the plexdata from one server (warden) to the next (iocage), the iocage version of PLEX fails to load. But it's both the plex server as well as the plex GUI that fails to load (iocage version). It's just dead until I delete and reinstall the iocage version without copying files. I've used the cp -Ripv from this forum, a more simple -R, and a tar copy command. All have the same result; copying the old plexdata folder to the new plexdata folder seems to break plex. Until I delete and reinstall the plugin; then it works great, I just don't have my old metadata/folder structure/watched files marked/covers, etc. I've ensured that I'm copying the folder structure correctly and the permissions under warden are slightly more liberal than the default iocage files, so while it could be a permissions issue, it doesn't look like it. I've also added my media folder with the same target destination old vs. new; but this doesn't seem to make a difference either way.
 

sretalla

Hall of Famer
Joined
Jan 1, 2016
Messages
6,799
Ok, but I think the next step is still to share what you are copying exactly (including how) and show how your mounts are set in the old and new jails.
 

kypdurron5

Dabbler
Joined
Oct 18, 2018
Messages
19
Code:
cp -Ripv "/mnt/zfsdrive/jails/plexmediaserver_1/var/db/plexdata/Plex Media Server" "/mnt/iocage/jails/plex/root/usr/local/plexdata/Plex Media Server"


Sure, but this is just a copy of the exact copy command on this thread minus the name of my zpool. As for the mount; it doesn't matter whether I set it or not, the result is the same. However, in both cases my NAS "media" folder is mapped to /media (under warden /mnt/zfsdrive/jails/plexmediaserver_1/media, under iocage /mnt/iocage/plex/root/media).
 

sretalla

Hall of Famer
Joined
Jan 1, 2016
Messages
6,799
Ok.

So what user are you running plex as in iocage? And does that user have rights to the new copied files? (You may need to run chown -R on it inside the jail)
 
Status
Not open for further replies.
Top