Debian Linux Stretch (9) is released meanwhile. Even I really believe the future will be with always fresh distributions like CoreOS (and Arch?), debian stays very important distribution. I use it and it’s time to upgrade my home server (used as NAS and dev-server).

Let’S start by printing my system version before update:

#cat /etc/debian_version
8.8
#uname -a
Linux nas 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2 (2017-04-30) x86_64 GNU/Linux

1. Backup your configs

Since I’ve had good experiences last time. I’ve reduced the whole backup to /etc/

# Copy current /etc config to
cp -a /etc /...BACKUP/jessie/

2. Use screen or tmux

if you’re working remote (via ssh) make sure that you don’t suffer from any interruptions. With simple command

screen

if any interruption occurs your screen is not interrupted, you can login and continue to work with

screen -r

3. Check if there are problems with packages

First, you don’t use aptitude anymore, right? Second, you advised to check, that there are no packages “on hold”.

aptitude search "~ahold"

The apt apt-get maintained “hold” packages:

dpkg --get-selections | grep 'hold'

Now check dpkg problems with

dpkg --audit

If it shows nothing - everything is fine for now.

4. Upgrading apt source list

Before upgrading the source list I recommend installing Gnu Keyring of the Debian archive.

apt-get install debian-archive-keyring
apt-key update

Ok, it seems that the system is prepared for upgrade and we are ready to switch release code names from jessie to stretch.

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

Checking the outcome by cat /etc/apt/sources.list

#Source list
deb http://ftp.de.debian.org/debian/ stretch main non-free contrib
deb-src http://ftp.de.debian.org/debian/ stretch main non-free contrib

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

But there could be more custom source lists in /etc/apt/sources.list.d/. So i have to files more one for docker and one for nodejs. Turns out, that there is no repository yet for deb https://deb.nodesource.com/node stretch main right now. But I don’t actively need nodejs now, I’ve just disabled and ignore this.

# cat /etc/apt/sources.list.d/docker.list
deb https://apt.dockerproject.org/repo debian-jessie main

Upgrading to stretch:

sed -i 's/jessie/stretch/g' /etc/apt/sources.list.d/*.list

5. Upgrade packages

apt-get update

If no problems appeared run to perform a minimal system upgrade (no packages will be removed at this stage).

apt-get upgrade

If Everything went smooth apply a dist-upgrade.

apt-get dist-upgrade

Clean up unused packages.

apt-get autoremove

and

6. Reboot

systemctl reboot

Check the new version and enjoy!

#cat /etc/debian_version
9.0
#uname -a
Linux nas 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2 (2017-06-12) x86_64 GNU/Linux

Hope that this helps somebody, feedback is welcome as always!


You might be interested in upgrading from wheezy to jessie I’ve blogged in 2015.