Stretch Toy Story

Update Raspbian from Jessie to Stretch

Stretch Toy Story


Since 17th August 2017, the new Raspbian version Stretch, based on Debian 9.1, is ready for download. I usually wait a couple of months before updating to avoid early bird problems. In this tutorial I will explain the most important steps to perform an upgrade from Raspbian Jessie to Stretch version on a Raspberry Pi. Before starting, notice that this is a major version upgrade. Therefore, it is recommended to perform a clean installation when possible. If a clean installation is not possible, upgrading is always a possibility. However, it is not guaranteed that it works in every circumstance. This is why you should perform a backup before starting.

Prepare your system

First of all, your current Raspbian version should be completely updated. To do so, just type:

The first command, apt-update, will only update the list of available packages and their versions, without installing or upgrading anything.  The second one, apt-upgrade, will actually install newer versions of the packages currently installed on the system from the available sources. Finally, dist-upgrade will, in addition to performing the function of upgrading, also intelligently handle the change of dependencies with new versions of packages.

Once done, verify that nothing is wrong. Check that nothing ist reported after each command:

With dpkg -C  you check if there is any broken package. The second command, apt-mark showhold , will print a list of packages on hold. Those will not be upgraded automatically. It is recommended not to have packages on hold before upgrading the system.

Change package repository to Debian Stretch

Next, you should update your sources file located in /etc/apt/sources.list to include the new Stretch repositories. To do so just type

This command will use sed, an stream editor, to replace any Jessie keyword occurrence to Stretch. Afterwards update your local package index with:

Update Rasbian Stretch

Everything is prepared to start the upgrade. When ready, execute the bellow commands to commence the Debian Stretch upgrade process:

The upgrade process is carried out in two steps. First of all, there is a minimal upgrade to avoid conflicts and then a complete upgrade. The upgrade will download the packages from the repositories and will take some time to complete. In my case it was almost 30 minutes.

During the process some configuration files are also updated. If you have done changes in these files, your Raspberry will ask for each one if you want to replace the current configuration file with the new version. If you want to see the differences press D (display differences). Use N (not replace) if you want to keep your version. Otherwise press Y to replace the old config. file with a new one.

Cleaning up and check

Once the update is done you should cleanup old outdated packages with the following commands:

And finally restart the system with:

You can always check that the update has been correctly performed by doing:

Leave a Comment