Upgrade to Debian 12 (Bookworm): sources.list and Step-by-Step Guide

Category: Servers & Websites
Posted: November 15, 2024
Author: Antonio

Debian 12 “bookworm” was released on June 10, 2023. Below is the correct /etc/apt/sources.list for Debian 12 and a step-by-step upgrade from Debian 11 (bullseye) without reinstalling the system. At the end — how to move on to Debian 13.

Linux, penguin on the beach

What matters now (November 2026)

  • Debian 11 no longer gets updates: its LTS support ended on August 31, 2026. If your server is still on 11, upgrade it.
  • Debian 12 moved to LTS on July 12, 2026: security updates continue until June 30, 2028, but not for every package.
  • The current stable release is Debian 13 “trixie” (released August 9, 2025). You can’t skip a release: upgrade step by step, 11 → 12 → 13.

sources.list for Debian 12

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

non-free-firmware is a section new in Debian 12 with firmware for Wi-Fi adapters, GPUs and other hardware. If you need packages from contrib and non-free, add them after main. The deb-src lines (same URLs, starting with deb-src) are only needed if you build packages from source.

Upgrading from Debian 11 to 12 step by step

1. Make a backup. On a VPS, the easiest way is a snapshot in your hosting panel. At the very least, save your configuration:

sudo tar czf /root/etc-backup.tgz /etc

2. If you work over SSH, start tmux. That way a dropped connection won’t interrupt the upgrade halfway:

sudo apt install tmux
tmux

If the connection does drop, log in again and reattach with tmux attach.

3. Bring the current system up to the latest Debian 11:

sudo apt update
sudo apt full-upgrade
apt-mark showhold

The last command lists held packages — if the list isn’t empty, they may block the upgrade.

4. Replace bullseye with bookworm in your repository list:

sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list

Or simply paste the lines from the section above into the file — that also adds non-free-firmware. Check the /etc/apt/sources.list.d/ folder too: third-party repositories (Docker, PHP, etc.) also need to be switched to bookworm or temporarily disabled.

5. Upgrade in two stages:

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

During the upgrade, apt will ask about config files you’ve modified. If you never edited the file, you can take the package version (Y); if you did, keep yours (N, the default) and compare them manually later.

6. Reboot and check the version:

sudo reboot
cat /etc/debian_version

You should see 12.x.

7. Remove packages you no longer need:

sudo apt autoremove

Next: Debian 13

Moving from 12 to 13 works the same way: replace bookworm with trixie and repeat steps 3–7.

sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list

After the upgrade, run sudo apt modernize-sources — this new apt command converts the old sources.list to the new .sources format (the old one is deprecated). Before upgrading, read the official Debian 13 release notes — they list the changes that may affect your server.

In short

Make a backup, bring Debian 11 up to date, replace bullseye with bookworm, then run apt upgrade --without-new-pkgs and apt full-upgrade, and reboot. After that it’s worth moving straight on to Debian 13 — Debian 12 is already in LTS mode.

Want to rehearse the upgrade first? On Vultr you can spin up a Debian VPS with hourly billing, practice the whole procedure on it and delete it afterwards.

The Vultr link is an affiliate link: it costs you nothing extra, and the blog gets a small reward.

Related posts:

Leave a Comment

Copying content from this site is allowed only with a direct link to the source - https://nemcd.com