Read in 4 minutes

last updated 

​How to Upgrade Debian 9 Stretch to Debian 10 Buster

After more than two years of development, the new Debian stable version, Debian 10 codenamed Buster, was released on July 6, 2019, and it will be supported for 5 years.

This release comes with a lot of new packages and major software upgrades. Debian 10 buster ships with Linux 4.19 LTS kernel, uses the nftables framework as the default iptables backend, supports UEFI Secure Boot and has AppArmor enabled by default.

In this tutorial, we will show you how to upgrade your Debian 9 Stretch system to Debian 10, Buster.

Prerequisites

The upgrade operation must be run with superuser privileges. You need to be logged in as a root or a user with sudo privileges.

Backup Your Data

First and foremost, make sure you backup your data before starting the major upgrade of your operating system. If you are running Debian on a virtual machine it is best to take a complete system snapshot so you can easily restore your machine in case the update goes south.

Update Currently Installed Packages

Before starting the release upgrade, it is recommended to update all your currently installed packages to their latest versions.

Packages marked as held back cannot be automatically installed, upgraded or removed. This may cause issues during the upgrade process. To check whether there are held back packages on your systems run:

sudo apt-mark showhold

If there are on hold, packages, you should either unhold the packages with sudo apt-mark unhold package_name or make sure the packages will not interfere with the upgrade process.

Refresh the packages index and upgrade all installed packages:

sudo apt update
sudo apt upgrade

Run apt full-upgrade which will perform a major version upgrade of the installed packages and may remove some unnecessary packages:

sudo apt full-upgrade

Remove all automatically installed dependencies that are no longer needed by any package:

sudo apt autoremove

Upgrade Debian 9 Stretch to Debian 10 Buster

The first step is to reconfigure APT’s source-list files.

To do so you can either open the /etc/apt/sources.list file with your text editor and replace each instance of stretch with buster or use the sed commands below. If you have other source-list files under /etc/apt/sources.list.d you must update those sources too.

sudo nano /etc/apt/sources.list
/etc/apt/sources.list
deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian buster-updates main
deb http://security.debian.org/debian-security buster/updates main

Alternatively, you can use the following sed commands which will update stretch to buster in all source-list files:

sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/*.list

Once done, update the packages index:

sudo apt update

If there are any error or warning messages related to a third party repository, try to fix the issue or disable the repository.

Start the system upgrade by upgrading the installed packages. This will upgrade only those packages that don’t require any other packages to be installed or removed:

sudo apt upgrade

You will be asked whether you want the services to be automatically restarted during the upgrade.

Restart services during package upgrades without asking?  

During the upgrade process, you may also be asked various other questions, like whether you want to keep an existing configuration file or to install the package maintainer’s version. If you didn’t make any custom changes to the file it should be safe to type Y otherwise to keep the current configuration enter N.

The upgrade may take some time depending on the number of updates and your Internet speed.

Next, execute apt full-upgrade which will perform a complete upgrade of the system, install the newest versions of the packages, and resolve the dependency changes between packages in different releases. This will upgrade all packages that were not upgraded with the previous command.

sudo apt full-upgrade

The command above may install some new packages and remove conflicting and obsoleted packages.

Once done clean up the unnecessary packages with:

sudo apt autoremove

Finally, reboot your machine so that the new kernel is activated, by typing:

sudo systemctl reboot

Confirm the Upgrade

Wait for a few moments until your system boots up and log in.

After logging in you will be greeted with the following message:

Linux stretch 4.19.0-5-amd64 #1 SMP Debian 4.19.37-5 (2019-06-19) x86_64
...

You can also check the Debian version by using the following command:

lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 10 (buster)
Release:	10
Codename:	buster

That’s it, you can now enjoy your new Debian 10 Buster.

Conclusion

In most cases, upgrading from Debian 9 Stretch to Debian 10 Buster should be relatively easy and painless.

If you hit any error, visit the Upgrades from Debian 9 (stretch) page which covers the known issues that might happen during an upgrade to Debian 10 Buster.