Linux: Debian release upgrade

From Luky-Wiki
Jump to: navigation, search

This article describe update from Debian 8 (Jessie) to Debian 9 (Stretch). It may be used also for future updates but keep in mind that references to "Stretch" needs to be updated for such a use case. Also take extra precaution if you use third party software. Additional compatibility checks and update steps may be necessary if third party software is installed on system.

Take system backup and offload it

Update itself should be flawless but ...

  • new packages mean new version of configuration and data structures (database files). Relevant files are converted during update so everything will work fine. In case you will need (or like) to rollback update then backup will be essential for this.
  • update itself is highly tested by Debian developers but it may be case that your configuration is somehow special and update fail. It is just much easier to restore system than try to repair it ...

It is good practice to backup system prior to update and offload backup data from system.

Search for obsolete packages

aptitude search '~o'

This command list all packages that are no longer present in repository. Those packages are either obsolete or manually installed. Consider removing all those packages before continuing.

Perform full Jessie Upgrade

It is essential to get system up2date on Jessie before we move to Stretch.

apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get autoremove
apt-get clean

Check package database

This step will performs database sanity and consistency check.

dpkg --audit

Correct all errors before continuing.

apt-mark showhold

If there are packages On Hold then un-hold them and upgrade before continuing. If you skip this check then you may face problems with dependencies in next steps.

Modify repository configuration

Open /etc/apt/sources.list for editing and replace references to jessie with stretch.

File should looks like this:

# stretch sources
deb http://ftp.sk.debian.org/debian/ stretch main
deb-src http://ftp.sk.debian.org/debian/ stretch main

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

# stretch-updates, previously known as 'volatile'
deb http://ftp.sk.debian.org/debian/ stretch-updates main
deb-src http://ftp.sk.debian.org/debian/ stretch-updates main

Upgrade to Stretch

System will update itself to Stretch at this point. Key element is "Stretch" sources from previous step.

Watch closely messages generated by update. There may be additional steps needed depending on installed packages.

apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get autoremove
apt-get clean

Verify package database (yes, again)

dpkg --audit

Correct all errors before continuing.

aptitude search '~o'

This command list all packages that are no longer present in repository. Those packages are either obsolete or manually installed. Consider removing all those packages before continuing.

Reboot system

Warning: Debian Stretch adapt predictable network device names. This mean that network device names may change during reboot from "Jessie" to "Stretch". Modification of /etc/network/interfaces may be necessary.

This step is necessary to load new kernel and also good practice to see if system boot in case reboot is needed.

shutdown -r now

Final verification of debian version:

lsb_release -a

Enjoy new system

You should have working Debian Stretch installation at this point. Additional update steps will highly depend on your environment but I still have one recommendation.

Run once more "Upgrade to Stretch" to see that everything is fine after reboot. There may be packages that get released during reboot or additional candidates for cleanup after you remove obsolete packages.