PMS 1.15.2 - Migration problems when updating from PMS 1.14.1

Server Version#: 1.15.2.793-782228f99
Player Version#: N/A

got prompted to upgrade to the latest 1.15.2.x release today, but after I did so, Plex was thoroughly broken. tried restarting a bunch of times, but the web interface on port 32400 just returns a 500 error. looking at “/var/log/plex/Plex Media Server.log”, seems like the sqlite database is messed up, or not properly upgraded:

Mar 19, 2019 15:32:04.546 [0x7fb7527fc700] ERROR - SQLITE3:(nil), 1, no such column: devices.platform in "select devices.id as ‘devices_id’, devices.identifier as ‘devices_identifier’, devices.name as ‘devices_name’, devices.created_at as ‘devices_created_at’, devices.updated_a
Mar 19, 2019 15:32:04.546 [0x7fb7527fc700] ERROR - Soci Exception handled: sqlite3_statement_backend::prepare: no such column: devices.platform for SQL: select devices.id as ‘devices_id’, devices.identifier as ‘devices_identifier’, devices.name as ‘devices_name’, devices.created_at as ‘devices_created_at’, devices.updated_at as ‘devices_updated_at’, devices.platform as ‘devices_platform’ from devices where identifier=?

how can I fix this?? :frowning:

1 Like

I am having the same issue, I tried a manual update downloading the app from the site, but I get the same issue.

I just tried running the database repair guide stuff, since it was showing corruption on some of the indexes, and now it just prints the following to the log and then dies:

Mar 19, 2019 15:47:43.551 [0x7f354aeff780] DEBUG - Running migrations. (EPG 0)

also discovered that plex hasn’t made a database backup of my sqlite3 db since 2017, so I have no backups to restore from. which is great.

Hi Chuck,

seems like this thread has diverged into mostly just discussing the case where someone’s using a custom user account and needs to set permissions and things. however, my original error for this thread was some sort of database migration error with the new release, so I don’t think any of these troubleshooting tips apply.

do you have suggestions on how to correctly upgrade to the latest release in a way that doesn’t break the sqlite3 db?

thanks!

@zyvod

I’m sorry, How about we migrate you to your own thread?

I’ve been testing all throughout the QA cycle with this and haven’t seen any database upgrade problems. Every ‘migration’ (minor schema update) has been ok. If there was other damage in the DB, that might be your root cause and I want to investigate that.

If you have backup databases, we can get you back up and in shape pretty easily.

@zyvod

Here is a dedicated thread. My apologies for not breaking them out sooner.

no worries! so, there seemed to be some issues with the DB, as seen in my original post. also, plex wasn’t doing proper db backups, so the last backup I had was from 2017. however! just rolling back the package version allowed it to work fine with the existing DB, which makes me think it wasn’t actually data corruption. so I’m really not sure what might have been the issue with the new release, although hopefully the error messages I recorded give you some indication.

Hmmm,

Database backups are enabled by default. The only caveat is the system must be on when Scheduled Tasks are supposed to run :wink:

Would you mind reposting the info here? (logs, etc) so I can see now in isolation from the other posts?

yeah, this is a home fileserver that runs 24x7, and I can see it’s correctly backing up the other databases, just the primary one hasn’t gotten backed up in forever. it’s very weird. I’ll re-do the upgrade in a little bit, and then re-dump the logs for it.

Before you do the upgrade?

With it stopped…

cd /var/lib/plexmediaserver
sudo tar cfz Library-backup.tgz ./Library
1 Like

Hey Chuck,

Sorry for taking so long on this, I’ve been travelling for work, so this had to get put on the back burner for a while. but now I’ve got time to get back to it.

I’ve backed up my Library (which is a massive 28GB! who knew?), and attempted the upgrade with the latest release package. (1.15.3.858-fbfb913f7)

It looks like at some point some database corruption has happened, as here’s the error I get in the plex server log at startup:

Apr 03, 2019 23:10:51.716 [0x7f7358bfe780] ERROR - SQLITE3:(nil), 11, database corruption at line 65066 of [bf8c1b2b7a]
Apr 03, 2019 23:10:51.716 [0x7f7358bfe780] ERROR - SQLITE3:(nil), 11, statement aborts at 27: [update statistics_bandwidth set timespan=(-1 - timespan)] database disk image is malformed
Apr 03, 2019 23:10:51.719 [0x7f7358bfe780] ERROR - Exception inside transaction (inside=1) (../Library/DatabaseMigrations.cpp:204): sqlite3_statement_backend::loadOne: database disk image is malformed
Apr 03, 2019 23:10:51.722 [0x7f7358bfe780] ERROR - Exception thrown during migrations, aborting: sqlite3_statement_backend::loadOne: database disk image is malformed

I’ve tried doing the standard sqlite dump/restore to regenerate the database, but it appears that plex is implementing its own custom “naturalsort” collation that the standard sqlite3 cli tool (v3.24) can’t work with:

Error: near line 215581: no such collation sequence: naturalsort

Do you have access to a version of that tool built with your naturalsort collator so that I can attempt a restore from dump?

You can attempt to repair the DB, or use a backup if you prefer.

Deleting the naturalsort info is here:
https://support.plex.tv/articles/201100678-repair-a-corrupt-database/

Ahhh perfect, deleting that naturalsort allowed me to repair it, and now the upgrade worked correctly. Thanks!

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