DMS 7.1: Delete not working when Plex is running in a Docker container

Server Version#: 1.26.2.5797
Player Version#: 4.82.1

With Chuck’s help, I managed to get Plex running in a Docker container on my Synology running DSM 7.1. I was excited because I was also able to get hardware transcoding working. However, I think I found a problem with being able to delete media from the Plex web interface. It always fails now.

Thinking in terms of Docker I went into the container where I remembered that inside the container, processes are run as the “plex” user and the UID of that user is 297536 in my case, whereas the files are owned by the 1000 user (in general my username andrew).

Jupiter:docker exec -u 297536 -it plex bash
plex@Jupiter:/$ ls -l /Videos/Movies/Top\ Gun\ Maverick\ \(2022\).mkv 
-rw-rw-r-- 1 1000 1000 1510211584 May 27 15:18 '/Videos/Movies/Top Gun Maverick (2022).mkv'
plex@Jupiter:/$ rm /Videos/Movies/Top\ Gun\ Maverick\ \(2022\).mkv
rm: remove write-protected regular file '/Videos/Movies/Top Gun Maverick (2022).mkv'? y
rm: cannot remove '/Videos/Movies/Top Gun Maverick (2022).mkv': Permission denied
plex@Jupiter:/$ 

Is there a way to configure this such that I can use the convenient Delete option within the Plex web client?

Control Panel - Shared Folders

EDIT “Videos” shared folder.

Give UID/GID (username), which should be PlexMediaServer, you run the container as Permission to R/W the shared folder.

Make certain to “Apply to this folder, sub-folders, and files” so the permission propagates all the way down.

I don’t have a Videos shared folder rather I have a Media shared folder under which is Videos, Pictures, and Music.

The user PlexMediaServer has Read/Write access already

I didn’t see a way to reapply the R/W permissions to all sub-folders and files.

NOTE:

In Settings - Library , Don’t forget to enable “Allow media deletion” and click SAVE

You can also access it from FileStation – Left Panel.

  1. Highlight Videos
  2. Properties
  3. Permissions

Settings > Library has Allow media deletion set:

Permissions from File Station also set:

No. Didn’t even know Synology provided one. Under /volume1 I make a directory called Media with Videos, Pictures and Music under it then filed it with my stuff.

That’s good. The more you do for yourself, the better.

There have been conflicts between VideoStation, AudioStation, and PhotoStation with Plex due to how Synology overwrites permissions on a frequent basis in the “Video” shared folder

Are you trying to delete media as the owner / adminstrator or a managed user?

I don’t think managed users can delete.
I know shared users can’t delete media

I assume you mean when I log into Plex. I’ve only ever logged into Plex as my one user, which owns the server. Note that at one time delete from the Plex web was working, then I switched to the docker thing and it hasn’t worked since.

This is not a real big deal as I’m well versed in the rm(1) command and usually access my files on Plex (under an NFS mount of plex_server:/volume1/Media) when I want to manipulate files (I’m doing a big run of Tdarr right now compressing my files). But it would be nice if delete from the Plex web worked again.

Are the files you’re trying to delete in the local filesystem or are they NFS mounted?

Remember, you still must satisfy NFS permissions to delete something … otherwise the mount will be as “nobody:nobody” which can, at best, read-only

Well through delete from the Plex web page I’m not sure what user is in play.

From my Ubuntu desktop, they are NFS mounted.

Sometimes I manipulate files by ssh’ing into my Synology.

no_root_squash - root can be root over NFS:

Jupiter:sudo cat /etc/exports
/volume1/homes	192.168.0.0/24(rw,async,no_wdelay,no_root_squash,insecure_locks,sec=sys,anonuid=1025,anongid=100)
/volume1/Media	192.168.0.0/24(rw,async,no_wdelay,no_root_squash,insecure_locks,sec=sys,anonuid=1025,anongid=100)
/volume1/downloads	192.168.0.0/24(rw,async,no_wdelay,no_root_squash,insecure_locks,sec=sys,anonuid=1025,anongid=100)
/volume1/System	192.168.0.0/24(rw,async,no_wdelay,no_root_squash,insecure_locks,sec=sys,anonuid=1025,anongid=100)
Jupiter:

give me a few to experiment please. I’m going to cross mount a few things and see what happens :smiling_imp:

Do me a favor?

  1. List the contents of one mounted directory from the Linux side.
  2. Now SSH into the Syno and list that same directory.

On the Syno ssh, you should see the ACLs attached,

