NOOBS For Raspberry Pi

PDF Printer    Send article as PDF   

NOOBS is the latest user friendly installation system from the Raspberry Pi. It allows you the ability to choose one of 6 (currently) Operating Systems to run on your Pi. You can pick and choose and change your OS at any time you wish simply by rebooting and holding the SHIFT key down. However, any user data on the SD card will be lost each time.

NOOBS is “New Out Of Box Software” by the way. Want to know more? Read on…

There are plenty of places on the web that tell you how to use NOOBS to set up a system, but so far, they all assume one thing, that you are using some flavour of Windows. I’m not.

One fine example is this video on You Tube – http://www.youtube.com/watch?v=TyFDaMpdh2c

So, what follows is a quick and easy guide for the Linux user to get a new SD card ready for use in their Raspberry Pi.

Initialise Your SD Card

The SD card needs to be formatted as FAT32 initially. Most cards come with this formatting, but if you have stolen a card from a camera or similar device, it might be best to properly initialise it. Just in case.

You will need a 4GB or larger card. NOOBS adds a recovery partition to the card which uses up some space, and holds the various distros and support files for the “recovery” process. Basically, the installer lives on the card.

The following assumes you have root privileges, so either su - or prefix all commands, unless otherwise advised, with sudo If you see commands prefixed by a ‘#‘ prompt, that means that the command should be run with sudo or as root. If the commands have a ‘$‘ prompt, then you can run those commands as your normal user.

My laptop comes with an SD card slot, which is always device /dev/mmcblk0 and partitions on the SD card are named as /dev/mmcblk0pn where the ‘n’ part starts at 1 and increases as desired.

First we need to find the device, assuming your system is different to mine. The easiest way is to run the following:

# fdisk -l

The parameter is a lower case L for “list”. This command lists all the mounted and unmounted devices on your computer. Make sure you don’t have the SD card in the slot yet though!

Now, insert the card, and run the command again. If you are prompted to mount the card or open it in a file manager etc, ignore it. We don’t want or need the card to be mounted.

As mentioned, some Linux distros may auto-mount the SD card when you put it in the slot. If yours does, then unmount it or “safely remove” it – whichever option you are given.

On my Linux Mint laptop, under KDE, I get prompted with a pop-up telling me what partitions are on the newly inserted card, and offering me the choice to open in Dolphin or just to mount the partition. If I ignore the pop-up for 5 seconds or so, it vanishes, and the card remains unmounted.

If you use KDE and Dolphin, and if the card is auto-mounted, open Dolphin, find the SD card on the list of devices down the left side, right click it and the top option is to “safely remove” the device.

You might need to “safely remove” all the partitions on the SD Card, not just one, if all of them have been auto-mounted.

Compare the two listings and you should see something like the following:

...
...
Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000dbfc6

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192      122879       57344    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          122880    15523839     7700480   83  Linux

In my case, I know the SD card is 8GB in size, so the above difference in before and after leads me to conclude that /dev/mmcblk0 is indeed my SD card.

The above listing is from a card that already has been used in my Pi, it has two existing partitions – which I’m about to wipe!

Now that we have a device, we can create the single partition we require:

# fdisk /dev/mmcblk0

The above command takes you into the fdisk utility that allows you to manipulate (and destroy!) your SD card. It must be run as root, or using sudo.

If you have existing partitions on the device, delete them using the ‘d’ command. (Use the ‘m‘ command to get a list of available commands if you need to.)

Command (m for help): d
Selected partition 1

You will be prompted for the partition number each time, so repeat until you have deleted them all. Listing the existing partitions afterwards should show the following:

Command (m for help): p

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System

Now we can create a single new partition, the ‘n‘ command does this:

Command (m for help): n

Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p

Partition number (1-4, default 1): 1

First sector (2048-15523839, default 2048): 
Using default value 2048

Last sector, +sectors or +size{K,M,G} (2048-15523839, default 15523839): 
Using default value 15523839

The above creates a primary partition, numbered 1, with the default start and end sector values. This creates a single partition over the entire SD card, with a bit of space left – as required – at the start.

Use the ‘p‘ command to check all is well:

Command (m for help): p

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048    15523839     7760896   83  Linux

So far so good, except the partition type is Linux and not FAT32. We need to change it. The ‘t‘ command is our friend:

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): l
...
...
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi eb  BeOS fs        
...
...
Hex code (type L to list codes): b
Changed system type of partition 1 to b (W95 FAT32)

Again, use the ‘p‘ command to check all is well:

Command (m for help): p

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048    15523839     7760896    b  W95 FAT32

Some people may have problems getting their card to boot in the Raspberry Pi when wiped and re-partitioned like this. If you have that problem, simply make the new partition bootable using the a command.

I didn’t need to do this on my card(s) but I have heard from people who do. Strange that some cards need bootable partitions while others don’t.

When NOOBS’ own installer takes over, it will partition the card to suit itself, and set bootable flags as desired. And it won’t be the partition you created that NOOBS makes bootable, it will be a small one, located right at the very end of the card, which holds the NOOBS installer.

All that remains now is to write the new partition table to the SD card. The ‘w‘ command does this:

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.

Fdisk will exit when we write the partition table.

So far, all we have done is to create a new, blank, partition and although we told fdisk that it would be FAT32 we have yet to format it. We need to do this now, however, be careful to format the partition and not the device.

# mkfs.vfat /dev/mmcblk0p1

mkfs.vfat 3.0.12 (29 Oct 2011)

