Mark Loveless, aka Simple Nomad, is a researcher and hacker. He frequently speaks at security conferences around the globe, gets quoted in the press, and has a somewhat odd perspective on security in general.

Upgrading Debian 11 to 12

Upgrading Debian 11 to 12

I use Home Assistant in my house for all kinds of automations - mainly to try and save energy by controlling devices and their electrical usage. To get the level of freedom with my choices with Home Assistant, I had selected Home Assistant in Supervised mode as my “version” since it offered the most freedom. However, the required underlying operating system for Supervised mode to work was Debian 11 Bullseye. Debian 12 Bookworm was released last year, but it was a while before Supervised had been updated enough for the upgrade to happen, plus I gave it a bit of extra time for early adopters to work out the kinks. And I had a bunch of other projects, so this was lower on the list of priorities.

But now I’ve upgraded, it went better than I expected as I did do some research ahead of time, but what follows is how I did it. I do not deem this to be a tutorial per se, these are simply the steps I took to get things up and operational.

A Bit of History

I’m no stranger to Debian, I’ve used it before, and I’ve had my issues with it. The main issue I’ve had is the inability to run recent versions of programs, utilities, and applications - sometimes I want to take advantage of those recent versions for a variety new features including some that can help improve security. Philosophically I appreciate Debian. But I have public servers online and I want to use certain versions of programs and their features, so I mainly use Ubuntu Server, while my daily driver at home is Pop!_OS.

I originally had high hopes for Debian 12, and did a review of it a year ago (blog post here). However there were a few areas where there were problems and I decided to stick with Ubuntu on the servers. Nonetheless I’ve kept a watchful eye on Hivemind (the name of the internal server running Home Assistant) and kept up on the various happenings with Debian. I figured there was always the possibility I’d get sick of Canonical (Ubuntu’s corporate overlord) and have to switch distros (like I did on my laptop) so this allowed me a means of testing Bookworm out a bit longer term.

Hivemind and the Upgrade

I have two internal servers that are up and op all the time, Hivemind and Murmur. Murmur usually is running the experimental stuff, but on occasion I will run additional things on Hivemind. For starters, Docker is already installed (for Home Assistant) so that makes firing up something rather easy. However at the time of the upgrade, the only thing Hivemind was running was Home Assistant.

As I mentioned before, Home Assistant Supervised had been updated to work on Debian 12, and I waited until some of the various errors and problems had been ironed out (plus I had other projects and priorities). But based on my past experiences I was still prepared for the worse, and commenced the upgrade.

The first thing I did was a fresh backup of configuration files and Home Assistant. This is regularly done anyway, but I did another backup manually right before I started the upgrade process.

I made sure everything was as current as possible with Debian 11 first:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt full-upgrade
$ sudo apt --purge autoremove

I edited two files and changed every instance of “bullseye” to “bookworm”.

$ sudo nvim /etc/apt/sources.list
$ sudo nvim /etc/apt/sources.list.d/docker.list

Note that I had to make sure Docker was going to get the proper updates. In other words, if you have other added repositories you’ll have to make sure they are updated (assuming they support bookworm).

At that point I was ready to start the actual upgrade.

$ sudo apt update
$ sudo apt upgrade --without-new-pkgs

This is a little different as “without-new-pkgs“ is considered a “minimal” upgrade, but I found it recommended by many as a less painful method. It prevents accidental removal of something critical needed during the upgrade process. When presented with the apt-listchanges page, I did read through it in case there was something that could possibly impact me (there was nothing) and hit “q” to exit proceed on. Any pages encountered that asked if I wanted to restart services without asking during the upgrade I said yes. Any pages encountered that asked if I wanted to overwrite the edited version of a config file, I selected the option to keep the original config and not overwrite it with a new one.

After the minimal upgrade was complete, I performed the full upgrade.

$ sudo apt full-upgrade

Again I hit “q” to exit the apt-listchanges page and chose to keep my original config files. Once it was complete I rebooted the system.

$ sudo reboot

After the system came up, I connected up to Home Assistant and it was working, however it gave an error regarding D-bus. This somehow seemed familiar, so I re-read my original review of Debian 12, and remembered that systemd-resolved was not a part of the Debian 12 installation process. I was able to quickly fix the problem.

$ sudo apt install systemd-resolved
$ sudo reboot

The reboot was for good measure, and everything was up and running. I immediately examined the system to ensure all configs were as I wanted them, all Home Assistant features seemed to be running normally, remotely all of my Ansible scripts to manage Hivemind ran fine, and functionally there appeared to be no visible difference.

Follow-up

It’s been a few weeks, and all of the various automations in Hivemind (and for that matter Home Assistant) are running normally. I’m still not thrilled about the whole upgrade process - I know with Ubuntu it basically boils down to running “do-release-upgrade” which is way easier and in general a much smoother process. Debian 12 has gained a few points with me, so we’ll see how I feel moving forward as Ubuntu and Canonical evolve and my main public servers might require a major upheaval.

Energy Monitoring Part One

Energy Monitoring Part One

Solar FAQ Part Two

Solar FAQ Part Two