Updating Raspbian on your microSD for the Raspberry Pi 2
So, you have bought yourself a Raspberry Pi 2 to supplement your previous Raspberry Pi, but you want to use the same microSD card as the old Raspberry Pi? The processor in the new Raspberry Pi2 is based on the ARM 7, with the old Pi (models A, A+, B and B+) based on the ARM 6. What this actually means is that the Raspberry Pi's brain has been upgraded to a newer version, with the side effect of the original operating system needing an upgrade to work on the Raspberry Pi2. You can't just plug the old microSD into to the new Raspberry Pi2 without first upgrading the operating system.
There are three options:
- Download the new version of Raspbian from the Raspberry Pi website and overwrite your microSD card.
- Copying the files from the microSD card onto a memory stick and use option 1. We will be covering this in a future tutorial.
- Upgrading the operating system on the microSD card, keeping everything else in place.
With option 1 you will lose everything on your microSD card, including all your hard work and configurations. While it's nice to have everything new, it's not necessary and why should you use all your hard work?
Option 2 is the next best thing - you can keep some files, but you will lose the configuration, settings and any programs that you have installed.
Option 3 is the best option. You can upgrade the operating system on your Raspberry Pi so that it will work on your new Raspberry Pi2. In fact, after upgrade it will work in both the old Raspberry Pi and the new Raspberry Pi2, so you have the best of both worlds!
How you upgrade your OS depends on whether you have NOOBs or if you have installed the Raspbian image. Both start exactly the same, but the NOOBs upgrade requires a download from the web and copying of some files.
As always, when you are going to do anything to your microSD card, you should always back it up. How you do this will depend on what other computers you have and their operating system. I'm not going to cover how you can do this here, you should search the internet for a phrase like 'backup Raspberry Pi sd card on windows 7/osx/mac' (insert your OS).
Once the card has been backed up, put it in your original Raspberry Pi (models A+/B+, or using an SD card adaptor with models A or B) and make sure the Raspberry Pi is connected to your network. Start the Raspberry Pi, and log in. If your Raspberry Pi boots into the graphical interface, open a terminal window.
First, we're going to get the latest list and version of 'packages' from the Raspbian 'repositories'. 'Packages' are the apps or software that runs on the Raspberry Pi. 'Repositories' are places to download the 'packages', like the Play Store or App Store. Type in the following:
sudo apt-get update
Next, we're going to tell your Raspberry Pi to search through the lists it has just got and update any packages that it already has that has new versions:
sudo apt-get upgrade
Depending on how long it has been since you last updated or wrote the operating system to your Raspberry Pi, this may take some time. Leave it to complete.
In December 2014, the Foundation released an updated look and feel of Raspbian. The way to tell the difference is in the old version, the menu bar is at the bottom of the screen. In the new version, it is at the top. Lots of other things have changed for the better too. To get the update, use the following two commands:
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods
If you started from the plain Raspbian image, then you're done. If you have a NOOBs microSD card (perhaps one that you bought from the Pi Hut) then there are a few extra steps you need to go through. You will need to do this on a PC or Mac, I'm afraid.
In both cases you should now shut-down your Raspberry Pi so that you can remove the microSD card using either of the following commands:
sudo halt
or
sudo shutdown -h now
Once the Raspberry Pi has stopped, unplug everything and remove the microSD card.
If you have NOOBS, insert the microSD card into a card reader and into your PC/Mac. Download the latest 'NOOBs Lite' zipped image from the Raspberry Pi website:
http://www.raspberrypi.org/downloads/
Unzip the download, and extract everything from the ZIP file to a directory. Copy everything from the extracted ZIP EXCEPT for 'recovery.cmdline' to the top directory of your microSD card.
Once completed, remove the microSD from your PC.
You are now ready to insert the microSD card into your new Raspberry Pi2 and boot it up. You should notice that your Raspberry Pi2 boots really quickly compared with the old Raspberry Pi, and see the four raspberries at the top indicating four cores. Enjoy the speed!
NOTE: Some people are asking whether you should also run 'rpi-update'. The answer to that is 'no', you do not need it. In fact the advice is not to use it unless you absolutely have to have the very latest, bleeding edge software which may still be buggy and could stop parts of your Raspberry Pi from working.