This article explains a system upgrade procedure from Debian 8 Jessie Linux to Debian 9 Stretch.
The chances for a successful and fully functional upgrade are decreased by a number of 3rd-party packages installed on your current system. For this reason, remove any obsolete standard repository and 3rd-party software before you attempt the upgrade. The command which might be helpful here is:
aptitude search '~o'
Jessie Full Upgrade
Before we move on with the upgrade, let’s fully upgrade our current Debian Jessie system:
# apt-get update # apt-get upgrade # apt-get dist-upgrade
If everything went smoothly, perform database sanity and consistency checks for partially installed, missing and obsolete packages:
# dpkg -C
If no issues are reported, check what packages are held back:
# apt-mark showhold
Packages On Hold will not be upgraded, which may cause inconsistencies after the Stretch upgrade. Before you move to the next part, it is recommended to fix all issues produced by both the above commands.
Update Package Repository to Debian Stretch
Now, that we have a current system fully upgraded, it is time to resynchronize the package index files with new Debian Stretch sources. This is done by editing /etc/apt/sources.list file to include Debian stretch package repository. First, make a backup the current /etc/apt/sources.list:
# cp /etc/apt/sources.list /etc/apt/sources.list_backup
Execute apt edit-sources or use your favourite text editor e.g., VIM to modify a current /etc/apt/sources.list file to include stretch repositories. Simply update keyword jessie to stretch.
FROM JESSIE deb http://httpredir.debian.org/debian jessie main deb http://httpredir.debian.org/debian jessie-updates main deb http://security.debian.org jessie/updates main TO STRETCH deb http://httpredir.debian.org/debian stretch main deb http://httpredir.debian.org/debian stretch-updates main deb http://security.debian.org stretch/updates main
Alternatively, use a sed the command to automate this tedious task:
# sed -i 's/jessie/stretch/g' /etc/apt/sources.list
Once the above /etc/apt/sources.list file edit is completed, use apt-get the command to update packages index:
# apt-get update
Upgrade to Debian Stretch Simulation
Before we hit the UPGRADE button, let’s use apt the command to see a preview of what we are facing. To do this execute apt list --upgradable command in order to get a quick survey of the number of packages to be installed, updated and removed without affecting the system.
# apt list --upgradable
Upgrade to Debian Stretch
We have come to the most exciting part, which is the actual Jessie upgrade to the Debian Stretch system. During the upgrade you may be asked:
Restart services during package upgrades without asking?
The choice is about whether you wish the system to restart your services automatically during the system upgrade or you wish to do it manually or after the system is fully upgraded to Stretch. When ready, execute the below commands to commence the Debian Stretch upgrade process:
# apt-get upgrade # apt-get dist-upgrade
At this stage, you should have your Jessie Debian Linux system fully upgraded to Debian Stretch. Once again check for obsolete packages so there are no surprises down the track:
# aptitude search '~o'
Congratulations to your fully upgraded Debian 9 Stretch Linux system.