Upgrade issue 1.28.1.6104-788f82488

Server Version#: 1.28.1.6104-788f82488
Player Version#:

I’m having issues with missing columns after upgrading from 1.26.2.5797.something. A complete log from an earlier attempt is available at Aug 11, 2022 14:45:59.590 [0x7f7063e92b38] INFO - Plex Media Server v1.28.0.5999 - Pastebin.com. Plex is running in a KVM and I have a pre-upgrade snapshot I can revert to.

Aug 11, 2022 14:46:22.738 [0x7f706203db38] ERROR - [DatabaseFixups] SQLITE3:0x80000001, 1, no such column: metadata_items.edition_title in "select metadata_items.id as ‘metadata_items_id’, metadata_items.library_section_id as ‘metadata_items_library_section_id’, metadata_items.parent_id as 'metadata

SQLite version 3.35.5 2021-04-19 18:32:05
Enter “.help” for usage hints.
sqlite> PRAGMA integrity_check;
*** in database main ***
Page 157636: btreeInitPage() returns error code 11
row 4423 missing from index index_statistics_media_on_at
row 4424 missing from index index_statistics_media_on_at
row 4426 missing from index index_statistics_media_on_at
row 4427 missing from index index_statistics_media_on_at
row 4428 missing from index index_statistics_media_on_at
row 4429 missing from index index_statistics_media_on_at
row 4430 missing from index index_statistics_media_on_at
row 4431 missing from index index_statistics_media_on_at
row 4438 missing from index index_statistics_media_on_at
Error: database disk image is malformed
sqlite> VACUUM;
Error: database disk image is malformed
sqlite>

Which version of PMS did you upgrade from?
Have you had any abrupt power-off or other forced-termination of PMS?

I might have something (still in development) which could help you and will discuss in PM in you’re interested.

1.26.2.5797-5bd057d2

I have no issues with the database on the 1.26.2 install. No issues at all. Upgrading via apt and all goes well it seems.

I’m an Oracle DBA, but have no SQLite experience. Can I alter the table and add the missing column?

@danradom

The error reported is a bad Index and a missing column not a missing table.

If you would use Plex SQLite to run the integrity check, you’ll get best results.
Plex SQLite contains additional modules not found in normal SQLite

sudo bash
cd "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases"
"/usr/lib/plexmediaserver/Plex SQLite" com.plexapp.plugins.library.db 'PRAGMA integrity_check(1)'
"/usr/lib/plexmediaserver/Plex SQLite" com.plexapp.plugins.library.blobs.db 'PRAGMA integrity_check(1)'

The next test is to look at the matching backups of both the library.db and library.blobs.db

If you have them (you should), you can recover (using copy) to those and then scan files and refresh metadata to pick up any changes made since that time.

As alternative, you can run it manually or try a tool we’re developing. (it automates this type of recovery)

  1. dump your existing DB as a .sql output file,
  2. move the existing out of the way
  3. import the SQL files to recreate the missing index rows.

Yes I noted altering the table adding the missing column. I will run the integrity checks as you checks as you suggest. I’ve already reverted back to the working snapshot for some Sunday night plexertainment.

dr@plex:~ $ sudo bash
root@plex:dr # cd
root@plex:~ # cd “/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases”
root@plex:Databases # “/usr/lib/plexmediaserver/Plex SQLite” com.plexapp.plugins.library.db ‘PRAGMA integrity_check(1)’
*** in database main ***
Page 157636: btreeInitPage() returns error code 11
root@plex:Databases # “/usr/lib/plexmediaserver/Plex SQLite” com.plexapp.plugins.library.blobs.db ‘PRAGMA integrity_check(1)’
ok
root@plex:Databases #

Interestingly I get the same results prior to upgrading, but it doesn’t seem to cause any issues.

dr@plex:~ $ sudo bash
root@plex:dr # cd “/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases”
root@plex:Databases # “/usr/lib/plexmediaserver/Plex SQLite” com.plexapp.plugins.library.db ‘PRAGMA integrity_check(1)’
*** in database main ***
Page 157636: btreeInitPage() returns error code 11
root@plex:Databases # “/usr/lib/plexmediaserver/Plex SQLite” com.plexapp.plugins.library.blobs.db ‘PRAGMA integrity_check(1)’
ok

I will try and dump the data and reload it.

I dumped library.db and library.blobs.db, stopped plex, removed the database file, started plex, and imported the dump files. I got a bunch of unique key constraint voilations, but much of the data did import. Unfortunately all of my libraries are empty.

Any suggestions? How can I try the tool that is being developed?

Making some progress I think.

I recovered the database and loaded the recovery data. Now I’m getting the following error.

sqlite> PRAGMA integrity_check;
Error: malformed database schema (spellfix_metadata_titles) - table spellfix_metadata_titles already exists

sqlite> .schema spellfix_metadata_titles
Error: malformed database schema (spellfix_metadata_titles) - table spellfix_metadata_titles already exists

sqlite> drop table spellfix_metadata_titles;
Error: malformed database schema (spellfix_metadata_titles) - table spellfix_metadata_titles already exists

Are you using Plex SQLite or regular ?

The malformed schema tells me you’re inserting data into an existing database and that drop won’t work because the schema definition itself is bad.

Did you use my utility to get the sql output files?
I don’t remember giving it to you (but it’s been crazy here).
Maybe it’s time ?

I am using Plex SQLite. I do not have your utility.

Chuck,

I was able to use your utility to repair the database prior to upgrade. Both the repair and upgrade were successful. Thank you for your help with this.

@danradom

Glad it helped you.

How did it work for you?

I know it’s command line driven but how’s the interface and is it easy to understand & use ?

The interface is nice. I found it very easy to use, but I’ve been using command line linux systems since 1997. I think if a regular user were to encounter this utility they would find it easy to use as well.

Thanks.

It’s my hope that, after more testing, with additional “Try to break it” testing, it will be included as a utility in the regular linux-based PMS packages.

It seems you and I have been around Linux for equally long time.
I remember when the 0.98 kernel was released and we were all excited to get it installed … hahahah

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