Upgrade your Raspbian Pi

From Wheezy to Jessie

Heike Jurzik

The upgrade from Raspbian 7.8 ("Wheezy") to Raspbian 8.0 ("Jessie") is fairly simple and only takes a few shell commands. We guide you through the process.

The Raspbian operating system [1] used with the Raspberry Pi is an unofficial port of a famous Linux community distribution known as Debian GNU/Linux [2]. The Raspbian developers start with the Debian base files and adapt the file collection, adding libraries, drivers, and other components as necessary to create an environment that is tailored for Raspberry Pi systems and their hardware.

Raspbian versions take their names from the Debian edition on which they are based. The latest version, Raspbian Jessie, is based on the Debian 8.0 "Jessie" release [3]. It typically takes some time for the Raspbian developers to adapt a Debian release. Raspbian's Jessie edition, which is part of the NOOBS DVD attached to this issue, just appeared recently, although Debian Jessie has been around for several months. Prior issues of Raspberry Pi Geek have included the previous Raspbian "Wheezy" edition. (Do the names sound familiar? All Debian editions are named for characters in the movie Toy Story.)

If you are currently running Raspbian Wheezy, the easiest way to upgrade to the Jessie version is to write the latest Raspbian image [4] to a new SD card. However, you might not want to replace your whole operating system. Perhaps you have spent some time installing the applications you need for your environment, and you like your files where you have them now – maybe you don't want to start over.

The alternative approach is to upgrade the underlying system through Raspbian's package management tools. Rather than starting over with a new generic system, a package upgrade will build the changes into your existing system. Debian 8.0 Jessie updates thousands of software packages, which you can include in your current configuration without having to customize all over again.

A few shell commands will update the list of packages, upgrade all the packages on your system and, if needed for a package upgrade, install extra packages or remove old ones. Bear in mind that you need an Internet connection to upgrade through the package system. All steps can be performed while the Raspberry Pi is running. You will only have to reboot once – to boot the new kernel and use the new init system (systemd).

Preparing the Upgrade

Before upgrading your system, it is a good idea to make a full backup of your SD card, or at least of your personal data and the configuration files you can't afford to lose. Although, I have upgraded many Debian servers without any complications in the past, I strongly recommend being on the safe side.

Also, make sure you have sufficient disk space for the upgrade. You can use the df command to check how much space is available on the SD card (Figure 1).

Figure 1: The df command displays the amount of disk space available. Use the -h option for human-readable output.

Note that you must be logged in as root to perform the following commands because you will be modifying the system packages. On a Raspberry Pi you can use the sudo command to gain administrator privileges:

huhn@raspbi:~> sudo -i
[sudo] password for huhn:
root@raspbi:~#

Note that the root prompt is a hash mark (#).

The Raspbian upgrade can be done locally, which means you have the Raspberry Pi attached to a monitor and have plugged in a USB keyboard. In that case you should switch to one of the text consoles (Ctrl+Alt+F1, Ctrl+Alt+F2, etc.) because the X server – and therefore your desktop session – may get restarted. Alternatively, you can log in from a remote machine via SSH.

For extra safety, use the screen program [5], which allows you to keep processes running after logging off. If the restart of the SSH service kills your connection, it's easy just to log back in and re-attach the screen session (screen -dr), where the upgrade process should still be running.

Update Raspbian Wheezy

The first step is a full upgrade of the current Raspbian Wheezy system. Make sure the list of packages is up-to-date:

Now the existing system should be fully up-to-date. To be on the safe side, check for any partially installed packages and for missing or broken configuration files:

root@raspbi:~# dpkg --audit

If you see no errors or warnings, it's safe to continue. In case of messages like – The following packages are in a mess due to serious problems during installation – check the status of the packages listed. Sometimes it helps to re-install a package,

apt-get install --reinstall <package name>

and sometimes it's easier to remove it and see if you can get a newer version after the upgrade.

Buy Raspberry Pi Geek

Related content

Noise can be nerve wracking and lead to all kinds of problems with neighbors and area residents. A simple gadget can help you establish whether the noise coming from your premises amounts to a nuisance.

It does not take long to install and configure Raspbian on an SD card. However, for users who need to repeat the same steps time and again on multiple Pis, there is an easier, less boring way to get the job done. This comes in the form of simple shell scripts which can automate installation.