Failing to Update Plex Media Server plugin on TrueNas

TrueNAS Server Version#: TrueNAS-13.0-U3.1
Plex Media Server Version#: 1.30.1.6497

Hi all, I’d really appreciate any help with this problem. For ages now, I haven’t been able to update the plexmediaserver plugin on my TrueNAS box. I’m using the following shell commands and keep getting the error “Not Found” when trying to execute the fetch command. These steps were working for me for a while however, it’s stopped about a month or two ago and not sure what to do.

jls
jexec 1 csh - replace 1 with the jail number

pkg install ca_root_nss
pkg install wget
pkg install perl5

fetch -o PMS_Updater.sh https://raw.githubusercontent.com/luluhoc/PMS_Updater/master/PMS_UpdaterPLEXPASS.sh
chmod 755 PMS_Updater.sh
./PMS_Updater.sh -vv -a

Don’t use random scripts you found online. Install Plex from Ports or pkg-ng instead. Will probably need to make a new jail and transfer your data over to do that now.

I don’t know how to do that. Can you provide any guidance?

Note: for the Plex Pass version the package name you want is “plexmediaserver-plexpass” instead. Those instructions were specifically for the plain version since that person did not appear to be a pass-subscriber.

Also, the commands referencing the service will need to be changed to add “_plexpass” for an install using the Plex Pass version. So:

iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES"
for example on that one.

See the original TrueNAS form post I reference at the bottom. My instructions are the same, they just omit trying to move the server data storage to a different pool since it’s not a necessary action.

Moving the data from your old server over isn’t hard, but you need to make all the mount points on the new jail the same as the old one for it to be most successful. I can post that later.

Thank you for the help with this. Unfortunately, this didn’t seem to work for me and I didn’t get very far either. Shell isn’t one of my strengths.

After running the following commands:

root@freenas[~]# echo ‘{“pkgs”:[“plexmediaserver_plexpass”,“ca_root_nss”,“nano”]}’ > /tmp/pkg.json

root@freenas[~]# iocage create -n “plexpass” -p /tmp/pkg.json -r 13.1-RELEASE ip4_addr=“vnet0|192.168.0.15/24” defaultrouter=“192.168.0.1” vnet=“on” allow_raw_sockets=“1” boot=“on”

Here is the response. There are a few errors as you’ll see.

plexpass successfully created!

Testing Host DNS response to pkg.freebsd.org
Testing plexpass’s SRV response to pkg.freebsd.org
Testing plexpass’s DNSSEC response to pkg.freebsd.org
pkg.freebsd.org could not be reached via DNSSEC.

Testing plexpass’s DNS response to pkg.freebsd.org

Installing pkg…

Installing supplied packages:

  • plexmediaserver_plexpass…
    pkg: No packages available to install matching ‘plexmediaserver_plexpass’ have been found in the repositories

    • plexmediaserver_plexpass failed to install, retry #1
      pkg: No packages available to install matching ‘plexmediaserver_plexpass’ have been found in the repositories
    • plexmediaserver_plexpass failed to install, retry #2
      pkg: No packages available to install matching ‘plexmediaserver_plexpass’ have been found in the repositories
    • plexmediaserver_plexpass failed to install, retry #3
  • ca_root_nss…
    =====
    Message from ca_root_nss-3.86:


FreeBSD does not, and can not warrant that the certification authorities
whose certificates are included in this package have in any way been
audited for trustworthiness or RFC 3647 compliance.

Assessment and verification of trust is the complete responsibility of the
system administrator.

This package installs symlinks to support root certificates discovery by
default for software that uses OpenSSL.

This enables SSL Certificate Verification by client software without manual
intervention.

If you prefer to do this manually, replace the following symlinks with
either an empty file or your site-local certificate bundle.

  • /etc/ssl/cert.pem
  • /usr/local/etc/ssl/cert.pem
  • /usr/local/openssl/cert.pem
  • nano…
    No default gateway found for ipv6.
  • Starting plexpass
    • Started OK
    • Using devfs_ruleset: 1000 (iocage generated default)
    • Configuring VNET OK
    • Using IP options: vnet
    • Starting services OK
    • Executing poststart OK

I think you mixed up my notes. :wink:

The package name is hypenated, but it’s an underscore when it’s named as a service (likely a limitation in use of the dash characters there).

Here’s how it looks when I run a check for updates:

root@plex-5:/ # service plexmediaserver_plexpass stop
Stopping plexmediaserver_plexpass.
Waiting for PIDS: 59374, 59374.
Cleaning up leftover child processes.
Waiting for PIDS: 59397 59532 92062 59466 59498, 59397.
root@plex-5:/ # pkg update
Updating FreeBSD repository catalogue...
[plex-5] Fetching packagesite.pkg: 100%    6 MiB   6.8MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 32415 packages processed.
All repositories are up to date.
root@plex-5:/ # pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
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.19.1 -> 1.19.1_1

Number of packages to be upgraded: 1

