Database Disk Image Is Malformed

I am using the original Amarok 1.4 on the living room media player.

No really. I have been using this setup for many years, back to the original KDE 3. When KDE 3 was dumped unceremoniously by the developers, the Trinity Desktop project was born. I continued to use the player. I treat the living room media player as an appliance. I prefer using older versions of software.

I have been wanting to move from Amarok 1.4 to Clementine, but I have not learned how to program the app with dbus commands. The main reason I continue using Amarok 1.4 is I was able to years ago create an lirc config file using dcop commands so I could use a remote control. The config is not perfect but is more palatable than hauling out a mouse. I do not think Clementine is as programmable through dbus as Amarok is with dcop, which is another reason for my procrastination.

Somewhere along the way the Amarok collection.db database got malformed. How this kind of thing happens I don’t know. So much for robust data integrity.

The curious glitch was Amarok failing to update the Last Played date with only a handful of songs. I confirmed the problem in two ways.

sqlite3 collection.db "vacuum;"

Resulted in the following:

Error: database disk image is malformed

The second confirmation:

    sqlite3 collection.db
    pragma integrity_check;

Resulted in the following:

    *** in database main ***
    On tree page 13 cell 8: Rowid 81 out of order
    On tree page 389 cell 1: 2nd reference to page 434
    On tree page 255 cell 0: 2nd reference to page 435
    On tree page 14 cell 0: 2nd reference to page 434
    Page 265 is never used
    Error: database disk image is malformed

I have no idea what that information means.

I know little about database structures. I finally solved the problem browsing around the web looking for clues.

    sqlite3 collection.db
    .dump collection.db > collection.sql
    .exit

sqlite3 -init collection.sql collection2.db

Running sqlite3 collection2.db "vacuum;" resulted in no errors. Likewise with pragma integrity_check;.

I then moved the new collection2.db as collection.db to the Amarok data directory.

I selected some of the problematic songs and the Last Played date updated. Other data such as the Play Count remain unaffected after the scrubbing.

Posted: Category: Usability Tagged: General

Next: Search Engines That Do Not Track

Previous: Avoiding HTML Markup