Open Source Software
Upgrading a Raspberry Pi is easy with a little preparation

Upgrading a Raspberry Pi from Wheezy to Jessie

I recently realized that one of my Raspberry Pi’s running Network Caller ID (NCID) was running an unsupported version of Debian/Raspian and needed to be upgraded. The first instructions that Google listed omitted some steps that I knew should be included, so I have put together this page with the procedure that I used. The full (and best) document is the official guide on Debian.org.

Backup the Working System

Before doing any upgrade, you should do a backup of the system. In the case of a Raspberry Pi, it is easy to clone the SD, pull the original and upgrade the clone. Since this was a very minimal installation, I chose to backup only the /etc/ncid/ directory to the Subversion server that I use to keep modified configuration files. An ancient saying among system programs was “tape is cheap (no matter how much it costs).” You never need a backup until you do, and when you do, you really need it badly.

The upgrade process will remove packages that do not show up as having dependencies, and some packages may have unresolved dependencies. You may get into a situation where you have not recourse but to fall back and do a painstaking package-by-package upgrade.

Make Sure You Have Enough Free Space

Some upgrade programs are smart enough to check for the necessary free space to complete the upgrade. The Debian approach described here is not, and I know from experience that it will get ugly if you do not have enough free space. Make sure that you have plenty of free space before start; use the command

df -h

to find out how much free space you have available. If you are above 80% or so, you will probably have problems. Keep two windows open and at each step in the process run a df -h command to make sure that you have more space than apt-get updateindicates that it will use.

user@thisrpi /etc/apt/sources.list.d $ df -h Filesystem Size Used Avail Use% Mounted on /dev/root 13G 3.8G 8.4G 31% / devtmpfs 214M 0 214M 0% /dev tmpfs 44M 240K 44M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 87M 0 87M 0% /run/shm /dev/mmcblk0p5 60M 20M 40M 33% /boot

Make Sure You Have Time

The upgrade process may take a few hours, depending upon which Raspberry Pi model you have, the speed of your connection, and the complexity of your installation. Make sure that you have time to do this, and something else to work on while watching the console messages scroll past.

Upgrade the Current Release

The first step is to upgrade to current maintenance on the old release:

sudo apt-get update sudo apt-get upgrade

The next step will remove some unused dependencies. This sometimes breaks things if you have optional software installed outside the standard installer, and sometimes breaks dependencies even for software that was installed with the installer. Make sure you have a backup. This step is not absolutely necessary, but can reduce the upgrade time in later steps.

sudo apt-get dist-upgrade sudo apt-get autoremove sudo apt-get clean

Upgrade the /etc/apt Configuration Files

Next, upgrade the /etc/apt/sources.list file to change wheezy to jessie, then do the same for all files in the /etc/apt/sources.list.d directory.

Upgrade the System

This is the point of no return; make sure that you have a backup and sufficient free space. To upgrade the basic system, use the commands

sudo apt-get update

Some items may not update; raspberrypi.<collabora.com has been deprecated, so you will need comment it out in /etc/apt/sources.list.d/collabora.list. When you have resolved all repository issues so that you do not get errors, proceed with

sudo apt-get upgrade

When this is complete run the commands

sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get autoremove

Reboot and Test

At this point, you should be ready to reboot the system. Test all of your applications to make sure that they are working properly–especially those installed outside the installer.