The process will require 24 MiB more space.
8 MiB to be downloaded.

Proceed with this action? [y/N]:

If you have the new jail up and running now you can just go in and try again from inside the jail.
Just run open the shell for the new jail and run pkg install plexmediaserver-plexpass there.

And now you can leave off the “iocage” prefixed on the commands. So:

sysrc "plexmediaserver_plexpass_enable=YES"
To set the server to autorun when the jail starts in the future.

service plexmediaserver_plexpass start
To manually start it now.

And you can log in to see if it’s running at that point.

You can’t edit the mount points with the jail running so you’ll need to shut the whole thing down to do that. Might want to make any directories you need to link to while you’re in there, first.

This process was written for FreeNAS but I just used it this weekend and it still works flawlessly. Update Plex – FreeNAS 11.3 | virtual.mvp

Thank you so much for all the help. All up and running and working perfectly now! I really cant thank you enough.

When you have time, it would be great to get some direction on moving how to migrate usage data across to the new plugin. The mount points in the new plugin are identical to the old one.

See here:

First you want to stop the server process on both the Plex servers (so it’s not making changes to the data while you are transferring it).

The location of the plexdata-plexpass folder is slightly different on the plug-in install of Plex. I can’t find the post right now, but someone else with a similar question mentioned were they found it in a post somewhere. But that’s the name of the folder.

Make the tar archive from the directory as mentioned in that post.

You need to use the shell on the main TrueNAS system to copy the archive to the new jail (since you’re moving a file between two separate jails).

cd /mnt/JAILDRIVE/iocage/jails/OLDPLEXJAIL/LOCATION/OF/OLD/SERVERINFO

cp plexdata-plexpass.tar /mnt/JAILDRIVE/iocage/jails/NEWPLEXJAIL/root/usr/local

and expand the archive back into the normal directory:

tar -xvf plexdata-plexpass.tar

Make sure permissions are correct:

chown -R plex:plex plexdata-plexpass

And then restart the Plex server on the new jail:

service plexmediaserver_plexpass start

Since your mount points are all the same, the server should find all your media in the same places. You may want to sign out the server from your Plex account and sign back in to refresh the SSL cert stuff since you copied it from another Plex server. But that should be it. Obviously this works best when both Plex servers are on the same server version, but I assume Plex will just update the database and such as needed if the previous server was a bit behind, like with any PMS upgrade.

[ref]

Yep, that’s good advice. I keep a full back-up of my media on an external USB HDD.

I can easily add the media library locations (Movies, TV, Music) via the GUI for the newly installed plexmediaserver plugin. What I’m concerned about losing is all the user history of what’s been watched, etc. Is there a way to migrate that across to the new server plugin?

That’s what the plexdata-plexpass folder is – your server.
It has all the metadata, posters, backgrounds, library entries and the watch history for the server. So when you boot the new PMS on the new jail after transferring things over, everything will be the same like “Continue Watching” and all, too. Except the PMS will be a newer version. So you don’t want to start the old instance up again.

The ports/pkg release of Plex is also done by a volunteer maintainer, too. But it’s better maintained than the plugin is. You can check what the current release is here. Once the port has been updated by the maintainer the pkg release you use is built (and it’s automated I believe). The delay is 7-10 days after the port commit. That big table is the current status of the pkg release. So, if you hadn’t changed the packages to LATEST with the document you made in nano, the newest version of Plex you could install with pkg is 1.30.1.6497 from Quarterly, not the 1.31.1.6733 on Latest.

Every time iXSystems releases a new major release of TrueNAS (like when they went from 12 to 13), I can’t get the old jails created with FreeBSD 12 to upgrade to 13 like the directions on the forum explain. So I just make a brand new FreeBSD jail of the newer kernel jail and transfer my server over just like this.

Once you make sure the new server is running all fine you can just trash the old plugin/jail.

Oh okay, I think I understand. So I found the plexdata-plexpass folder, it’s in the following location /mnt/red1/iocage/jails/plex/root/usr/local/plexdata-plexpass. That folder has both the original and new Plex installs. What’s weird is the original Plex install folder path is blank however, the new one (following your guide) is full.

Original install

New install

Unsure what is going on here. It cant be a permissions issue as I’m logged in as root.

Does this look strange to you?

Not sure what you mean by this.
The new Plex Server should be a brand new jail. Not the same jail as the old plugin install made.

In your earlier post you showed this too. You named the new jail “plexpass” in that post. Your jail in these screenshots is just named “plex”.

The views are different because they are different directories. Inside the plexdata-plexpass folder is two folders, one named Plex and the other named Plex Media Server. I have the same thing here.

Anyway, back up to /local/ and run this command:

tar -cvf plexdata-plexpass.tar plexdata-plexpass

That will create a tar archive out of the plexdata-plexpass folder (it will not remove the original files). Then copy that archive to your new Plex server jail. So I guess based on your posts/screenshots that is:

cp plexdata-plexpass.tar /mnt/red1/iocage/jails/plexpass/root/usr/local

