Upgrade Debian 9 Stretch to Debian 10 Buster



Before getting started, we suggest you Learn Linux Basics and follow these precautions.

Updated: 2024-05-18
Created: 2019-07-06

This guide explains how to upgrade your Debian Linux system from Debian 9 (Stretch) to Debian 10 (Buster) which is now the current stable release as of July 6th, 2019.

These steps can be preformed as an in place upgrade on a live system from either a local terminal or remote SSH session.

Step 1

Prior to upgrading, make sure the current system is up-to-date.

apt update && apt upgrade

Step 2

Begin the upgrade by switching Debian repositories from Stretch to Buster. This is accomplished in one of two ways; using the sed command to search and replace all instances automatically, or by editing the source file manually. Choose whichever option you prefer.

Search & Replace with sed.

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

Or edit your source list manually.

vi /etc/apt/sources.list

Replace all instances of "stretch" with "buster", for example.

deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main

deb http://deb.debian.org/debian-security/ stretch/updates main
deb-src http://deb.debian.org/debian-security/ stretch/updates main

deb http://deb.debian.org/debian stretch-updates main
deb-src http://deb.debian.org/debian stretch-updates main

Becomes.

deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main

deb http://deb.debian.org/debian-security/ buster/updates main
deb-src http://deb.debian.org/debian-security/ buster/updates main

deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main

If you also need the contrib and non-free components, add contrib non-free after main on all lines.

Debian is distributed (mirrored) on hundreds of servers worldwide. In our source.list example above we've used a repository within the United States, to speed up downloads you may choose another Debian mirror based on geographic location.

Third-party software installed from a repository will be disabled during the upgrade process. This may not apply to your system, so before starting, check for repository .list files within the /etc/apt/sources.list.d/ directory. If present, you'll need to update these after the upgrade. Consult the software distributor for instructions, as software from outside the standard Debian repositories may not support the new release.

Step 3

Update the package index.

apt update

Step 4

Upgrade the minimal base system.

apt upgrade

Step 5

Upgrade all other packages and dependencies.

apt dist-upgrade

Step 6

Reboot the system.

reboot

Step 7

Verify your release has been upgraded.

lsb_release -a

Output will be similar to this.

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

Step 8

Clear out the local repository of retrieved package files and dependencies that are no longer required.

apt clean

apt autoremove