Upgrade Debian 10 (Buster) to Debian 11 (Bullseye)
Upgrading your operating system can seem daunting, but moving from Debian 10 (Buster) to Debian 11 (Bullseye) is a straightforward process if you follow these steps. Before proceeding, ensure you have a backup of your data, a stable internet connection, and root or sudo privileges for your user account.
Prerequisites
- Superuser Privileges: You must perform the upgrade with superuser privileges. Log in as root or a user with sudo privileges.
- Data Backup: Back up your data before starting the upgrade. If you're using a virtual machine, consider taking a complete system snapshot.
Update Current Packages
- Check for Held Back Packages: Run
sudo apt-mark showhold
to check for any packages that are held back, as they can cause issues during the upgrade. Unhold them if necessary. - Update Installed Packages: Refresh your package index and upgrade all installed packages using the following commands:
sudo apt update
sudo apt upgrade - Perform a Full Upgrade: Use
sudo apt full-upgrade
to update your packages to the latest versions. This command may also remove unnecessary packages. - Clean Up: After the full upgrade, remove any automatically installed dependencies that are no longer needed with
sudo apt autoremove
.
Modify APT’s Source-List Files
- Reconfigure APT Sources: Open
/etc/apt/sources.list
and replace each occurrence ofbuster
withbullseye
. If you have other source files under/etc/apt/sources.list.d
, update those as well. - Using sed Command: Alternatively, execute the following
sed
commands to update your sources list:sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list
sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*.list
sudo sed -i 's#/debian-security bullseye/updates# bullseye-security#g' /etc/apt/sources.listdeb http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb http://deb.debian.org/debian-security bullseye-security/updates main - Set Terminal Output to English: This helps to avoid language-specific issues during the upgrade. Use
export LC_ALL=C
to set the language to English. - Update Packages Index Again: Run
sudo apt update
to refresh the package index with the new sources.
Perform the System Upgrade
- Upgrade Installed Packages: Begin the system upgrade with
sudo apt upgrade
. This step upgrades packages without requiring additional packages to be installed or removed. - Full System Upgrade: Execute
sudo apt full-upgrade
to perform a complete system upgrade. This command resolves dependency changes and upgrades packages that were not updated in the previous step. - Clean Up and Reboot: After completing the full upgrade, clean up unnecessary packages again with
sudo apt autoremove
. Then, reboot your machine to activate the new kernel usingsudo systemctl reboot
.
Confirm the Upgrade
After rebooting, confirm that your system has been successfully upgraded to Debian 11 (Bullseye) by running lsb_release -a
. The output should indicate Debian GNU/Linux 11 (Bullseye) as the distribution.