chuck@ds418:/volume1/Animated$ ls -la
total 432
drwxrwxrwx+ 104 chuck root 4096 Jun 25  2020  .
drwxr-xr-x   48 root  root 4096 May 27 21:03  ..
drwxrwxrwx+   2 chuck root 4096 Feb  8  2018 'Aladdin (1992)'
drwxrwxrwx+   2 chuck root 4096 Sep 23  2017 'Alvin and the Chipmunks (2007)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Alvin and the Chipmunks Chipwrecked (2011)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Alvin and the Chipmunks The Road Chip (2015)'
drwxrwxrwx+   2 chuck root 4096 Aug 11  2018 'Alvin and the Chipmunks The Squeakquel (2009)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Atlantis The Lost Empire (2001)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Bambi (1942)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Beauty and the Beast (1991)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Boundin'\'' (2003)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Brave (2012)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'BURN·E (2008)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Cars (2006)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Cars 2 (2011)'
drwxrwxrwx+   2 chuck root 4096 Feb  8  2018 'Cars 3 (2017)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Day & Night (2010)'
drwxrwxrwx+   2 chuck root 4096 Mar 11  2018 'Despicable Me (2010)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Despicable Me 2 (2013)'
drwxrwxrwx+   2 chuck root 4096 Feb  8  2018 'Despicable Me 3 (2017)'

From NFS on the workstation, you won’t.

root@lizum:/home/chuck# ls -la /mnt3
total 424
drwxrwxrwx 104 1026 root 4096 Jun 25  2020  .
drwxr-xr-x  31 root root 4096 May 26 00:53  ..
drwxrwxrwx   2 1026 root 4096 Feb  8  2018 'Aladdin (1992)'
drwxrwxrwx   2 1026 root 4096 Sep 23  2017 'Alvin and the Chipmunks (2007)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Alvin and the Chipmunks Chipwrecked (2011)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Alvin and the Chipmunks The Road Chip (2015)'
drwxrwxrwx   2 1026 root 4096 Aug 11  2018 'Alvin and the Chipmunks The Squeakquel (2009)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Atlantis The Lost Empire (2001)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Bambi (1942)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Beauty and the Beast (1991)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Boundin'\'' (2003)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Brave (2012)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'BURN·E (2008)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Cars (2006)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Cars 2 (2011)'
drwxrwxrwx   2 1026 root 4096 Feb  8  2018 'Cars 3 (2017)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Day & Night (2010)'
drwxrwxrwx   2 1026 root 4096 Mar 11  2018 'Despicable Me (2010)'
drwxrwxrwx   2 1026 root 4096 Sep 17  2017 'Despicable Me 2 (2013)'
drwxrwxrwx   2 1026 root 4096 Feb  8  2018 'Despicable Me 3 (2017)'

Since everything on the Syno is driven by ACLs, and PlexMediaServer is a non-privileged user, any filesystem activity which clears the ACL (you modifying files from the NFS side) will block Plex from having the assigned “DSM permissions”.

The file access will resort (in Syno’s words) to “Linux mode”.

When the ACLs are intact to permit writing (deletion) then you’ll be able to delete the file(s).

This was so much easier in DSM 6. It’s been made overly secure in the DSM 7 redesign. (IMHO)

Here is it happening.

root@lizum:/mnt3# chmod 755 Your\ Friend\ the\ Rat\ \(2007\)/
root@lizum:/mnt3# ls -la Your\ Friend\ the\ Rat\ \(2007\)/
total 500188
drwxr-xr-x   2 1026 root      4096 Jun 25  2020  .
drwxrwxrwx 104 1026 root      4096 Jun 25  2020  ..
-rwxrwxrwx   1 1026 root         0 Jun 25  2020  stuff
-rwxrwxrwx   1 1026 root 512174762 Jul 28  2012 'Your Friend the Rat (2007).m4v'
root@lizum:/mnt3# 

On the Syno, we find:

drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Toy Story 3 (2010)'
drwxrwxrwx+   2 chuck root 4096 Aug  6  2018 'Woody Woodpecker'
drwxr-xr-x    2 chuck root 4096 Jun 25  2020 'Your Friend the Rat (2007)'
chuck@ds418:/volume1/Animated$ 

At this point, Only ‘chuck’ and ‘root’ have permission. ACLs have been removed.

I’m starting to think you’re not impressed with DSM 7.x! :rofl:

Jupiter = Synology PMS:

Jupiter:ll /Videos/
total 0
drwxr-xr-x  1 andrew defaria    262 Apr 19 06:48  ./
drwxrwxrwx+ 1 andrew defaria    108 May 19 21:18  ../
drwxr-xr-x  1 andrew defaria    922 May 22 11:19  4k/
drwxr-xr-x  1 andrew defaria   1448 Mar 16 11:38  Concerts/
drwxr-xr-x  1 andrew defaria   3366 Mar 25 14:59  Documentaries/
drwxr-xr-x  1 andrew defaria   1032 Mar 16 14:43  Family/
drwxr-xr-x  1 andrew defaria    138 Sep 21  2020  HomeMade/
drwxr-xr-x  1 andrew defaria   3544 Oct  2  2020  Lectures/
drwxr-xr-x  1 andrew defaria     94 Mar 16 13:57  Miscellaneous/
drwxr-xr-x  1 andrew defaria 336612 May 27 17:21  Movies/
...
Jupiter:

