Upgrade Debian 8 (Jessie) to 9 (Stretch)

Debian 8 LTS ends in mid 2020 and Debian 9 is the latetest production release and Debian 10 is knocking on the door. This is a good time to upgrade the Debian 8 to 9.

Important: Do an upgrade locally or via SSH, only. Other services like telnet can be terminated during the upgrade process and it can happen that you are not able to access the system again.

Before you start to upgrade, it’s a good idea to make a backup from your critical data like etc/ and your /home directory. Don’t forget to backup your database and web and mail data if necessary.

This article covers the pure Jessie upgrade without third-party packages. If you want to figure out which third-party packages are installed on your machine you can run one of the following commands:

$ aptitude search '~i(!~ODebian)'
$ apt-forktracer | sort

Take a look into your cat /etc/apt/sources.list file and check if the system is pointing to the Jessie repositories. The content should look similar to the snippet below.

deb http://ftp.de.debian.org/debian/ jessie main
deb-src http://ftp.de.debian.org/debian/ jessie main

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

Now, you need to update and upgrade your system to the latest version with the following commands:

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

After this upgrade, you need to check if the installed packages are done and if they are in an upgradable status. Run the following commands and it will show you any package which is not ready to upgrade. Fix the broken package before you proceed.

# dpkg --audit
# dpkg --get-selections | grep 'hold$'

The system is up to date and ready for the upgrade. Edit the
editor /etc/apt/sources.list file and change the version from Jessie to Stretch.

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

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

Save the file and run the command to update the package list. Then we can check if the packages are upgradable.

# apt-get update
# apt list --upgradable

Now we are running a two-part update process, which is recommended to avoid update issues. The first update installs packages where no other packages need to be removed or installed. The second part performs a full upgrade, with resolving dependencies between different releases.

// Part one
# apt-get upgrade

// Part two
# apt-get dist-upgrade

Reboot the system after the upgrade is done and check which version you have installed:

# reboot
# cat /etc/os-release

If you experience any issues or you want more detailed information take a look into the official documentation from Debian.


Leave a comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.