(Linux) Automatic library updates are now triggered by filesystem permissions and ownership changes (#14045)
… this is killing my server. Every hour I have a cron job that does a ‘chmod 755’ on all my media because every now and then, I’ll add something and the permissions get screwed up on the copy. So my cron job comes around every hour and does its’ magic and everything always shows up in Plex.
With this new add, my server refreshes all my libraries (and thousands and thousands of files) every hour and navigating around in the console is super slow during this time.
Something needs fixed on your end. You shouldn’t need to run that script in the first place is everything was ‘correctly done’. I would look into your process and figure out why the permissions are not what they should be in the first place.
While Ford’s solution will work, I would highly encourage you to figure out why you need to do this in the first place. That permission cronjob is a band-aid ‘hack fix’ instead of ‘fixing the real issue.’ Sure, it works for you, but you shouldn’t even need to do that if things were ‘correct’.
How are you adding those files? I used to have that problem long time ago with Sonarr/Radarr, but I fixed it by fixing the permissions in Sonarr/Radarr itself after doing the copy.
While I -do- have Sonarr and Radarr set to change file permission to 755 … on rare occasions (and for whatever reason), they don’t do it all the time. It works 99% of the time but sometimes, files fall through the cracks.
Or, if I manually download something and copy it into my movie folder, it won’t have the ‘execute’ bit set and Plex won’t see it until I fix that. I know, I know… the Plex support link about Linux permissions doesn’t list the execute bit as needed…so long as Plex has read access to the file, it will see it. Unfortunately, it doesn’t work that way for me. The overwhelming majority of times, Plex does indeed need just read permissions on the file but on super duper rare occasions, it won’t see a file until I make it executable. I don’t want to go down that rabbit hole … my chmod cron job was working perfectly and all media was showing up just fine. Just need to figure out a way to get back on track.
Every… and I mean EVERY time I mess with setGID/sticky bits I somehow make matters worse. lol
When i first started using Linux and Plex (and didn’t have a full grasp of file permissions and inheritance), I played around with those commands and spent a few frustrating hours trying to get it right. I wasn’t using the guide you linked to so maybe a few years of experience and having a better understanding of things will make it better this time around? But, I’m like lightning… I prefer the path of least resistance. If I can get my cron job back up and running, I’ll probably stop there. If that it too difficult, back to sticky land.
Nothing special… I just go to web site XYZ and download a file and copy it into the appropriate media folder and the execute bit needs set. Other times, Sonarr/Radarr fail on setting the 755 file permission even though they’re configured to do it.
Say i add 20 media files to my Plex server every day, 7 days a week. Odds are ONE of those files will need their permissions fixed. It happens enough where it was a minor nuisance and my simple cron job caught the strays.
See first post in thread. OP wrote that unconditionally setting permissions results in Plex re-scanning the libraries. Checking first, and changing only when necessary, will hopefully avoid unnecessary scans.
You shouldn’t even need to do this. Even if you run them in docker, you can pass the uid/gid it will use, everything created under the container will have that id. If you use linuxserver containers, add PGID=1000, PUID=1000 to the env vars (or w/e your uid is)
You shouldn’t need to use the ‘bandaid’ chmod feature in sonarr/radarr either. None of that should be needed for the vast majority of setups use-cases.
Now that you have a temp fix. I would highly recommend fixing your setup so you don’t need to modify permissions at all. You can run docker, radarr, sonarr, rclone, mergerfs, etc as a user so no permissions need to be changed at all by script or by radarr/sonarr/sab, etc themselves.
Thats just a bandaid on a problem that can be fixed in a better way.
I have no doubt it can be fixed better but I detest dockers (tried to set things up before using them and had bizarre problems) and I’m OK with my band-aid solution. For now.