Unable to delete a photos library section

I can’t seem to delete a library section I’ve created. I changed the folder name a few times and then updated the settings on the section. I think that may be when the issues started happening. I can create a new library section now and it’s fine, but I’d like to remove the old one. I also tried to do this via the CLI using Plex Media Scanner application. Even with verbose logging doing that, nothing is output and a new terminal line appears after a second or so.

I can’t edit the section either or perform actions such as ‘Empty Trash’ or change and of the folders the section uses. I think I did actually delete it once but then it re-appeared when I created a new section with the same name and that may have also been the point this started happening.

I’ve attached my server logs but haven’t been able to locate the issue. This log is with verbose logging enabled. I tried to delete the library and immediately went to the settings pages to download the log.

I’d really appreciate any help on this. Thanks very much

Plex Media Server Logs_2018-06-29_22-10-12.zip (3.9 MB)

EDIT: I have also tried optimising the database before deleting. There are some photos in the library still even though the folders it is setup to scan should now be empty. Just 1 day is there with no thumbnails - I think it could have also been an issue analysing them when I changed the folder name.

Looks like your database is damaged.
Jun 29, 2018 21:44:58.798 [0xa697e400] ERROR - SQLITE3:(nil), 11, database corruption at line 59437 of [fc49f556e4]

see https://forums.plex.tv/t/there-was-an-unexpected-error-loading-this-library-when-accessing-all-movies-server-bug/237460/24 for an updated DB repair procedure.

Thanks OttoKerner!! I’ll check it now.

Unfortunately I don’t have access to that topic but I’ll follow instruction here:
https://support.plex.tv/articles/201100678-repair-a-corrupt-database/

Please do let me know if this isn’t correct - and I’ll update if this works so that it may help others in future.

You’ll have to insert these two commands into the workflow at the very beginning, or it won’t work:

sqlite3 com.plexapp.plugins.library.db "DROP index 'index_title_sort_naturalsort'"

sqlite3 com.plexapp.plugins.library.db "DELETE from schema_migrations where version='20180501000000'"

Thank you! I had done the process so moved the original database back, executed the 2 lines above and then did the process of backing up the database and creating it again.

Unfortunately, after completing this the service appears to be running but I cannot access the server. When I restore the database back to the corrupt one it works fine again. I imagine it’s something to do with the dump file created and the fact the database is corrupt.

In the end I just moved the database to a new name and then restarted the server. A new database has been created and I’ll create the library sections again. As I only had a few it wasn’t a big deal to do it that way.

Thanks again @OttoKerner

Stop it. Maybe we can still save your libraries.

When you created the new database back from the dump file, this database file is now ‘owned’ by root. But it must be owned by plex.
Are you familiar with the use of chown?

Yessir! last command chown plex:plex com.plexapp.plugins.library.db thanks, all sorted!!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.