March 6, 2021


Upgrade Debian 8 to Debian 9

upgrade debian 8 to debian 9

Upgrade Debian 8 to Debian 9 is done almost exactly like upgrade Debian 7 to Debian 8. It is just as easy and the only thing you need to change is the source list. So if you already know how to upgrade you can skip the article really. Just copy the source. 

Debian 8 will continue to live until June 2020. It will live as long as you want, but after June 2020 it will not receive any more updates. So then you are on your own. If you are not connected to the internet it is perfectly safe to continue to run an old Debian version. On the internet it is not recommended to run an outdated operating system.

WARNING: Always backup before upgrading your system. Unless there is nothing of importance and doesn’t matter if it is lost. If you are on a virtual machine like VirtualBox, just do a snapshot. It is quick and easy. If you run a MySQL database or Apache server make sure you answer that you keep your own configs instead of the package maintainers config. AND DO A BACKUP!

To confirm your Debian version you can check the file /etc/debian_version. The latest version at the moment is 8.11.

cat /etc/debian_version

It is always recommended to update all packages before starting the upgrade. So check if you need any updates first.

apt-get update
apt-get upgrade

Now we are ready to upgrade Debian 8 to Debian 9. The first thing we need to do is to change the source list. One solution to this is to replace all the Jessie sources to stretch, or just copy and paste the source list below. If you are root you can empty the source list before editing it.

> etc/apt/sources.list

Now your source list file will be empty. Open your favorite text editor and paste in the source below. This is the generic Debian source list. It might be faster if you find some in your own country. But this will work for everyone.

deb stretch main contrib non-free
deb-src stretch main contrib non-free

deb stretch/updates main contrib
deb-src stretch/updates main contrib

deb stretch-updates main contrib non-free
deb-src stretch-updates main contrib non-free

When the source list is updated we need to update the packages to Debian 9. We do that the usual way.

apt-get update
apt-get upgrade

When the packages have been upgraded we can start to update the distro it self.

apt-get dist-upgrade

Your system is now updated to run Debian 9. And you will have a lot of outdated packages you don’t need anymore. We will get rid of those with autoremove.

apt-get autoremove

Your kernel will have a newer version now. So you need to reboot your system to use the new kernel. To verify that the kernel is updated you can check the kernel version before you reboot. This is my kernel before the update. Your kernel might be newer.

uname -a
Linux db1 3.16.0-10-amd64 #1 SMP Debian 3.16.70-1 (2019-07-22) x86_64 GNU/Linux

After a reboot you should at least have this kernel or newer.

uname -a
Linux db1 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u4 (2019-07-19) x86_64 GNU/Linux

That is how you upgrade Debian 8 to Debian 9. Now your system is running on the latest Debian 9 kernel. Debian 9 will be supported to 2022, probably around summer time.

Enjoy your new system.