Earth = Ubuntu desktop:

Earth:ll /Videos/
total 0
drwxr-xr-x 1 andrew defaria    262 Apr 19 06:48  ./
drwxrwxrwx 1 andrew defaria    108 May 19 21:18  ../
drwxr-xr-x 1 andrew defaria    922 May 22 11:19  4k/
drwxr-xr-x 1 andrew defaria   1448 Mar 16 11:38  Concerts/
drwxr-xr-x 1 andrew defaria   3366 Mar 25 14:59  Documentaries/
drwxr-xr-x 1 andrew defaria   1032 Mar 16 14:43  Family/
drwxr-xr-x 1 andrew defaria    138 Sep 21  2020  HomeMade/
drwxr-xr-x 1 andrew defaria   3544 Oct  2  2020  Lectures/
drwxr-xr-x 1 andrew defaria     94 Mar 16 13:57  Miscellaneous/
drwxr-xr-x 1 andrew defaria 336612 May 27 17:21  Movies/
...
Earth:

Ah so apparently I don’t have the proper ACLs on. That would explain it I guess. The question then is how do I get proper ACLs on the Plex store?

Me?

Not impressed with DSM 7 ?

How dare you say such a thing! :scream:

:rofl:

How do you assert the permissions again? Just as I showed you
File Station → Properties → Permissions → Change permissions if required →

Apply to this folder, sub-folders, and files

SAVE

DSM will now reapply the ACLs to all files and folders in the directory.

Giving us back our

drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Toy Story (1995)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Toy Story 2 (1999)'
drwxrwxrwx+   2 chuck root 4096 Sep 17  2017 'Toy Story 3 (2010)'
drwxrwxrwx+   2 chuck root 4096 Aug  6  2018 'Woody Woodpecker'
drwxrwxrwx+   2 chuck root 4096 Jun 25  2020 'Your Friend the Rat (2007)'
chuck@ds418:/volume1/Animated$ 

To be clear (for future readers):

  1. Started File Station (I rarely use File Station)
  2. Right clicked on Media (Videos, Pictures and Music are under this)
  3. Select Permissions
  4. The user PlexMediaServer already has Read & Write permissions!
  5. Selected PlexMediaServer anyway and clicked on Edit. I now see:

Note that all of Read and Write are checked. I can see that This folder, Child folders, Child files, and All descendants are already checked.
6. There is no Save but there is a Done. Clicking on it does nothing but close the dialog box.

Wait! This Apply to this folder, sub-folders and files check box is on the Edit Shared Folder Media dialog box. Well, that’s a strange place to put that! One would think UI/UX-wise that that would appear on in individual User’s settings.

For future reference here’s where that toggle is:

Ah so now it’s applying properly. This will take a while…

Seems to be working now:

Jupiter:ll /Videos/
total 0
drwxrwxrwx+ 1 andrew defaria    262 Apr 19 06:48  ./
drwxrwxrwx+ 1 andrew defaria    108 May 19 21:18  ../
drwxrwxrwx+ 1 andrew defaria    922 May 22 11:19  4k/
drwxrwxrwx+ 1 andrew defaria   1448 Mar 16 11:38  Concerts/
drwxrwxrwx+ 1 andrew defaria   3366 Mar 25 14:59  Documentaries/
drwxrwxrwx+ 1 andrew defaria   1032 Mar 16 14:43  Family/
drwxrwxrwx+ 1 andrew defaria    138 Sep 21  2020  HomeMade/
drwxrwxrwx+ 1 andrew defaria   3544 Oct  2  2020  Lectures/
drwxrwxrwx+ 1 andrew defaria     94 Mar 16 13:57  Miscellaneous/
drwxrwxrwx+ 1 andrew defaria 336612 May 27 18:20  Movies/

Just gotta wait until the propagation finishes.

Once again, thanks Chuck!

Also for future reference-

I have the FAQ about how to do this.

Question: Will my manipulation of files from my Ubuntu desktop over NFS mess up the ACL’s on the files on the Synology?

For example, I just saw that from my Ubuntu desktop over NFS all the files went to 777:

Earth:ll /Videos/Movies/Zombie\ Strippers\ \(2008\).mkv 
-rwxrwxrwx 1 andrew defaria 452861363 Mar 21 19:00 '/Videos/Movies/Zombie Strippers (2008).mkv'*
Earth:

But I’ve never like having essentially data files being marked as executable. If I execute say:

Earth:find /Videos/ -type f -exec chmod 644 {} +

Will that then ruin all my ACLs?