Guides 7 min read

Debian 11 End of Life: Upgrade to Debian 12 Safely

Debian 11 no longer gets security updates, and Debian only supports upgrading one release at a time. Here is the order of operations that keeps a server bootable.

By BashPilot Team
BashPilot AI server management One request plans, executes and verifies the fix, on every server. See pricing

Debian 11 bullseye is end of life. Its long-term support ended on 31 August 2026, and from September Debian provides no further security updates for it. A server still on Debian 11 keeps working, which is exactly the problem: nothing breaks, so the unpatched vulnerabilities pile up unnoticed.

Check what you are running and what could get in the way

Confirm the release first, then look for anything unusual that an upgrade could trip over: held packages, half-configured packages and repositories that are not Debian's.

release, package state and third-party repositories
cat /etc/debian_version
sudo dpkg --audit
apt-mark showhold
grep -rE '^(deb |URIs:)' /etc/apt/sources.list /etc/apt/sources.list.d/

dpkg --audit lists packages that are half-installed or failed to configure, and apt-mark showhold lists packages pinned in place. The official notes tell you to fix or release both before you begin. Any repository in that last list that is not deb.debian.org or security.debian.org is a third-party source. Check that it publishes packages for Debian 12, and disable it for the upgrade if it does not.

Prepare so that a failure is recoverable

First bring the machine fully up to date on bullseye, because the upgrade is only supported from the latest point release.

finish updating Debian 11 first
sudo apt update
sudo apt full-upgrade
sudo apt autoremove

Then take the backups that the Debian release notes list: /etc, the package database in /var/lib/dpkg, APT's extended state file, and a list of your package selections. If this is a virtual server, also take a snapshot at your provider. A snapshot is the quickest way back if the machine stops booting, which a copy of /etc cannot fix.

back up the files the release notes list
sudo tar czf /root/pre-upgrade-backup.tgz /etc /var/lib/dpkg /var/lib/apt/extended_states
dpkg --get-selections '*' > ~/dpkg-selections.txt
sudo apt install gpgv

Finally record the session, so that you can read exactly what happened if a prompt scrolls past. The notes use the script command for this, and ideally you run it inside tmux or screen so a dropped SSH connection does not interrupt the upgrade.

start recording the upgrade session
script -t 2>~/upgrade-bookworm.time -a ~/upgrade-bookworm.script

Point APT at bookworm

In /etc/apt/sources.list and any file in /etc/apt/sources.list.d/, replace the bullseye codename with bookworm. Nothing should still mention bullseye afterwards. A normal line looks like deb https://deb.debian.org/debian bookworm main contrib. If you use firmware from the non-free section, Debian 12 moved it into a new component, so add non-free-firmware to the line.

keep a copy, then switch the codename
sudo cp /etc/apt/sources.list /root/sources.list.bullseye
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
grep -rn bullseye /etc/apt/sources.list /etc/apt/sources.list.d/
only if you repointed the security line at the archive earlier
sudo sed -i 's|archive.debian.org/debian-security|security.debian.org/debian-security|' /etc/apt/sources.list

That last command should print nothing. If it does, either fix the remaining lines or comment them out. Do not run the upgrade with a leftover bullseye line, because APT will try to mix two releases.

Upgrade in two steps

Debian's notes split the upgrade into a minimal one and a full one. The minimal upgrade installs new versions of what you already have without adding or removing packages. The full upgrade then handles everything else, including dependency changes.

the two-step upgrade
sudo apt update
sudo apt upgrade --without-new-pkgs
dpkg -l 'linux-image*' | grep ^ii | grep -i meta
sudo apt full-upgrade

The dpkg -l line checks that a kernel metapackage such as linux-image-amd64 is installed. If it prints nothing, install one before the full upgrade so the machine has a kernel to boot. If full-upgrade stops with "Could not perform immediate configuration", Debian's workaround is sudo apt full-upgrade -o APT::Immediate-Configure=0.

When it finishes, reboot to load the new kernel. Doing the upgrade and the reboot in a quiet maintenance window, with console access available, is worth more than any command in this guide.

