Preperation

Upgrade time can be a daunting time specially if you are new or not that confident in performing upgrades, I will be covering the basics of upgrading which will allow you to perform an upgrade of your Debian 8 system to a Debian 9 system.

The system that I last performed the upgrade on was my personal Gitlab CE server so I will add a little at the end for gitlab-ce. The first thing that you want to do before making any changes is make sure you are familior with the server and it's primary function, for example is it a mail server, web server database server,file server etc... this will then enable you to test it's primary function once the upgrade has completed and point out any major problems that may crop up.

You will also want to ensure that you have a backup and that you are able to restore that backup in the event that it's required if it's a virtual machine then take a snapshot if posible. You should also consider how you will access the machine if there are problems, do you have physical access or remote access via an IPKVM/IPMI the last thing you want is for the server to go down in a remote location and you then can't get onto it or boot a live cd of some sort to try and fix it.

With all that said I have not had a system upgrade require remote access since one of my first debian 6 upgrades, leson learned the hard way......

As a general rule of thumb is, the less additional or 3rd party software installed on your system, the higher chance for a successful upgrade, if you have installed any 3rd party software or manually installed software then you should check if this will upgrade with the rest of the system, in some cases you may need to remove the software prior to performing the upgrade, I should also point out that MariaDB replaces MySQL in Debian 9, this change introduces some changes which are not backwards compatible with Debian 8 database format, as part of the upgrade your databases will be upgraded automatically. If you run into some problems with the upgrade you will not be able revert back, so it is important to ensure you have a backup of all your databases prior to the upgrade.

Upgrade existing system

Before starting the upgrade to Debian 9 you will need to ensure that your system is fully uptodate

apt-get update
apt-get upgrade
apt-get dist-upgrade

Checks for partially installed, missing and obsolete packages.

dpkg -C

Check what packages are held back if any.

apt-mark showhold

Before proceeding make sure you don't have any issues with packages or packages on hold.

Update Sources

The system should now be fully updated with no issues with packages so we can now update the sources.list file with the Debian Stretch sources.

Make a backup the current /etc/apt/sources.list

cp /etc/apt/sources.list /etc/apt/sources.list_backup_`date +%Y-%m-%d_%H-%M`

Edit your sources.list file and update the keyword jessie to stretch.

JESSIE

deb http://ftp.uk.debian.org/debian jessie main
deb http://ftp.uk.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main

STRETCH

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

If you have other repos that need updating then you can do them to, here I have gitlab-ce so this was also updated Gitlab CE repo list /etc/apt/sources.list.d/gitlab_gitlab-ce.list JESSIE

# this file was generated by packages.gitlab.com for
# the repository at https://packages.gitlab.com/gitlab/gitlab-ce

deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ jessie main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ jessie main

STRETCH

# this file was generated by packages.gitlab.com for
# the repository at https://packages.gitlab.com/gitlab/gitlab-ce

deb https://packages.gitlab.com/gitlab/gitlab-ce/debian/ stretch main
deb-src https://packages.gitlab.com/gitlab/gitlab-ce/debian/ stretch main

If that seems like a bit to much work you could use a sed command to replace jessie to stretch for you.

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

Upgrading The System

When upgrading the system will prompt for user input so be aware of this so don't issue the command and run!! After the sources are updated you will need to update the packages list then start the upgrade process

apt-get update
apt-get upgrade
apt-get dist-upgrade

You should now have your system fully upgraded to Debian 9 Jessie, reboot and then check services are working as expected.

After the reboot I also needed to run a small reconfigure for gitlab

gitlab-ctl reconfigure
gitlab-ctl restart

Add a comment

0.0(0 votes)

Previous Post