LINUXMAKER, OpenSource, Tutorials

How to update Debian Linux 9 "Stretch" to Debian Linux 10 "Buster"?

At the time of writing, Debian Stretch is still the stable version, while Debian Buster is still the testing version. Debian Buster Stable is expected in the second or third quarter of 2019.
Nevertheless the procedure from a stable version to a testing version with Debian Linux is always the same. This procedure should be recorded and documented here.

Buster Full Upgrade

First, we're doing a full full upgrade of the existing Debian Stable System - currently Stretch, which can be a bit more up-to-date with you.

# apt-get update
# apt-get -y upgrade
# apt-get -y dist-upgrade

This brings the current stable system up to date. You can also omit the option "-y", but you will then be asked interactively whether the actions should be carried out. The above chain of commands updates the information from the repositories, updates all packages, but does not delete one. The last command performs a system upgrade that allows both packages to be installed and deleted.

Prepare the Package Repository on Debian "Buster"

As already said, this statement can be applied to any Debian version, regardless of the versions "Stretch" and "Buster". In the next step we prepare the /etc/apt/sources.list for the upgrade.

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

After that, your /etc/apt/sources.list should look something like this:

deb ftp.de.debian.org/debian/ buster main
deb-src ftp.de.debian.org/debian/ buster main
deb security.debian.org/debian-security buster/updates main
deb-src security.debian.org/debian-security buster/updates main

Then we bring our system up to date with the Buster repository.

# apt-get update

System-Upgrade to Debian-Buster

The following commands will upgrade your Debian 9 Stretch to a Debian 10 Buster.

# apt-get -y upgrade
# apt-get -y dist-upgrade

Check which Debian version is running on your Linux system

The easiest way to check which Debian version you are running is simply to read the contents of the /etc/issue file.

# cat /etc/issue
Debian GNU/Linux 9 \n \l

However, the above command does not show you the latest Debian upgrade versions. In the following example, the command already provides more detailed information:

cat /etc/debian_version
9.5

In the next step, you can also look through the release file /etc/os-release:

# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Another alternative is lsb_release, which may need to be installed first. Subsequently, this command also provides information about the Debian version on your Linux system.

# aptitude install lsb-release
#lsb_release -da
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.5 (stretch)
Release:        9.5
Codename:       stretch

For Debian versions that already use Systemd, you can also use hostnamectl:

#hostnamectl
   Static hostname: mombasa
         Icon name: computer-VM
           Chassis: vm
        Machine ID: 9e413e5b509343bc9a10c97172a75658
           Boot ID: 71224c76c174487abad3a9979a632ef4
  Operating System: Debian GNU/Linux 9 (stretch)
            Kernel: Linux 4.9.0-8-amd64
      Architecture: x86-64