Plex Librarys not updating even when i have deleted the files on the Harddisk.

Hi to all,

I have installed Plex on a VPS which i installed on Ubuntu 16.04 LTS BUT i encounter one major problem.

When i delete manually a movie… lets say i delete a movie from the ssh terminal or from within my FTP Client, then Plex isnt updating its movie Library. The movie is still there and when i want to play it spits out an error “Please check that the file exists and the necessary drive is mounted”. The Plex movie Library also marks all this movies as “Unavailable”. Why is Plex not updating its Library? I have deleted 15 movies and the movies still appear in the Library. I have done a “Refresh All” & “Empty Trash” already many times but Plex is not able to remove the movies from its Library. The only solution i found is deleting the Library and creating a new Library. But isnt it that Plex MUST update its Library if it notices a file change in the media Library? When a file is added it works fine… it recognizes it, downloads movie posters etc… BUT when i delete a movie or a file it isnt removing it from the Library… even when i do a Refresh All & Empty Trash the movies still appear there.

I also tried to set the “Library update interval” to be “every 15 minutes”. I also enabled BOTH options “Update my library automatically” & “Update my library periodically”. You can find this Option under Settings > Server > Library … Nothing helped!!! The above errors leads me to the conclusion that MAYBE something is going wrong with some file permissions? Does anyone else had the same problems?

Thanks in advance

George

There are a couple options under Settings - Server - Library to help you with this. Toggle once if needed. Enabling both of these will enable the kernel’s iNotify service. This tells PMS when any media files are modified. This triggers the appropriate update.

Update my library automatically
Your library will be updated automatically when changes to library folders are detected.

Run a partial scan when changes are detected
When changes to library folders are detected, only scan the folder that changed.

Having said that. Is the media local ?? Network shares, depending on how shared, don’t track across a network connection.

@ChuckPa said:
There are a couple options under Settings - Server - Library to help you with this. Toggle once if needed. Enabling both of these will enable the kernel’s iNotify service. This tells PMS when any media files are modified. This triggers the appropriate update.

Update my library automatically
Your library will be updated automatically when changes to library folders are detected.

Run a partial scan when changes are detected
When changes to library folders are detected, only scan the folder that changed.

Having said that. Is the media local ?? Network shares, depending on how shared, don’t track across a network connection.

I have already enabled all those options. I have set the options which are found under Settings - Server - Library as follows:

Update my library automatically - YES
Run a partial scan when changes are detected - YES
Update my library periodically - YES
Library update interval - every 15 minutes
Empty trash automatically after every scan - YES

I have set all this Options, restarted my Ubuntu 16.04 LTS Server. The problem remains. Plex recognizes a new movie when i add a movie into a Movies or TV Shows Library BUT when i delete manually a Movie from my terminal or with my FTP Client Plex continues to show the Movies in its Movie Library. When i try to play the movie where i know that the file is already deleted i get the error “Please check that the file exists and the necessary drive is mounted”. I also have waited the 15 minutes because the “Library update interval” interval is set to 15 minutes… Nothing … Nada… Movies Posters continue to be in my Movie Library. Anyone with the same problem?

P.S.: And yes the media files ARE local files.

Thanks in advance

George

My question: Where’s the movie media ? I know you delete it but where is it in relationship to PMS? Is it local? Is it over NFS; over CIFS ?

@ChuckPa said:
My question: Where’s the movie media ? I know you delete it but where is it in relationship to PMS? Is it local? Is it over NFS; over CIFS ?

When i create the Library after selecting the type, the second step is to select “Add Folders”. There you have to select “BROWSE FOR MEDIA FOLDER” where i enter my path to my media folder. For example the path to my Movies folder is "/home/mantax/media/movies … My Plex Media Server is located at /var/lib/plexmediaserver

Any clue? Have i done something wrong?

Thanks in advance

George

George,

You’ve not done something wrong but now it is making sense to me. Thank you.

Normal Linux security does not allow users to see each other’s directories. You are user mantax, PMS is user plex. The default Linux security (file permissions) do not allow PMS to see what you are doing in /home/mantax. Depending on the Linux you are using, it will sometimes make sure the security of your home directory is ‘secure’.

This is why I recommend creating a directory you and PMS can share. You own it, but PMS can always read it.

What I suggest is this (in a shell session):

sudo mkdir /home/media  /home/media/movies /home/media/tv         # You can make more as you need to
sudo touch /home/media/movies/dummy.file   /home/media/tv/dummy.file  # This will allow PMS to delete all the movies (including the last one) as you watch them.
sudo chown -R mantax  /home/media

Now, move the media from your home directory to this new shared location.

The last thing we need to do is set the permission so PMS can find your media here.

