Site Overlay

Upgrading Raspbian from Buster to Bullseye

About 2 years ago, I already posted an article on upgrading Raspbian from Stretch to Buster. Now it’s time to move from Buster to Bullseye. Here’s a quick walk-through:

1. Precautions to be taken against fatal loss of production system

Same procedure as in the previous upgrade:

  • Produce a full backup of your stretch production system. Using raspiBackup is recommended.
  • If you want to be ultra-sure, produce a clone (with dd) on a second MicroSD card on which you perform the upgrade. If things go sideways, you can still revert to your clone and restart from scratch.

2. Basic upgrade procedure

There are good walk-through instructions on BluesWireless and PiMyLife up. Pick one of those how-tos and follow their instructions (differences between the how-tos are marginal and did not affect the upgrade outcome in my case).

Whenever the upgrade process stops and asks you if to keep existing config files or install new ones, go with the default option (which is keeping existing config files).

3. MariaDB 10.5.15

Now comes the nasty stuff: The first thing that does not work out of the box after the upgrade is MariaDB. And that means that any other service that relies on the database will not run either – which is almost everything why we run our Raspberry Pi: Nextcloud, WordPress, Prosody, and countless other services.

We therefore start installing the most recent MariaDB release:

After installing the server, and checking the server status, we get the next problem:

The problem is discussed on askubuntu.com and on launchpad. Interestingly, the problem dates back a few years without any definitive solution offered.

Furthermore I found a more recent announcement on the MariaDB website, telling us that the authentication procedure has been modified starting with MariaDB 10.4. As my upgrade was from 10.3 to 10.5, I guess the error message above is connected to that new way of handling the authentication directly after installation.

While the purists’ recommendation seems to be to use unix socket authentication, I went for the fast & dirty way and put the root password (twice, both in the [client] and in the [mysql upgrade] section) into /etc/mysql/debian.cnf (So much for DO NOT TOUCH…):

Going forward, I will check if the more elegant solution is to switch to unix socket authentication, but so far I am glad to have a running system at all.

After rebooting with these modifications, the SQL server starts and sudo service mariadb status shows no more errors. There is an annoying and superfluous info message in yellow though, telling me that there is no need to run mysql_upgrade. I will check how to ged rid of this going forward, too:

4. PHP 7.4

As with our previous upgrade from Stretch to Buster, Bullseye also comes with a new PHP version (7.4 instead of 7.3). We do want to have 7.4 installed because Nextcloud requires 7.4 from release 24 on.

First we have to install additional PHP 7.4 packages:

We then have to manually edit /etc/php/7.4/fpm/pool.d/www.conf. We proceed as in the previous Buster upgrade. First we change the listen entry to:

Then we activate the following environment variables, by removing leading semi-colons:

Save and exit, reboot and check if the php7.4-fpm service is running smoothly:

In my case, PHP 7.4 was already set up as a deamon service which is automatically launched at the boot time. If you are still stuck with php7.3-fpm, proceed as in the Buster upgrade: stop the 7.3 service, disable it, enable php7.4-fpm and start it.

5. Nextcloud

Reboot and check: WordPress and Prosody should run smoothly and Nextcloud should come up, too. Still we have a couple of warnings which we can get rid of by manually editing /etc/php/7.4/fpm/php.ini:

The PHP memory limit is below the recommended minimum of 512MB. All we have to do is to change memory_limit from the default 128M value to 512M.

Furthermore I got a warning that my opcache interned strings buffer is nearly full. It was recommended to change opcache.interned_strings_buffer to a value larger than 8. I chose 16, and the warning was gone.

I stil get another 2 warnings that I have never found out how to get rid of:

  • Your web server is not properly set up to resolve “/.well-known/webfinger”. Further information can be found in the documentation ↗.
  • Your web server is not properly set up to resolve “/.well-known/nodeinfo”. Further information can be found in the documentation ↗.