How to upgrade to Debian 12 Bookworm
Debian 12 Bookworm is out. With it, comes a new kernel, new drivers, new features, and more improvements. In this guide, we’ll show you how to upgrade your Debian 11 system to the new Debian 12 release.
How to backup your data
Before you upgrade your system from Debian 11 to Debian 12, you’ll want to create a backup of your data. Debian upgrades generally go off without any issues, but it’s still a good idea to create backups before continuing.
There are many ways to create backups of data on Debian. In this guide, we’ll show you how to do it with the Deja Dup app. To start, launch the terminal on the Debian desktop. You can do this by pressing Ctrl + Alt + T on the keyboard. Or, search for “Terminal” in the app menu and launch it that way.
With the terminal app open, use apt install
to set up the deja-dup
package. This package will be used to back up your data.
sudo apt install deja-dup
With the app installed, launch it on the Debian desktop, and select “Create Your First Backup.” Once you select this option, go through the prompts to create your first backup. You can save your data to Google Drive (and other cloud services,) to a local directory, or removable disk.
Update your system
After creating a backup of your data, you must update your Debian 11 system and ensure all of the latest packages are installed. To do this, launch a terminal window and use the apt update
command as well as the apt upgrade
command.
sudo apt update
sudo apt upgrade
How to edit your sources
You cannot upgrade Debian 11 to Debian 12 without editing your sources file. The source file is located at /etc/apt/sources.list
. This file tells Debian what software channel to use. On Debian 11, everything points to “11”. To upgrade to Debian 12, you need to change everything to reflect Debian 12’s codename “bookworm.”
Before editing, this is what /etc/apt/sources.list
should look like on your Debian 11 system.
deb http://deb.debian.org/debian/ bullseye main
deb-src http://deb.debian.org/debian/ bullseye main
deb http://deb.debian.org/debian/ bullseye-updates main
deb-src http://deb.debian.org/debian/ bullseye-updates main
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
Open up the file in the Nano text editor for editing purposes. Note that you must open this file with the sudo
command. Alternatively, you’ll need to gain root access in the terminal with su
and then open it.
sudo nano -w /etc/apt/sources.list
In the Nano text editor, ensure that your source.list
file looks like the example below. Everything should be replaced with bookworm
.
deb http://deb.debian.org/debian/ bookworm main
deb-src http://deb.debian.org/debian/ bookworm main
deb http://deb.debian.org/debian/ bookworm-updates main
deb-src http://deb.debian.org/debian/ bookworm-updates main
deb http://security.debian.org/debian-security bookworm-security main
deb-src http://security.debian.org/debian-security bookworm-security main
When you’ve finished making your sources file look like the example above, save the file in Nano by pressing Ctrl + O and exit the editor with Ctrl + X.
How to perform the Debian 12 upgrade
You’ve backed up your data, and you’ve changed your software sources over from Debian 11 to Debian 12. Now it is time to perform the upgrade. To start, use the apt update
command. Running this command will refresh Debian’s software sources, and ensure they’re filled with Debian 12 packages rather than Debian 11 packages.
sudo apt update
Once Debian 12’s software sources are filled in with the latest packages, it is time to install updates. You can install the package upgrades on your system for Debian 12 by executing the following apt upgrade
command below.
sudo apt upgrade
With everything up to date, it is time to run the full-upgrade
command. This command will install any additional packages required for the Debian 12 upgrade. Note that during the full-upgrade
command, you’ll be asked to confirm upgrades and configuration file changes. Follow the on-screen prompt to successfully upgrade.
sudo apt full-upgrade
After running the full-upgrade
command, you must run the autoremove
command. This command will automatically remove all obsolete packages that Debian 12 doesn’t need.
sudo apt autoremove
When the autoremove
command finishes running, reboot your system to use Debian 12. Enjoy!