SQLite Woes With Tautulli on Ubuntu

My Pushbullet notifications aren’t working… huh.

I like to spy on my Plex users. I offer up plenty of media and I like to know what people are watching and when. There are plenty of reasons for this ranging from voyeurism to planning maintenance windows. For this, I was using Pushbullet.

At first, I thought that Pushbullet was squelching the connecting because I had too many notifications (one of my friends left Paw Patrol running all night and I awoke to like 200 notifications.) I decided to move to Pushover. In the Tautulli interface, I went to delete the Pushbullet Notification Agent and… Nothing happened. So maybe it was just a page refresh issue. I’ll just charge ahead with setting up Pushover! But a click of the Add Notification Agent proved fruitless. An error stating “Failed to add notification agent”. Super helpful.

Well, I trolled the internet for an hour trying to find SOMETHING on this. All I found were vague references and threads that ended with “Nvm, fixed it” and no further info. If you find yourself in the same position, rejoice. Here it is:

SQLite is a piece of junk.

If you look in the logs you’ll see: “Database image is malformed.” Again, super helpful.

Every time I come across something that uses SQLite, it breaks. Admins on the internet come to the general conclusion of “yeah, sometimes the databases just fuck up, so restore from backup.” Well, I have backups, but those are damaged too. So, here’s how to fix it as it stands.

How to repair this buggy crap database:

First, you must shut down Tautulli. We’re gonna be messing about in the plumbing.

Install SQLite. On Ubuntu:

#apt install sqlite

Then,

#cd /opt/Tautulli/

Here you should see the “Tautulli.db” database.

$sqlite3
sqlite>.open tautulli.db
sqlite>.databases

Output should be as such:

Run:
pragma integrity_check;

You may or may not get the same error that the database image is malformed. I got a list of things that were wrong with the database. YMMV.

We’re going to dump the database. in SQLite, with the database opened, this looks like:

sqlite> .mode insert
sqlite> .output tautulli_bak.db

sqlite> .dump

sqlite> .exit

Now we have 2 databases and we are out of the SQLite prompt. Now let’s rename the original database with:

#mv tautulli.db tautulli.db.orig

Then we use sqlite to make the dump into a proper database:

#sqlite3 tautulli.db < tautulli_bak.db

And finally, load up into sqlite again and analyze the database to update the statistics.

#sqlite3
sqlite> .open tautulli.db
sqlite> analyze;
sqlite> .exit

Start up Tautulli and cross your fingers. This method, pieced together from parts all across the web, got me back to spying on my friends and family. Happy Plexing.

Leave a Reply

Your email address will not be published. Required fields are marked *