sudo find /home/media -type d -exec chmod 755 {} \;
sudo find /home/media -type f -exec chmod 644 {} \;

Now, go back to your Library sections and remove the old folders you have listed. Add /home/media/movies in your movie section,
Edit the TV section and do the same except add /home/media/tv.

Now, when you add & delete, all should be fine. You won’t need to add or remove folders to the library unless you create new top-level directories.
Just refer to the permissions commands I’ve given you here to make sure PMS always had read permission.

@ChuckPa said:
George,

You’ve not done something wrong but now it is making sense to me. Thank you.

Normal Linux security does not allow users to see each other’s directories. You are user mantax, PMS is user plex. The default Linux security (file permissions) do not allow PMS to see what you are doing in /home/mantax. Depending on the Linux you are using, it will sometimes make sure the security of your home directory is ‘secure’.

This is why I recommend creating a directory you and PMS can share. You own it, but PMS can always read it.

What I suggest is this (in a shell session):

sudo mkdir /home/media  /home/media/movies /home/media/tv         # You can make more as you need to
sudo touch /home/media/movies/dummy.file   /home/media/tv/dummy.file  # This will allow PMS to delete all the movies (including the last one) as you watch them.
sudo chown -R mantax  /home/media

Now, move the media from your home directory to this new shared location.

The last thing we need to do is set the permission so PMS can find your media here.

sudo find /home/media -type d -exec chmod 755 {} \;
sudo find /home/media -type f -exec chmod 644 {} \;

Now, go back to your Library sections and remove the old folders you have listed. Add /home/media/movies in your movie section,
Edit the TV section and do the same except add /home/media/tv.

Now, when you add & delete, all should be fine. You won’t need to add or remove folders to the library unless you create new top-level directories.
Just refer to the permissions commands I’ve given you here to make sure PMS always had read permission.

Ok i will try the above steps BUT isnt it easier to just make the user plex a member of the group mantax? My media Libraries are created with the username mantax so the folders belong to the user mantax and to the group mantax. What if i make the user plex a member of the group mantax and chmod the media folder to 775 permissions? For example my media folder has the following two directories:

[mantax@mantax]:(0b)~/media$ ls -l
total 8
drwxrwxr-x 5 mantax mantax 4096 Jan 17 23:02 movies
drwxrwxr-x 2 mantax mantax 4096 Jan 17 11:32 tv

So the media folder movies & tv belong to the user mantax and to the group mantax. By adding the plex user as a member to the mantax group it would have read & write access to the media folders.

P.S.: I already encountered a similar problem with the Sub-Zero Subtitles plugin. The Sub-Zero plugin ALSO belongs to the plex user and to the plex group. Sub-Zero was not able to download Subtitles for my movies and i knew that subtitles existed for some specific movies. ONLY when i added the plex user to the mantax group my problem with Sub-Zero was solved and Sub-Zero was able to download SRT subtitle files to the same folder next to my movie file. Have i solved the Sub-Zero problem correct by adding the plex user to the mantax group?

Thanks in advance

George

If you wish to try that, by all means do so. I’ve never seen it work right.

Remember, user plex has no administrative permissions. Sub-zero will run as user plex unless you’ve done something else and it runs outside of plex somehow.

I havent tried yet your way in the above posting. I just wanted to mention that the Sub-Zero plugin didnt worked. Only when i added the plex user to the mantax group it worked. Of course the MAIN problem what i have with my Movie Library remained. I will try your above solution and will keep you informed if it worked. I will also remove the plex user from the mantax group like the original installation was. I want to see if your solution works out and if also the Sub-Zero plugin will work with this solution.

Thanks in advance

George

by adding it to your group, you’ve created a path for kernel notifications to work. That’s fortunate for you. It’s not something that works for every distribution.

If you want Sub-Zero to write to the directory containing your media, only a slight modification to my previous instructions is needed.

sudo find /home/media -type d -exec chmod 757 {} \;
sudo find /home/media -type f -exec chmod 646 {} \;

This gives plex:plex permission to write, without requiring plex to be in your group.

If you place it in your group.

sudo find /home/media -type d -exec chmod 775 {} \;
sudo find /home/media -type f -exec chmod 664 {} \;

From time to time, you will have to repeat these to keep permissions in line.

@ChuckPa said:
by adding it to your group, you’ve created a path for kernel notifications to work. That’s fortunate for you. It’s not something that works for every distribution.

What do you mean by that? I havent understood this part exactly. You mean it was not correct as a procedure or the correct way to solve the Sub-Zero problem by adding the plex user to the mantax group?

Thanks in advance

George

Linux groups don’t work like Windows groups work. This is a fundamental difference.

In order to use groups configured as you have, You still must change file permissions to use them.

