Upgrade Debian 11 to Debian 12 from Command Line

In this guide, you will learn to Upgrade your Debian 11 Bullseye to Debian 12 Bookworm from the Command-line interface. Debian 12 known as the Bookworm is the new release of Debian distribution. In this tutorial, we want to teach you to upgrade your Debian version to this new release and get familiar with it.

What’s new in Debian 12 Bookworm?

The Debian 12 LTS also called Bookworm was released on 10th June 2023 and it is supported and maintained for 5 years. Debian 12 has many more software packages and updates than Debian 11. Also, it has several desktop applications and environments. It also has many more man documentation pages.

Another amazing feature of Debian 12 Bookworm is that it introduced a new repository called “non-free-firmware” that separates non-free firmware from the remaining non-free packages.

What is Debian 12 GNOME version?

As we said, Debian 12 has several desktop applications. Available desks have been upgraded to the versions GNOME 43, plasma 5.27, LXDE 11, LXQt 1.2.0, MATE 1.26, Cinnamon 5.6 y Xfce 4.18. 

What is Debian 12 Kernel Version?

Debian 12 Bookworm comes with Linux kernel 6.1 and a new non-free firmware repository.

Now that you have gotten familiar with the new Debian 12 LTS distro, it’s time to upgrade your Debian version from the terminal.

How To Upgrade Debian 11 to Debian 12 from Command Line?

To start your upgrading Debian version, you must have access to your server as a non-root user with sudo privileges. To do this, you can follow this guide on Initial Server Setup with Debian 11.

Important Note: Before starting the upgrading process, remember to back up your important data and files. You can use the rsync or rsnapshot utility.

Step 1 – Check the Current Debian Version From the Command Line

From your terminal, run the following command to check your Debian 11 information:

lsb_release -a

In your output, you will see:

Output
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

Then, check your Debian kernel version with the command below:

uname -mrs

In your output, you will see:

Output
Linux 5.10.0-8-amd64 x86_64

Also, you can check your Debian version by using the command below:

cat /etc/debian_version
Output
11.0

Step 2 – Update Debian 11 Bullseye Packages

At this point, you must run the system update and upgrade on Debian 11 by using the commands below:

# sudo apt update
# sudo apt upgrade

Then, remove unnecessary packages on your Debian 11 by using the following command:

sudo apt --purge autoremove 

Step 3 – Update /etc/apt/sources.list File To Point To Debian 12 Repositories

At this point, you must edit the /etc/apt/sources.list file to point to the Debian 12 repositories. To do this, open the file with your favorite text editor, here we use the vi editor:

sudo vi /etc/apt/sources.list

At the file, you should replace all the package sources that are Debian 11 bullseye with Debian 12 bookworm. Because we intend to use Debian 12 on either a desktop or server that requires non-free firmware. we added the non-free repository to the file.

deb https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware

deb https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware

deb https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware

deb https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware

deb https://security.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware
# deb-src https://security.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware

When you are done, save and close the file.

Step 4 – Upgrade Debian 11 Version to Debian 12

At this point, you need to run the system update with the command below:

sudo apt update

Then, upgrade the existing packages by using the following command:

sudo apt upgrade --without-new-pkgs

During the upgrading process, you will be asked to restart services during package upgrades without asking, choose Yes, and continue.

Finally, you need to run the full system upgrade to Debian 12 by using the command below:

sudo apt full-upgrade

When the ‘:’ icon will appear, press enter to get to the end of the file and press q to exit from it. Then, you will see the configuration window, select “keep the local version currently installed” and click ok.

Reboot your server to apply the changes:

sudo systemctl reboot

Step 5 – Verify Debian 12 Version Installed

When you have logged back into your server, you can verify your Debian version by using the command below:

lsb_release -a

In your output, you will see:

Output
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

Also, verify your Debian 12 Bookworm kernel version:

uname -mrs
Output
Linux 6.1.0-9-amd64 x86_64

Finally, remove unwanted packages by using the following command:

sudo apt --purge autoremove

That’s it, you are done.

Conclusion

At this point, you have learned to Upgrade your Debian 11 bullseye to Debian 12 Bookworm from the Comamnd-line interface. Debian 12 has many amazing features and software packages that Debian 11. You can now use this amazing distro and enjoy using it.

You may be interested in these articles:

How To Upgrade Debian 10 to Debian 11

Upgrade Linux Kernel on Debian 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!