Safe RabbitMQ Upgrade: Ubuntu 22.04 to 24.04 Guide

1. Stop the services

systemctl stop rabbitmq-server.service
systemctl stop epmd.service

2. Backup your database just in case:

cp -rp /var/lib/rabbitmq /var/lib/rabbitmq-backup

3a. Set `HOST` shell variable to your host name and upgrade the database:

docker run -it --rm -v /var/lib/rabbitmq:/var/lib/rabbitmq \
    --name rb --hostname $HOST \
    --volume="/etc/group:/etc/group:ro" \
    --volume="/etc/passwd:/etc/passwd:ro" \
    --volume="/etc/shadow:/etc/shadow:ro" \
    docker.io/library/rabbitmq:3.9

3b. In another shell:

docker exec -it -u $(id -u rabbitmq) rb rabbitmqctl enable_feature_flag all
docker exec -it rb sync
docker stop rb

Repeat step 3 again 2 more times with rabbitmq version `3.10` and `3.11`.

4. Uninstall (DO NOT purge) rabbitmq-server:

apt uninstall rabbitmq-server

5. Now you can run normal do-release-upgrade and reinstall rabbitmq-server after upgrading.

More information: Bug #2074309 “upgrade 22.04 -> 24.04 won’t start due to feature …” : Bugs : rabbitmq-server package : Ubuntu (launchpad.net)