In everything I have written, the fundamental point is “File Permissions”. PMS (user plex) needs “Read” permission for the directory which was changed (media deleted) in order to actually see (read) what was deleted. This is the iNotify Directory Change event.

@ChuckPa said:
Linux groups don’t work like Windows groups work. This is a fundamental difference.

In order to use groups configured as you have, You still must change file permissions to use them.

In everything I have written, the fundamental point is “File Permissions”. PMS (user plex) needs “Read” permission for the directory which was changed (media deleted) in order to actually see (read) what was deleted. This is the iNotify Directory Change event.

I have to confirm that now Libraries are updating everything. When i add movies the movies appear in the Library and when i delete a movie then the movie is removed from the Library. BUT… There is a BUT… now the Sub-Zero plugin doesnt download any Subtitles… :frowning:

First i am gonna tell what i have done step by step:

01.) Removed all the Libraries from within Plex

02.) Deleted all OLD media folders that i had on my Ubuntu 16.04 LTS distro

03.) Removed the plex user from the mantax group. I had done this so the plex user would have write access to the movies folder. I wanted to have a clean installation. So originally plex user never was a member of the mantax group and i reverted to this state.

04.) Logged in as the mantax user and issued the following commands:

sudo mkdir /home/mantax/media sudo mkdir /home/mantax/media/movies sudo mkdir /home/mantax/media/tv sudo touch /home/mantax/media/movies/dummy.file sudo touch /home/mantax/media/tv/dummy.file sudo chown -R mantax /home/mantax/media sudo find /home/mantax/media -type d -exec chmod 757 {} \; sudo find /home/mantax/media -type f -exec chmod 646 {} \;

With the last two commands Sub-Zero should be able to download the subtitles WITHOUT being a member of the mantax group.

05.) Sub-Zero was already configured BUT i rechecked again if all the settings where correct. Sub-Zero was enabled in “Settings > Server > Agents” for both Movies and TV Shows and The plugin was placed at the very top of the Agent list and the checkmarks were enabled. Also when creating the Movie Libraries i selected the correct Movie Agent and the correct Movie Scanner. So Sub-Zero SHOULD work BUT it is not working anymore. I even tried to uninstall and reinstall the Sub-Zero plugin but again nothing. The plugin APPEARS enabled etc but it is not abble to download subtitles.

These where the steps i have taken. Library updates work now but Sub-Zero isnt. Just for the info here are my permissions when i do a ls -l command when i am inside my /home/mantax folder:

[mantax@mantax]:(0b)~$ ls -l total 16 drwxr-xr-x 2 mantax mantax 4096 Jan 15 18:26 dwatch drwxr-xrwx 4 mantax root 4096 Jan 18 13:26 media drwxr-xr-x 2 mantax mantax 4096 Jan 15 18:26 rwatch drwxr-xr-x 4 mantax mantax 4096 Jan 15 18:26 torrents

Also here are the permissions when i go inside my “/home/mantax/media” folder:

[mantax@mantax]:(0b)~/media$ ls -l total 8 drwxr-xrwx 6 mantax root 4096 Jan 18 13:26 movies drwxr-xrwx 2 mantax root 4096 Jan 18 11:49 tv

And here are the permissions for my “/home/mantax/media/movies” folder:

[mantax@mantax]:(0b)~/media/movies$ ls -l total 16 -rw-r--rw- 1 mantax root 0 Jan 18 11:49 dummy.file drwxr-xr-x 2 mantax mantax 4096 Jan 18 12:08 MOVIE-A-2015 drwxr-xr-x 5 mantax mantax 4096 Jan 18 12:07 MOVIE-B-2016 drwxr-xr-x 2 mantax mantax 4096 Jan 18 12:08 MOVIE-C-2007 drwxr-xr-x 2 mantax mantax 4096 Jan 18 12:08 MOVIE-D-2009

As you see i am categorizing my movies inside my “/home/mantax/media/movies” folder. When i download something through lets say Deluge i am moving via Deluge the movie to its OWN subfolder with the year the movie came out because i like my movies being categorized. So normally when Sub-Zero would download a Subtitle the Subtitle would be download to the movies subfolder next to the movie file. It worked when plex was a member of the mantax group AND the subfolders had 775 permissions. In the above example my movies SUBFOLDERS have 755 permissions because when i move the folders from Deluge this is the default permissions my folders have.

Also i noticed that the folders that i mention BELLOW belongs to the user mantax BUT they dont belong to the group mantax… they belong to the root group. Is this correct? Also the BELLOW folders have 757 permissions which seems correct.

/home/mantax/media /home/mantax/media/movies /home/mantax/media/tv

BUT the subfolders of the movies belong to the user mantax AND to the group mantax. Also they have permissions 755. Maybe here is somewhere the problem?

Thanks in advance

George