How to Upgrade Raspbian Jessie to Raspbian Stretch

In this guide, we will be showing you how to upgrade Raspbian Jessie to Raspbian Stretch.

Raspberry Pi Raspbian Jessie to Stretch Thumbnail

Updating Raspbian Jessie to Stretch is a relatively simple process that can be done with ease.

There isn’t as many breaking changes in this upgrade process when compared with the upgrading of Raspbian Wheezy to Jessie.

This guide will walk you through the process of cleanly upgrading from Raspbian Jessie to Raspbian Stretch. If you’re on Stretch and need to get to Buster, then follow our guide on upgrading to Raspbian Buster.

As always it is best to make a backup of your SD Card before proceeding with the upgrade process as there is still a chance something will go wrong.

You should also undertake this tutorial using a keyboard and mouse with direct access to your Raspberry Pi and attempt to do it via SSH.

Preparing to Update

1. Before we begin switching our sources over to Stretch, we will first perform a full system upgrade to ensure that we are running the latest available packages in Jessie.

To do this run the following two commands on your Raspberry Pi.

sudo apt-get update
sudo apt-get upgrade -y

2. In some cases, packages may be held back. This hold is the last thing we want when upgrading the system to Stretch as it may cause some serious issues down the track.

Let’s enforce upgrading to the held back packages by running the following command in the terminal on the Raspberry Pi.

sudo apt-get dist-upgrade -y

3. Now we need to do a firmware update. This update is the final thing we need to do before we begin the process of updating to Raspbian Stretch.

To ensure that we have the latest firmware, run the following command.

sudo rpi-update

4. To get Raspbian to upgrade to Stretch, we need to modify the /etc/apt/sources.list file so it points to Raspbian Stretch instead of Jessie.

Begin editing this file by running the following command in the terminal.

sudo nano /etc/apt/sources.list

5. Now that the initial updates are complete, we can now modify the sources.list file and replace all occurrences of Jessie with Stretch just like we have shown below.

This change makes Raspbian search the new Stretch repository for packages.

Find

deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi

Replace

deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi

Once you have finished switching Jessie out for Stretch you can save and quit by pressing CTRL + X then Y and finally pressing ENTER.

6. We now need to modify the /etc/apt/sources.list.d/raspi.list file. This file adds additional sources to our sources.list file that we modified in the previous step.

Run the following command to begin editing the file.

sudo nano /etc/apt/sources.list.d/raspi.list

7. Now that we are editing the raspi.list file we need to change the first entry by replacing Jessie with Stretch.

Find

deb http://archive.raspberrypi.org/debian jessie main ui

Replace

deb http://archive.raspberrypi.org/debian stretch main ui

Once done, you can save and quit by pressing CTRL + X then Y and finally pressing ENTER.

8. To ensure that we have a fast and smooth update process, we will also need to remove the package called apt-listchanges.

The reason for removing this package is to stop it from trying to load the changelog for the huge amount of packages that are going to be upgraded.

To remove this package, we need to run the following command in the terminal on the Raspberry Pi.

sudo apt-get remove apt-listchanges

Starting the Upgrade to Raspbian Stretch

9. Now that we have finished updating both the raspi.list file and the sources.list file we can proceed with upgrading Raspbian Jessie to Raspbian Stretch.

Run the following two commands on your Raspberry Pi to begin the update process.

Please be prepared for this to take several hours as it is a rather extensive process.

sudo apt-get update
sudo apt-get dist-upgrade -y

You will have to pay attention during this installation process as there are specific points you will be required to input Y and press ENTER for the upgrade process to continue.

10. With our Raspberry Pi now successfully upgraded to Raspbian Stretch there are a few more things that we will want to do.

During installation, many packages will be marked as no longer required due to changed dependencies.

To remove these, we can type in the following command into the terminal.

sudo apt-get autoremove -y

11. After running autoremove, we should also clean out the package cache.

The command that we will be using is autoclean, and it will automatically remove any package files that are no longer able to be downloaded, and thus are largely useless.

Run the following command in your Raspberry Pi’s Terminal to automatically clean these packages up.

sudo apt-get autoclean

12. Finally, the last thing we should do is reboot the Raspberry Pi to ensure that it loads in all the new packages and services correctly.

Simply run the following command to restart your Raspberry Pi.

sudo reboot

I hope that you now know how to upgrade from Raspbian Jessie to Raspbian Stretch without any issues. If you do happen to run into any issues or have any feedback, then feel free to drop a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *