Jail Permissions Messed Up - Best Way To Re-Jail with Fixed Permissions?

Chris Dill

Contributor
Joined
Jan 1, 2014
Messages
116
I have a Plexmediaserver-Plexpass plugin installed, which is in its own iocage Jail on Freenas 11.3-U5. Permissions got messed up somewhere, and I need to get my Plex server back up and running without having to rebuild from scratch. This thing was a pain to setup, since it was the second Plex in my network.

Is there a way to fix permissions?

If not, is there a way for me to move my Plex to a new jail and restore a config, or is that basically building from scratch?

Here are the permission issues:

When logging into the Plex jail from console: https://i.imgur.com/vo7PP0J.png
When logged into the jail root: https://i.imgur.com/j38UdG0.png

I am pretty sure I know what happened, I think I ran some ACL commands on the jail root file system from FreeNAS root in order to fix Windows nonsense- I can't confirm this but I think its what took place.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
When logging into the Plex jail from console: https://i.imgur.com/vo7PP0J.png
When logged into the jail root: https://i.imgur.com/j38UdG0.png
Don't attach images from outside, just put them in the post itself. That way they won't be missing at some point in the future if somebody looks at this post.

Also, don't take a screen shot of text... it's much better to post the text itself so people can copy/reply to it in context easily.

The first thing to ask is if you're running snapshots... reverting to a snapshot from before the "event" when the permissions were badly adjusted would be the simplest way to get everything back.

Is there a way to fix permissions?
Maybe, but as you can see from the second screen you shared, there needs to be different permission levels for some of the files, so it's going to be painful.

If not, is there a way for me to move my Plex to a new jail and restore a config, or is that basically building from scratch?
Actually that's best-practice jailing. You should really never have anything of value in the jail root filesystem, it should always be in a mount, so you can just swap out the jail and mount the same paths and your jail is running as normal.

In order to transition to that, you need to find the Plex library (it's a directory called "Plex Media Server") and can either be living in /config (where I would recommend mounting it eventually), directly in the root of the jail / ... maybe elsewhere, but unlikely if you run the plugin.

once you copy that to something like /mnt/pool/apps/plex, you then mount it into an empty directory in the jail like /config then set it to be owned by the plex user and point plex to use it
iocage exec plex mkdir -p /config
iocage fstab -a plex /mnt/pool/apps/plex /config nullfs rw 0 0
iocage exec plex chown -R plex:plex /config
iocage exec plex sysrc plexmediaserver_plexpass_support_path="/config"

Whatever you do, don't delete your jail while it's named anything like your other jail(s)... rename it first to something like delete_me. There's a bug in iocage which deletes all other similarly named jails when you are trying to delete one.
 

Chris Dill

Contributor
Joined
Jan 1, 2014
Messages
116
So, I tried to make a new jail, and it failed- even other plugins. Maybe permissions got messed up on the root freenas, though that seems unrealistic since I only messed with Mount ACLs.

I do have snapshots... But I moved an entire 3TB library into Plex since then, will restoring my snapshot render that undone?

I also have freenas config backups from before the issue, but that restoration will not fix file permissions correct? So rebuild from scratch, restore config, rebuild jail, and then restore snapshot? Sounds like pain.
 
Last edited:
Top