Upgrading Debian 11 to Debian 12

Debian 12 ("bookworm") was released on June 10. I've upgraded several machines, and my experience has been that this is their smoothest upgrade ever. There was one machine that the install went badly sideways ... but my post-mortem on that one showed that I had assumed it was Debian 11, when it was in fact Debian 10. So that's lesson #1: don't ever jump versions on upgrades. And lesson #2: Debian has no guard rails. Never has had. Make sure you're on Debian 11 before upgrading to 12. Something else you should always do is check that you have at least 3 GB free on your root partition. I saw some Debian documentation in researching this post that told me the upgrade will check and warn, but if it does I think that's new in Debian 12 (and not something I intend to test). I know I've broken upgrades for lack of space in the past.

For the machines I've upgraded so far, I followed the generic DebianUpgrade. It's fairly simple (but assumes best-case outcomes and doesn't recommend checking much). You might be better with: Upgrades from Debian 11 which is long and detailed and recommends a bunch of steps you probably don't need and/or won't do ... but which if followed should ensure a good outcome. You should also read the What's New page. There are new packages, there are old packages deprecated ... the thing I noticed that affected my Bash scripts the most was the deprecation of the which command. It turns out to still be available in Debian 12, but I've gone ahead and replaced which in my scripts with command -v.

The Simple Version

This process isn't recommended, but shows the best-case scenario (perhaps even "usual" as it's what I've done on roughly six different computers). Starting in Debian 11:

# apt-get full-upgrade
...

This is following the Debian page I can no longer find: it was specific to the Debian 12 upgrade, and it was using apt-get rather than apt to do all the steps. This has worked for me across multiple machines, so I'm sticking with it even though I usually use apt in daily use.

Edit /etc/apt/sources.list to change all occurrences of "bullseye" to "bookworm". This is standard in most upgrades, but the main repository line changes slightly from deb http://deb.debian.org/debian/ bullseye main contrib non-free to deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware. You may be using a different repo URL, or a different selection of repos, the major points are the change of name and the addition of the non-free-firmware repo to that first repository line. This is new.

From here, it's pretty much the same as it's been in the past:

# apt-get update
...
# apt-get upgrade
...
# apt-get full-upgrade
...
# apt-get auto-remove
...
# shutdown -r now
...

The above steps will take a while, and require some interaction during at times. How long it takes will vary depending on your network connection, your processor cores/speed, and your HD/SSD speed. For me with a 100/30Mbit network connection, the downloads take less than two minutes: the software installation takes the bulk of the time.