Verify it worked and clean up

confirm the release and the services
cat /etc/debian_version
uname -r
systemctl --failed
sudo apt update && apt list --upgradable

/etc/debian_version should now report 12, systemctl --failed should be empty or only list things you already knew were broken, and apt update should complete without errors about missing repositories. Open the sites and check the databases before you declare victory. Then clean up the leftovers.

remove unneeded packages and leftover configuration
sudo apt autoremove
sudo apt purge '~c'
apt list '~o'
find /etc -name '*.dpkg-*' -o -name '*.ucf-*' -o -name '*.merge-error'

apt purge '~c' removes packages whose configuration files remain after removal. Review the obsolete list from apt list '~o' before you purge it, because purging also deletes those packages' logs. The find command shows the configuration files the upgrade wrote next to yours, so you can compare them with diff.

Plan the second hop to Debian 13

Debian 12 is supported until 30 June 2028, so you have time, but a server parked on oldstable still needs a plan. The same procedure applies from 12 to 13, with a few changes in the release notes: APT sources live in the newer .sources format, the notes tell you to replace bookworm with trixie for the main, updates and security suites, and they finish by running apt modernize-sources. Read the notes for the exact release before you start, and run the whole procedure again, including the backups.

If you cannot upgrade yet

Some servers cannot move this month because of an application that only supports Debian 11. Debian's announcement says a subset of bullseye packages will be supported by external parties and points to its Extended LTS page, so read what is covered before you rely on it. Until you upgrade, reduce exposure: limit which networks can reach the machine, remove services you do not use, and keep a firm date for the upgrade.

Repeating the preflight checks on every Debian server you own is where this drags. BashPilot can run them as one request: it reads the OS release, held packages, third-party repositories and free disk space on each server, and stops for your approval before it changes sources or starts an upgrade. For a similar fleet-wide migration pattern, see how to migrate a cPanel account to a new server.

In BashPilot

Checking Debian servers before an upgrade

app.bashpilot.com
which of our debian servers are still on debian 11, and are they ready to upgrade
BashPilot

Read-only check of 9 Debian servers. Three are on Debian 11. Two look ready, and one has a held package and a third-party repository to resolve first. Nothing has been changed.

ServerReleaseHeld packagesThird-party reposFree space on /
db0111nonenone18 GB
app0211nonenone22 GB
app0311119 GB
show me the held package on app03
BashPilot

Listing it is read-only. I will not release the hold without your approval.

bash
apt-mark showhold
Example output, not a screenshot of a specific customer's server.

Try this on one of your own servers.

Start free trial
Share LinkedIn X
Questions

Frequently asked questions

When did Debian 11 reach end of life?

Debian announced that Debian 11 bullseye support reached end of life on 31 August 2026, five years after its initial release on 14 August 2021. From September Debian provides no further security updates for it. A subset of packages will be supported by external parties, which Debian covers on its Extended LTS page.

Can I upgrade from Debian 11 straight to Debian 13?

No. Debian's release notes only support upgrading from the immediately previous release, so Debian 11 goes to 12 first and then 12 to 13. Each hop has its own procedure and its own reboot, and you should repeat the backups before each one.

Is Debian 12 still supported?

Yes. Debian's announcement describes bookworm as the current oldstable release, supported by the LTS team, with long-term support running until 30 June 2028. That gives you time, but it is still a deadline you should plan for.

How do I know I have enough disk space for the upgrade?

Run `sudo apt -o APT::Get::Trivial-Only=true full-upgrade` after `apt update` to estimate the space needed, and make sure `/var/cache/apt/archives` has room. `sudo apt clean` and `sudo apt autoremove` free space. If the estimate fails, Debian's notes suggest completing the minimal upgrade first.

What if apt full-upgrade fails with "Could not perform immediate configuration"?

Debian's release notes give a workaround for exactly this case: run `sudo apt full-upgrade -o APT::Immediate-Configure=0`. Keep the recorded session and the contents of `/var/log/apt/term.log`, which show what happened before the failure.

Put your servers on autopilot.

Connect a server in about a minute. The first week is on us.