How to Upgrade from Debian 11 Bullseye to Debian 12 Bookworm

For Debian enthusiasts and users, the release of Debian 12 “Bookworm” marks a significant milestone, offering many upgrades from Debian 11 Bullseye to Debian 12 Bookworm, which brings a host of enhancements and updated software packages. Debian 12 introduces improved desktop environments, including Gnome 43, KDE Plasma 5.27, LXDE 11, LXQt 1.2.0, MATE 1.26, and Xfce 4.18. With over 11,089 new packages, notable software upgrades like Apache 2.4.57, Linux kernel 6.1 series, LibreOffice 7.4, OpenJDK 17, Python 3.11.2, and extensive updates, Debian 12 ensures your system remains secure and efficient. Enhanced multilingual support, specialized Debian Med and Debian Astro Blends, and reintroduced ARM64 Secure Boot to further enrich the user experience.

The following guide will demonstrate the steps to upgrade from Debian 11 Bullseye to Debian 12 Bookworm using the command-line terminal. We will cover essential preparation, the upgrade process, and post-upgrade tasks to ensure a smooth transition to the latest Debian release.

Step 1: Update Debian System Packages

Run the following terminal command to update your Debian 11 Bullseye installation:

sudo apt update && sudo apt upgrade

Rebooting your system is crucial if you have updated many packages, including the kernel.

reboot

Step 2: Change Bullseye in “sources.list” to Bookworm

To ensure a smooth transition, updating the sources list from Bullseye to Bookworm is crucial. Instead of manually editing the /etc/apt/sources.list file, you can efficiently perform this task using the following command in the terminal:

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

For users who require access to non-free and contrib repositories, which may or may not be already enabled, verify their presence by running the following command after updating the sources list:

grep "deb http://deb.debian.org/debian/ bookworm main contrib non-free-firmware" /etc/apt/sources.list

If the previous command returns no output (indicating the line doesn’t exist), use the following sed commands to modify the existing “bookworm main” line by appending “contrib” and “non-free”:

sudo sed -i '/deb http:\/\/deb.debian.org\/debian\/ bookworm main/ s/$/ contrib non-free-firmware/' /etc/apt/sources.list
sudo sed -i '/deb-src http:\/\/deb.debian.org\/debian\/ bookworm main/ s/$/ contrib non-free-firmware/' /etc/apt/sources.list

These commands will ensure that your Debian system can access the non-free and contrib repositories and the central repository.

This is an example of /etc/apt/sources.list open with a nano text editor, which, after executing the above commands, should look like this or close to it:

Step 3: Run the Upgrade to Debian 12 Bookworm

Initially, you must synchronize the cache with the Debian 12 Bookworm repositories by running a simple APT update command.

sudo apt update

To upgrade to Debian 12 Bookworm, run the following command in the terminal:

sudo apt full-upgrade

Please note that you may be asked to restart services during the upgrade process, as shown in the example below:

Whether or not to restart services is up to the user. It is important to note that you should not run any essential services during the upgrade process. For server users, it is crucial to stop services such as Nginx, MySQL, and PHP and make backups of configuration files. This is an excellent practice to have in place, regardless of an upgrade.

Step 4: Reboot to Finalize Debian 12 Distribution Upgrade

Once the upgrade process is complete, reboot your system by running the command in the terminal.

reboot

You will notice a new background and the Linux Kernel 6.x starting during the reboot.

Step 5: Upgrade Post-Installation Check on Debian 12

After upgrading, verifying the Debian operating version and building using the CAT command is recommended.

cat /etc/os-release

Example output confirming the upgrade:

Step 5: Clean Up Obsolete Packages (Optional)

Removing old and unnecessary packages from your Debian 12 system for optimal performance and cleanliness is recommended using the –purge and autoremove commands:

sudo apt --purge autoremove

Troubleshooting Debian 11 to 12 Distribution Upgrade

Nvidia Drivers

It is currently suggested that Nvidia drivers be removed, as some users have reported issues during upgrades. To do this, use a command to eliminate any remaining Nvidia components on your system.

sudo apt autoremove nvidia* --purge

Another way to uninstall Nvidia drivers is for those installed using the “.run” file. It is advised to remove this installation and use the command provided.

sudo /usr/bin/nvidia-uninstall

As a last resort, if the above options do not work, try uninstalling the CUDA toolkit using the command provided.

sudo /usr/local/cuda-X.Y/bin/cuda-uninstall

It is important to note that you may need to list the directories to locate the CUDA repository correctly.

ls /usr/local/cuda*

Conclusion

In conclusion, upgrading from Debian 11 Bullseye to Debian 12 Bookworm can be smooth if you take the necessary precautions. It is essential to back up your data and ensure all required packages are up to date. Removing old and unnecessary packages helps keep your system clean and efficient. If you encounter any issues with Nvidia drivers, it is recommended to remove them before upgrading. Following these steps should ensure a successful upgrade to Debian 12 Bookworm.

Leave a Comment