Server Version#: 1.22.0.4163
Player Version#: 4.53.0
I’m having trouble getting plex to be able to write optimized files to disk. I followed this guide for permissions https://forums.plex.tv/t/automating-linux-permissions-using-inheritance-helps-dvr/198011
I’m running plex in a docker container with the same UID and GID as my plex user:group on linux. plex owns the folder and permissions are set to 775 yet when I try to optimize a file it states can’t write to disk. If I change permissions to 777 then it works. I think it’s some permission issue with the docker container. The container umask is set to 002 as well and rw has been added to each volume mapping. I’m entirely lost at this point. Any help would be appreciated. Also I can’t find any errors in the plex logs. Maybe I’m looking in the wrong place.
Can you provide the DEBUG log files which capture this happening please ?
Here is the associated section. I can post the entire file if you want it. So it is a permission issue I just don’t understand what is wrong with the permissions.
“Mar 12, 2021 10:40:20.670 [0x7fb644b8f700] DEBUG - MDE: Avengers: Age of Ultron (2015): selected media 0 / 1784513
Mar 12, 2021 10:40:20.671 [0x7fb644b8f700] DEBUG - Versions: version file path is “/data/Movies/Avengers Age of Ultron (2015)/Plex Versions/Optimized for Mobile/Avengers_ Age of Ultron (2015).mp4”
Mar 12, 2021 10:40:20.672 [0x7fb644b8f700] ERROR - Error creating directory “/data/Movies/Avengers Age of Ultron (2015)/Plex Versions/Optimized for Mobile”: Permission denied
Mar 12, 2021 10:40:20.672 [0x7fb644b8f700] ERROR - TranscodeJobManager: [Running] directory is not writable: “/data/Movies/Avengers Age of Ultron (2015)/Plex Versions/Optimized for Mobile”
Mar 12, 2021 10:40:20.672 [0x7fb644b8f700] DEBUG - BPQ: setOverrideState for generator 8601: failed/diskUnwritable
Mar 12, 2021 10:40:20.673 [0x7fb644b8f700] DEBUG - BPQ: generator 8601 changed state: pending → failed
Mar 12, 2021 10:40:20.673 [0x7fb644b8f700] DEBUG - BPQ: reprocessing requested while processing item
Mar 12, 2021 10:40:20.673 [0x7fb644b8f700] DEBUG - BPQ: onConsiderProcessing: Processing (true)
Mar 12, 2021 10:40:20.673 [0x7fb644b8f700] DEBUG - Versions: updating status for generator 8601
Mar 12, 2021 10:40:20.674 [0x7fb644b8f700] VERBOSE - Versions: generator 8601: failed/diskUnwritable with 0/0/0/1/0 item(s)”
can you jump into that shell,
walking the path as the PLEX_UID, PLEX_GID user,
and verify permissions at each level from /data → Optimized for Mobile ?
It’s complaining because it doesn’t have write access to when creating either “Plex Versions” or “Optimized for Mobile”.
Permissions are 775 from /data to Optimized for Mobile with 121 as the PLEX_UID and 130 as the PLEX_GID in the docker container which match Plex user and group id in linux of 121 and 130.
Thank you for helping out it’s much appreciated!
Should have also mentioned…
With container stopped (not mounted),
and with network share which is /data not mounted,
what are the permissions?
I ask because a common issue is:
- The Filesystem (after mounting) has the proper permissions.
- The mount-point itself does not. Everything stops there.
Can you show me the directory perms? (ls -la of the mount point before & after)?
I’d like to check and verify the suid/sgid are properly tagged in the perms fields.
(those will also bite when least expecting)
I’m not entirely sure I understand. The folder that is mapped in plex docker to /data is /media1/Media. That folder when the container is down has the same permissions as when it is up attached is a screen shot. I took two and they are the same. Are you looking for something different than that?
Also checked on the fstab entry for mounting and it mounts with defaults which should include rw and suid.
I’m not seeing / understanding what’s wrong here.
What you show me is correct.
It’s as if the container does not have RW permission.
I don’t use docker enough – might it be mapped RO by default?
What I’m referring to occurs when:
-
ls -la /somewhere/example– has the read-only permissions - mount nas:/media /somewhere/example
-
ls -la /somewhere/example– shows the right permissions because we’re in the file system.
What linux will often do is cut you off at /somewhere or /somewhere/example – BEFORE – getting into the mounted (mapped) file system.
So I checked the containers write permissions by opening a shell inside the plex container. If I go to a movie folder I can mkdir and touch a text file inside the container so it doesn’t seem to be a container problem. Which makes it more weird because if the container can write then all the permissions are correct and it’s a plex issue?
Not likely Plex. This is a Linux permissions issue. The difficulty is in finding it.
Which media directories are the optimization target ?
Is UID 911 trying to optimize into “videos” or “tvshows” or any other directories with group “plex” ?
/media1/Media/Movies/“Movienamefolder”/“optimizedversions folder”/optimized.mp4
That would be the directory that plex would use.
I’ve tried to optimize a tv show as well and also change the optimized file location to see if it will work elsewhere and it has not. How do I check if UID 911 is doing that?
I got UID 911 from your screenshot 
Dang you’re too fast. I just noticed that and changed my post haha. How do I check if UID 911 is doing that?
Is PMS in the container running as UID/GID 911?
I bet it is 
if that’s the case, either add it to the ‘plex’ group or change the GID of the container to be that of group ‘plex’ and then setgid bits will work – which is what you want?
How do I change the GID of the container? I thought I did that with docker compose setting PLEX_GUID=130
Not PLEX_GUID. Use PLEX_UID and PLEX_GID
Sorry I actually have that correct in my docker compose. it is PLEX_UID= and PLEX_GID=
Want to make this really easy?
Set PLEX_GID to that of Plex. It’s perfectly legal to use real Plex’s GID.
grep plex /etc/passwd | awk -F: '{print $4}'
the plex GID is set to 130 and is 130 on the host machine. the docker container however changes ownership of the plexdata config location to 911 I don’t really understand why. If I change ownership back to user:plex then plex will not show my library. Still narrows it down to docker permissions I think, but i’m completely lost as to why docker is using 911 instead of 1000:130