Then you can jump over there,
cd /mnt/red1/iocage/jails/plexpass/root/usr/local

expand the copied archive back into a folder,
tar -xvf plexdata-plexpass.tar

make sure permissions are correct:
chown -R plex:plex plexdata-plexpass

And start back up the new Plex server on the new jail:
service plexmediaserver_plexpass start

Ahhh thank you for pointing that out, yep, I was in the original jail. Found the new one and will give these steps a try.

Out of curiosity, do you know if the “migration” will work by simply copying and pasting the plexdata-plexpass folder using WinSCP?

Don’t do that. The reason we’re archiving it is to reduce the copy operation down. If you try to copy the files themselves it will take much, MUCH longer to run because of all the file system changes. Also tar archives have checksumming for file integrity I think, so expanding the copied archive will help us ensure nothing silly happens to any of the files.

Edit: maybe only checksumming with certain flags. Anyway, this is more about making the operation faster.

Perfect, well almost perfect. I seem to be getting an illegal group name issue when making sure the permissions are correct.

What am I doing wrong?

I’m not sure you are doing anything wrong here. When pkg installed Plex Media Server the user account “plex” and group “plex” were made. If you’re running the command from the TrueNAS shell and don’t have a “plex” group there that would explain it. You can just do it from inside the new jail’s shell and it should work then.

I was running the commands in a session using Terminus (separate desktop application), I find it’s a good app. I had a look at the accounts setup and there is no group or user with the name plex, so I take it that’s part of the issue, the other part not using the shell in TrueNAS. I’ll give it another go using shell directly from TrueNAS however, before I do. I checked the permissions from the original directory/server and they were all set to root:wheel - see below.

image

The permissions for the new directory/server are the same - see below.

image

So I guess the question I have is, given the new server is up and running perfectly, the data has been migrated across successfully, why do the permissions need to be changed to plex: plex and obviously creating a new group and user?

It’s worth noting you’re looking at the directory contents of /local right now.
I’m talking specifically about plexdata-plexpass and its contents.

The files are the Plex server data, and therefore include the database files and metadata for the server content. Plex would need to be able to update these files as you gain more server content, download posters, and edit tags on stuff, etc. Plex Media Server runs as the user “plex” and would need the ability to write to those files. Besides the normal full access to the file’s owner, your permissions right now include read and execute access for Group and Everyone (755 is that mask I believe). So Plex can read the files as they are when they were copied but cannot modify them.

TAR is supposed to maintain ACL’s I believe, so I don’t know if the applying of the chown here is absolutely necessary, I just see it as a Good Idea™ to avoid issues later if something got created by the untarring that has the wrong owner/group.

As far as the old server, if all the files in the plexdata-plexpass folder are root/wheel, it’s possible whoever made the plugin has Plex running as root (really not a good idea security-wise). But the pkg install runs as the user “plex” is the point here. If you were reading the messages when pkg installed it, it told you it was creating the user “plex” and group “plex” on the jail as part of the process. That’s why you’re having this issue trying to run chown command from the TrueNAS system’s jail, which is a whole different user and group database.

It’s the same issue people have when they are setting up a new server and for some reason PMS is not seeing the movies and TV shows they have on their storage pools. The files were uploaded via SMB or FTP and have the owner as the name of the user. I get around this by having an auxiliary ACL for the group “plex” added to my Windows file shares so files I upload get access to the group plex added, and therefore Plex Media Server can access them even though the files are still owned by me.

Edit: You’re fine to use Termius, btw. It’s what I use on my Macbook when doing stuff on the the TrueNAS system. You just have to be in the shell specific to the jail. When you connect over SSH you’re working in the TrueNAS system when you first log in. You can access the shell for the jails from it the same way you would if you were typing away on the shell on the TrueNAS GUI.

jls

Find your new Plex jail on the list and note the jail ID number (first column).

jexec JAILIDNUMBER tcsh

The ID numbers are assigned incrementally in the order the jails are launched. So if you stop and relaunch a jail the ID number will change, and if you reboot the entire TrueNAS system the numbering will reset.

That also means when you are using Termius (or any SSH client) you need to exit twice to leave the shell gracefully. Once to exit the jail shell you were in and return to the TrueNAS shell, and again to leave TrueNAS.

Oh right. I just checked the permissions for both the old and new jails and they are both root: wheel.

Original Plugin
image

New Plugin
image

So based on what you are saying, when I installed the new plugin, it should have set the premissions to plex:plex for the plexdata-plexpass folder? Odd that it didn’t. I’m not sure what I did wrong there.

I’d like to address the security concern you have highlighted however, unsure how to fix it. Is the solution to create a new user and group using the TrueNAS GUI. Following create a new Windows Share (SMB) via the GUI specifically for plex? If so, I’m assuming the path should be just the plexdata-plexpass folder in the new jail, so in my case that would be:
/mnt/red1/iocage/jails/plexmediaserver/root/usr/local/plexdata-plexpass.

or should I just try to reinstall and migrate again?