That’s done when you get back to the prompt. Now we can get the software.

Download the NOOBS Software

Go to http://www.raspberrypi.org/downloads and at the top of the page, you will notice the section entitled “New Out Of the Box Software (Recommended)” – that’s where we need to be.

Click on either the torrent or direct download links. To save bandwidth on the main servers use the torrent link – if you have a torrent client installed, otherwise, click the direct link.

When prompted, save the file to a good location, I use Downloads/RaspberryPi/distros in my home directory. Your location might possibly be different!

It takes about 10 minutes to download, depending on your bandwidth and the busyness of the server. I was getting around 1800 Kb per second download speed, and the file itself is 1.1 Gb in size – well, it does have 6 different distros inside it!

While it’s downloading, have a cuppa!

When it is finished downloading, it is best to verify that what you have is exactly what you should have. The download page shows a SHA1 checksum of, currently, “ab69df2c48cf32abfb06934937ce3ebf249c278e” so, open a shell session and verify the download:

$ sha1sum Downloads/RaspberryPi/distros/recovery_v1_1_complete.zip 
ab69df2c48cf32abfb06934937ce3ebf249c278e  Downloads/RaspberryPi/distros/recovery_v1_1_complete.zip

You don’t need to be root to do this, so sudo is not required. Compare the two checksums and if they are both the same, carry on, otherwise, the download is probably corrupt. Download it again.

Copy to the SD Card

Now we need to mount the SD card, so eject it and put it back in again. This time, if you are prompted to open it in a file browser, do so. You can find out where it was mounted by running the mount command, as your normal user, and search from the partition name as above:

$ mount | grep -i mmcblk0p1

You should see something like:

/dev/mmcblk0p1 on /media/F493-CE5C type ....

We need to be in a shell session in the above location, so :

$ cd /media/F493-CE5C

And now we are ready to extract the software to the SD card. This is a simple unzip command as follows:

$ unzip /home/norman/Downloads/RaspberryPi/distros/recovery_v1_1_complete.zip 

Archive:  /home/norman/Downloads/RaspberryPi/distros/recovery_v1_1_complete.zip
 extracting: BUILT-05-27-2013        
 extracting: RECOVERY_FILES_DO_NOT_EDIT  
  inflating: bootcode.bin            
   creating: images/
 extracting: images/Archlinux.png    
...
  inflating: riscos-boot.bin         
   creating: slides/
   creating: slides/Archlinux/
...
  inflating: slides/RISCOS/C.png     

That’s it. The software is installed on the SD card, and is ready to be used. We need to get out of the SD card though, and unmount it before we can use it in the RaspberryPi.

$ cd
$ sudo umount /dev/mmcblk0p1 

Installation of Your Chosen OS

Insert the SD card into your RaspberryPi, with the power disconnected and then connect the power.

A mini-system will appears and start reorganising the SD card layout. Partitions will be resized and new ones created and so on. You will end up with an SD card with three partitions, the normal two, plus a new recovery partition.

Once the partitions have been resized and created as required, you are presented with a menu screen where you may select an Operating System to install.

Select the chosen OS, and click on the “Install OS” button. Take note of the warning that appears next – if you are planning to try another distro, then any existing data on this SD card will be obliterated when the new OS is installed. This isn’t a problem on the very first use of the SD card, but might be if you have been using one particular distro for a while but wish to try another.

If you need to preserve your data, make a backup of at least your Home directory.

Click the “yes” button to install the OS. Then go and have another coffee because it takes a wee while to write the OS to the SD card. My own device gives me about 2.8 MB per second and there is around 2 Gb to write – depending on the chosen OS – so that’s about 11 minutes. (I was trying out the Arch distro this time around.)

At the end of the installation, click the OK button and the Pi will reboot into the new OS. You might have some configuration to do on first use, that depends on the OS in question.

Reinstallation and Recovery

If you need to reinstall, or recover from a huge foul up, you should first attempt to backup any data that you have been creating. The recovery process will trash it without trace.

Of course, if the system is so badly trashed, you might not be able to take a backup, but at least try!

Boot the RaspberryPi from the SD card again, and when prompted on screen (for about 3 seconds) press and hold the SHIFT key. Any one will work.

The installation menu will appear again, simply follow the instructions in the Installation section above to recover your OS. Alternatively, choose a new OS to try out – there are 6 to choose from:

  • Arch
  • Raspbian
  • PiDora
  • OpenELEC
  • RaspBMC
  • RiscOS

Have fun.

1 Comment to "NOOBS For Raspberry Pi"

  1. Y-geo's Gravatar Y-geo
    June 22, 2013 - 10:22 am | Permalink

    Norman,
    thank you for writing a sane how-to
    I managed to mangle 4 SD cards of 8gb and bigger following the terrible windows versions of doing such a simple task.
    I have had my Pi running as a media center for about 4 months with various versions/flavours of XBMC
    I have been running my main box on Linux for nearly 15 years but consider myself a NOOB since Linux just seems to work and very rarely causes me to dive under the “bonnet” to fix things.

    What i would like to get running is the ROS (robot operating system) running on the Pi and i was hoping that this new new recovery system was going to be useful for that, but frankly I think it is still to bleeding edge for that yet may be some thing for the long winter evenings :-}
    Thanks again for your work, I am going to look thro your Arch linux notes as you say a rolling version is better than a replace version set up.

Leave a Reply

1 Trackback to "NOOBS For Raspberry Pi"

  1. on April 17, 2014 at 8:08 pm