Upgrading debian Jessie to Stretch

Debian linux Stretch (9) is released meanwhile. Even i really belive 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 experinces 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 interuptions. With simple comand

screen  

if eny interuption occurs you'r screen is not interupted, you can login and continuer 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 chgeck, 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 recoment to install Gnu Keyring of Debian archive.

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

Ok, it seems that 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 ther 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 disable 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  

Cleanup unused packages.

apt-get autoremove  

and

6. Reboot

systemctl reboot  

Check 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 insterested in upgrading from wheezy to jessie i've blogged in 2015.