Mastodon And Upgrading Debian To Buster (#postgresql and #Libprotobuf10)

I, mostly because I tend to squeeze the most use out of old computers that I can, have my Mastodon instance running on bare metal instead of in a Docker container. And with instructions like these, I upgraded that machine from Debian 9 to Debian 10 this week.

And promptly ran into some not-transparent-to-fix errors. So if you run into these, hopefully this saves you a few hours.

First there was the major upgrade of PostgreSQL. PauloX has a pretty straightforward guide on what exactly you have to do in order to migrate your database for those of us who aren’t familiar. Presuming that you’re going from 9.6 to 11 like I did, here’s what I wrote.

sudo pg_dropcluster 11 main --stop
sudo pg_upgradecluster 9.6 main
sudo pg_dropcluster 9.6 main
sudo apt purge postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6

That (along with restarting the Mastodon processes) wasn’t enough, though, so to be on the safe side, I decided to make sure I had the codebase updated (it was), pull down yarn and gem dependencies like you do for an upgrade, and then have the system update the database schema:

RAILS_ENV=production bundle exec rails db:migrate

Which then promptly crashed and burned because it couldn’t find libprotobuf10 (the default on Jessie and Stretch); there was only libprotobuf17 (the only one automatically available on Buster). I ended up downloading the libprotobuf10 package from https://packages.debian.org/stretch/libprotobuf10 (Ubuntu equivalent). As an important note, I used the directions found here to unpack the deb file so I didn’t jack up the permissions.

fakeroot sh -c '
  mkdir tmp
  dpkg-deb -R NAME_OF_DEB_FILE.deb tmp
'

I then copied the libprotobuf.so.10 (it’s a symlink) and libprotobuf.so.10.0.0 files to /usr/lib/x86_64-linux-gnu, switched back to my mastodon user, and then reran the database schema upgrade, packed the assets, and restarted the processes. B-freaking-dow.

If I’d had these directions all in one place, it would have been a ten, fifteen minute process. Since I didn’t (and didn’t know what was really wrong), it took a long while. I hope this helps someone else.

Featured Photo by Arseny Togulev on Unsplash