Upgrade Debian 10 Buster to Debian 11 Bullseye From Command Line
Debian 11, codenamed Bullseye, was released on August 14, 2021. This tutorial is going to show you how to upgrade Debian 10 to Debian 11 from the command line. You can follow this tutorial on a Debian 10 desktop, or Debian 10 server. As with every Debian release, Debian 11 will be supported for 5 years. The codename “Bullseye” is named after the toy horse in the Toy Story movie.
Recommendations Before the Upgrade
If you installed the proprietary Nvidia driver on Debian 10 desktop, I recommend removing it before the upgrade because the Nvidia driver caused package conflict when I attempted to upgrade Debian buster to bullseye.
sudo apt remove *nvidia*
Before doing the upgrade, you can make a backup of your computer using Clonezilla. If the upgrade fails, you can easily restore your OS. Everything on your OS including software and files will be intact.
If you are trying to upgrade a Debian VPS (Virtual Private Server), you can use your hosting provider’s snapshot functionality to create a snapshot of your server.
If you are using a laptop, please connect your power source.
Keep Your SSH Session Alive
If you use SSH to log into your Debian server, it’s a good idea to keep your OpenSSH session alive by using the screen
utility. Install screen on the Debian 10 server:
sudo apt install screen
Then start screen:
screen
Upon the first launch, you will see an introduction text, simply press Enter
to end. Then you will be able to run commands as usual.
It’s also recommended to add the following line at the bottom of the /etc/ssh/sshd_config
file on your server to keep your SSH session alive.
ClientAliveInterval 60
Save and close the file. Then restart SSH daemon.
sudo systemctl restart ssh
Upgrade Debian 10 Bullseye to Debian 11 Bullseye Using Command Line
You can use the command line to upgrade Debian desktop or a headless server. To upgrade to Debian 11, switch to root user with the following command. You will need to enter the root user’s password.
su -
If you have a sudo
user, you can also switch to root by using the following command. You will need to enter the sudo
user’s password.
sudo su -
Then update existing software using the following two commands.
apt update apt upgrade
If a new kernel is installed when running the above command, then you need to reboot the system in order to continue the upgrade process. To reboot Debian, run the following command. (Remember to switch to root user again after the reboot.)
shutdown -r now
Next, we need to edit the sources.list
file with a command-line text editor such as Nano.
nano /etc/apt/sources.list
Change all instances of buster
to bullseye
. If you don’t like changing it one by one, then you can exit out of Nano text editor (Press Ctrl+X
) and run the following command for batch replacement.
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
The security suite is now named bullseye-security
, so run the following command to replace the old suite name.
sudo sed -i 's/debian-security bullseye\/updates/debian-security bullseye-security/g' /etc/apt/sources.list
Then we need to disable third-party repositories with the following command, which will add a #
character at the beginning of line for every .list file in /etc/apt/sources.list.d/
directory.
sed -i 's/^/#/' /etc/apt/sources.list.d/*.list
Next, update software sources and upgrade software to the latest version available in the bullseye repository. This step is called minimal upgrade.
apt update apt upgrade
If the apt-listchanges
shows up during the upgrade, you can press the Q
key to return to the main screen.
When upgrading packages, you will be asked if you want to restart services without asking. If you want to manually restart services, choose No. This tutorial selects Yes, because my Debian box doesn’t have a service that needs to be accessed by the public.
You will also likely to be asked if you want to install new version of configuration files. I always choose No (Just press Enter) to be on the safe side. (The new configuration file will be saved with the same file name but with the .ucf-dist
or .dpkg-dist
extension, which you can examine after the upgrade.)
Once minimal upgrade is finished, run the following command to begin full upgrade.
apt dist-upgrade
Now you can remove obsolete/unneeded software packages from your Debian system.
apt autoremove apt clean
Finally, reboot the system.
shutdown -r now
Check your Debian version.
lsb_release -a
You should see the following text.
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye
Congrates! You have successfully upgraded to Debian 11 Bullseye.
Next Step
I hope this tutorial helped you upgrade Debian 10 to Debian 11. You can also attend a Debian release party to celebrate it! As always, if you found this post useful, then subscribe to our free newsletter to get more tips and tricks. Take care 🙂