Debian: Move from stretch (old stable) to buster (new stable)

July 6th, 2019 was released another update of the popular Linux distribution – Debian. This is Debian’s 10th release, code-named “Buster”. I will explain in detail how to upgrade from a previous release Debian 9 “Stretch” to Debian 10 “Buster”. The upgrade process is not complicated.

Note, that the instructions below may cause unresolved dependencies and system damage, apt dist-upgrade may delete these unresolved dependencies. Do at your own risk or use instructions from professional internet resources.

See also: Debian: From buster (old testing) to bullseye (new testing)

If we are still using “stretch” as our stable system and have /etc/apt/apt.conf.d/99defaultrelease configured, we can see the following error when perform apt update:

N: Repository 'http://ftp.uk.debian.org/debian stretch InRelease' changed its 'Version' value from '' to '10.0'                                                                        
E: Repository 'http://ftp.uk.debian.org/debian stretch InRelease' changed its 'Suite' value from 'stable' to 'oldstable'
N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details.
Do you want to accept these changes and continue updating from this repository? [y/N]

This is because after Debian 10 release, Debian 9 “stretch” was moved to “oldstable” release, but our /etc/apt/apt.conf.d/99defaultrelease specifies that we always must to use “stable” release. Therefore we need to move from “stretch” to “buster. Or use “oldstable” release.

First. Upgrade current “stretch” to the newest state

/etc/apt/apt.conf.d/99defaultrelease contains information about the release is using in the system. We can check it by the following command:

cat /etc/apt/apt.conf.d/*defaultrelease
...
APT::Default-Release "stable";

If this file doesn’t exist then you don’t need to messing with it (just ignore all things with this file).

To enable “stretch” repository in the system we need to change this value to “oldstable”:

nano /etc/apt/apt.conf.d/*defaultrelease
...
APT::Default-Release "oldstable";

Now it is possible to update and install packages.

Upgrade “stretch” completely to the latest state. Thus we will prepare the system before upgrading to “buster”:

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

Second. From “stretch” to “buster”

Open that file again (if it exist) and change the value to “stable”:

nano /etc/apt/apt.conf.d/*defaultrelease
...
APT::Default-Release "stable";

The next step is to rename currently used repository. Open /etc/apt/sources.list by one of the following ways:

sudo apt edit-sources
# OR open sources.list directly:
nano /etc/apt/sources.list

We should see our repository configuration, like that:

deb http://ftp.uk.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ stretch main contrib non-free

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

Replace “stretch” with “buster”. Now it should look like this:

deb http://ftp.uk.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ buster main contrib non-free

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

Perform apt update to synchronize repository:

sudo apt update

Now our system will receive updates from “buster” release.

To completely upgrade our system to the newest “buster” state, perform the following commands:

sudo apt upgrade
sudo apt dist-upgrade

If we did this, the system information will be updated:

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

Leave a Reply

Your email address will not be published.