The process of upgrading from Debian 10 to Debian 11 is fairly straightforward for those that have been doing it for a while, but for those that are not familiar, it can be a daunting task. In this article, I’ll present two different options for upgrading: Manual and Automated. The automated (scripted) process is the same as the manual process, so please work the manual process in your environment before using the script. As always, please be sure you’ve got a proper backup of your machine before starting the process!
Update 18JAN23: After realizing that folks are getting to my site, I double checked my workflow and realized that it is not aligned with the official Debian Foundation documentation. I’ve updated my steps to better align with the steps provided in the official guidance.
1: Update system
Before doing the upgrade, you must ensure your system is running the current latest packages within your current version.
sudo apt update && sudo apt upgrade && sudo apt full-upgrade
2: Make a backup of your current /etc/apt/sources.list file
In case anything goes wrong while updating the sources.list file, it’s always good to have a backup.
cp /etc/apt/sources.list /etc/apt/sources.list.orig
3: Modify /etc/apt/sources.list
You may choose your favorite text editor, but in this example, I’ll use nano for the process.
sudo nano /etc/apt/sources.list
Original file (may vary):
deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main
deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main
Modified file:
deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main
4: Clean and update package lists
Make sure that aptitude has the right packages/versions, without any of the old “stuff”.
sudo apt clean
sudo apt update
5: Perform the upgrade
sudo apt upgrade
sudo apt full-upgrade
6: Remove old packages
This will remove the old/unrequired packages. Please be sure to review this list to ensure you don’t accidentally delete something you need.
sudo apt autoremove
Automated process:
If you’ve gotten this far, you probably already know what you’re doing and are just looking for a shortcut. I’ve created the following script to make things easier/quicker. I’ve tested this on my installations, but please verify that the sed commands will work in your environment before running them. In the event that there is a problem, the script makes a backup of your sources.list file, which you can restore.
curl https://code.flatironnetworks.com/RobFauls-Com/website-scripts/raw/branch/main/Linux/Debian/Upgrade/Upgrade-Debian10toDebian11.sh --output debian_upgrade.sh && sh debian_upgrade.sh
2 Comments
Will your script work for any Debian release upgrade by simply changing the repository names in the script to update the sources.list file? Thanks.
Hey Rick,
Sorry for the late response. I missed the notification. Generally speaking, this script should work on Debian, regardless of the source/destination version. That said, it’s always possible that *something* changes or the source and destination versions are not able to be upgraded (like skipping a version).