Home DebianHow to Upgrade Debian 11 to Debian 12 (Bookworm)

How to Upgrade Debian 11 to Debian 12 (Bookworm)

by Knowledge Base Linux
Upgrade Debian 11 to 12 server version upgrade arrow illustration

Debian 11 “Bullseye” served well, but its regular support window has ended and the ecosystem has moved on. When you upgrade Debian 11 to 12, you gain a newer kernel (6.1 LTS), updated toolchains, PHP 8.2, and years of security support from the Bookworm release. The in-place upgrade is a well-trodden path — Debian is famous for it — but it must be done in the right order to avoid a half-upgraded system.

This guide shows how to safely upgrade Debian 11 to 12 step by step: preparing and fully updating the old system, backing up, switching the APT sources from bullseye to bookworm, running the two-phase upgrade, and cleaning up afterwards. Expect the process to take 30–90 minutes depending on the number of packages and your connection speed.

Before You Upgrade: Read This First

  • Take a full backup. A snapshot (on a VPS) or a file-level backup of /etc, your data, and databases. There is no supported downgrade path back to Debian 11.
  • Work on a console if possible. SSH usually survives the upgrade, but a local or provider console saves you if networking hiccups.
  • Remove third-party repositories temporarily (Docker, vendor tools). Their packages can block the upgrade; re-add them afterwards with their Bookworm builds.
  • Read the official release notes. The Debian 12 release notes, chapter 4 list every known issue for this exact upgrade path.
  • Note the big packaging change: firmware moved to a new component, non-free-firmware, which your sources must include.
Upgrade Debian 11 to 12 package steps and backup illustration

Step 1: Bring Debian 11 Fully Up to Date

Never start a release upgrade from a partially updated system. First confirm where you stand:

cat /etc/os-release
apt list --upgradable

Apply every pending Bullseye update and reboot if the kernel changed:

sudo apt update && sudo apt full-upgrade -y
sudo reboot

Check for held or broken packages, which will block the upgrade until resolved:

sudo apt-mark showhold
dpkg --audit

Both should return nothing (or only items you understand and accept). Also purge removed-but-not-purged package leftovers: sudo apt purge $(dpkg -l | awk '/^rc/ {print $2}').

Step 2: Back Up the System State

At minimum, save copies of your configuration and a list of installed packages, so you can rebuild the machine if anything goes wrong. Our general approach in automating Linux backups with rsync and cron works well for this:

sudo tar -czf /root/etc-backup-$(date +%F).tar.gz /etc
dpkg --get-selections > /root/package-list.txt
sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.d /root/

If this is a virtual machine, take a hypervisor snapshot now as well — it is the fastest possible rollback.

Step 3: Point the Sources at Bookworm

Edit /etc/apt/sources.list and replace every bullseye with bookworm, and add the new non-free-firmware component wherever non-free appears. The finished file should look like:

deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware

Two details matter here. First, the security suite is named bookworm-security, not bookworm/updates. Second, Bullseye’s old bullseye-backports lines must be removed or switched to bookworm-backports; do not carry backports across the upgrade unless you reinstall them from the new suite afterwards. Disable third-party files in sources.list.d by renaming them to .disabled for now, then refresh the index:

sudo apt update

APT should read the Bookworm repositories without errors.

Step 4: Run the Minimal Upgrade (Debian 11 to 12, Phase One)

Debian recommends a two-phase upgrade. Phase one upgrades packages that do not require installing or removing anything else:

sudo apt upgrade --without-new-pkgs

This gently moves the base system to Bookworm versions and greatly reduces the complexity of phase two. If apt asks to restart services during this phase, accept the defaults.

Step 5: Run the Full Upgrade Debian 11 to 12

Phase two completes the transition, installing new dependencies and removing obsolete ones:

sudo apt full-upgrade

During this step you will be asked about modified configuration files: for each, choose to keep your version or install the maintainer’s version. When in doubt, view the diff (press D) — services you customized (SSH, web servers, databases) usually deserve keeping your file, while untouched configs should take the new maintainer version. You may also be asked which services to restart automatically; accepting the suggested list is fine.

Expect the kernel to move to the 6.1 series and GRUB to be reinstalled. When the command finishes without errors, reboot into the new system:

sudo reboot

Step 6: Verify the Upgrade and Clean Up

After reboot, confirm you are running Bookworm:

cat /etc/os-release
uname -r

Then remove orphaned packages and old configuration leftovers:

sudo apt autoremove --purge
sudo apt purge $(dpkg -l | awk '/^rc/ {print $2}')

Finally, re-enable your third-party repositories — this time using their bookworm builds (for Docker, repeat the repository step from our Install Docker on Debian 12 guide) — and check that your services all came back:

systemctl --failed

Troubleshooting

The upgrade wants to remove hundreds of packages

Stop. This almost always means a key source is missing (often the security or updates suite) or a third-party package is pinning old libraries. Cancel, fix the sources, and start from Step 3 again.

apt reports held broken packages

Identify the offenders with dpkg --audit and apt-mark showhold. Resolve them on Bullseye terms if you have not switched sources yet, or let apt full-upgrade propose a solution and read it carefully before accepting.

Firmware warnings for network or Wi-Fi devices

You forgot the non-free-firmware component. Add it to every sources line, run apt update, and install the firmware package for your hardware.

Conclusion

A safe upgrade from Debian 11 to 12 is a procedure, not a gamble: fully patch Bullseye, back up, switch the sources to bookworm (with non-free-firmware), upgrade in two phases, reboot, and clean up. Your machine keeps its configuration, users, and data while gaining Bookworm’s kernel, packages, and support lifetime. Once the basics are verified, re-apply your server setup checklist — firewall, automatic security updates, and monitoring — to enjoy the new release with confidence.

You may also like

KbLinux

Typically replies within a day

Hello, Welcome to the site. Please click below button for chatting me through Telegram.