From 3075ab6916b3163def0412cc9f2878003032d17e Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 15 Jan 2025 21:45:35 -0800 Subject: [PATCH 1/2] Document Plex database repair process --- 2025-01-15_Plex-Database-Repair.md | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 2025-01-15_Plex-Database-Repair.md diff --git a/2025-01-15_Plex-Database-Repair.md b/2025-01-15_Plex-Database-Repair.md new file mode 100644 index 0000000..44498c4 --- /dev/null +++ b/2025-01-15_Plex-Database-Repair.md @@ -0,0 +1,40 @@ +--- +date: 2025-01-15 +title: Plex Database Repair +tags: + - homelab + - plex + - troubleshooting +--- + +About a year ago, my Plex container stopped working after updating to a newer image. I was able to work around the issue +by pinning the container version to the last working image prior to the breaking update. Over the course of this past +year, I've occasionally spent some time reading through forum posts, trying to upgrade to different newer versions, and +doing my best to glean something useful from the generic database errors that I could find in the container logs. This +week I changed up my search terms and found a solution. + +## The Problem +Somehow, I ended up in a state where I had a working Plex instance, but upgrading the container to a newer image would +fail. Either the server would fail to start outright, or it would start with all of my libraries showing up empty. +Rolling back to the older image always gave me a working instance, so it was never a particularly high priority for me +to diagnose and fix the issue (tbh, I was hoping Jellyfin would address music transcoding with Android Auto and I could +finally just migrate to that). Eventually, I figured out that the issue was coming from a database operation as part of +a migration that happens during container init. + +## The Solution +Once I realized this was a database issue, I was able to find +[this Plex support article](https://support.plex.tv/articles/repair-a-corrupted-database/) that discusses repairing a +database. I ended up rebuilding the database using the process towards the end of that article, and then I was able to +pull the latest Docker image which started right up (after running that database migration). As far as I can tell, all +of my libraries, watch history, playlists, etc. are still there. + +## Closing Thoughts +I have no idea what happened to cause my database to become corrupted, but I believe it is the same database I started +with when I was running Plex on Windows, over 10 years ago. I do wish Plex had friendlier tools for database +import/export and migration; the documented process of just copying the application data isn't particularly friendly for +capturing backups and I have no idea how to work with that to efficiently scale out a Plex container for high +availability. + +In any case, I have Plex back up and running without any major issues :tada: . I still plan on moving to Jellyfin, but +it doesn't currently let me play my music library in my car (Android Auto only does direct playback), so I'm sticking +with Plex for the time being. \ No newline at end of file -- 2.45.2 From 512448f02868d427fa58f237b3a7d117f9a743c0 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Wed, 15 Jan 2025 21:47:49 -0800 Subject: [PATCH 2/2] =?UTF-8?q?Replace=20`:tada:`=20with=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2025-01-15_Plex-Database-Repair.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/2025-01-15_Plex-Database-Repair.md b/2025-01-15_Plex-Database-Repair.md index 44498c4..b72fc90 100644 --- a/2025-01-15_Plex-Database-Repair.md +++ b/2025-01-15_Plex-Database-Repair.md @@ -35,6 +35,6 @@ import/export and migration; the documented process of just copying the applicat capturing backups and I have no idea how to work with that to efficiently scale out a Plex container for high availability. -In any case, I have Plex back up and running without any major issues :tada: . I still plan on moving to Jellyfin, but +In any case, I have Plex back up and running without any major issues 🎉. I still plan on moving to Jellyfin, but it doesn't currently let me play my music library in my car (Android Auto only does direct playback), so I'm sticking with Plex for the time being. \ No newline at end of file -- 2.45.2