Migrating mastodon to Debian 11 Bullseye: fixing the segfault
In trying to upgrade a Raspberry Pi 4 from Debian 10 Buster to Debian 11 Bullseye, I made some mistakes, and basically shot my installation to pieces.
It ran, but I had absolutely no faith in it surviving a reboot.
Now that I have a working image for the Debian 11 Bullseye- based 64 bit “lite” Raspberry Pi OS, I was keen to move mastodon across to the new machine.
I’ve migrated mastodon before, and it was pretty painless: a new installation, a database dump and restore, and moving some system files.
The official mastodon migration instructions are reasonably good, if a bit confusing in their layout - you need to jump from basic to detailed, and then remember to go back to the basic instructions again. (I’ve made a pull request to the docs about this; let’s see.) But they do work.
Well, they did.
This time, they did not.
Fixing the segmentation fault
When I ran:
RAILS_ENV=production bundle exec rails assets:precompile
it resulted in several thousand lines of error message, with the crucial bit being:
/home/mastodon/live/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.0/lib/ffi/library.rb:112: [BUG] Segmentation fault at 0x000000000005c6b0
Bugger.
Fortunately, I found that someone else had had a similar problem on Debian 11 and, even better, they had a solution.
Changing the systemd
service definitions was fine, but the command it suggests you run:
LD_PRELOAD=libjemalloc.so RAILS_ENV=production bundle exec rake mastodon:setup
is for a new installation. Not a migration.
For a migration, you would normally run:
RAILS_ENV=production bundle exec rails assets:precompile
RAILS_ENV=production ./bin/tootctl feeds build
so I modified them using the same approach:
LD_PRELOAD=libjemalloc.so RAILS_ENV=production bundle exec rails assets:precompile
LD_PRELOAD=libjemalloc.so RAILS_ENV=production ./bin/tootctl feeds build
and that did the trick. The revised commands ran successfully, without segfaulting.
You may also like:
- A quick and dirty approach to redacting PDFs on Debian 11 Bullseye
- Wi-Fi on a 2012 Mac Mini, running Debian 11
- Cloning a Raspberry Pi installation: slow, but working
- Implementing BusKill: shutting down a Debian 11 Bullseye machine when a specific USB device is removed
- Fixing 'tee: command not found' on Debian 11 Bullseye
- Installing Twitter client cawbird from the official Debian 11 Bullseye repo
- Installing Debian 11 on a Microsoft Surface Go: secure boot, mokutil, Wi-Fi, and libinih1
- WireGuard VPN plugin for NetworkManager in GNOME 3 on Debian 11 Bullseye
- Migrating mastodon to a Raspberry Pi 4
- Moving from macOS to Debian 11 Bullseye Linux: applications
- Debian 11 and printing on a Samsung ML-2525W
- Virtualising an existing macOS installation for VirtualBox on Debian 11
- Aztine 15.6 Portable Monitor with Debian 11 on a Surface Pro 6
- Auto-unlocking a LUKS volume on an SD card on boot with Debian 11 Bullseye
- Making a Mac Mini power up when power is restored: Debian 11 version