Since I discovered that Ubuntu MATE was available for the Raspberry Pi2 I have been thinking of writing up some instructions for anyone who might be thinking of downloading the image and copying it to a micro SD card using Debian.
Although it is derived from the older GNOME2 desktop it is still quite a big ask for a Raspberry Pi run MATE (if you want a light weight desktop environment you should consider LXDE instead) but with the additional processing power available in the Raspberry Pi2 it becomes a lot more usable.
I’m still amazed that a credit card sized computer costing about £35 can run a full blown desktop distribution like Ubuntu.
Note – You will need a 4GB micro SD card to hold the expanded MATE image.
The first thing we need to do is download an image of the micro SD card from source forge – unless you have a very fast internet connection this will take a while (so you could spend some time reading my other Raspberry Pi posts). If you don’t want to use the command below you can find also find the link on the Ubuntu MATE download page.
$ wget -c http://master.dl.sourceforge.net/project/ubuntu-mate/15.04/armhf/\ > ubuntu-mate-15.04-desktop-armhf-raspberry-pi-2.img.bz2 : : : Length: 947220777 (903M) [application/octet-stream] Saving to: ‘ubuntu-mate-15.04-desktop-armhf-raspberry-pi-2.img.bz2’ ubuntu-mate-15.04- 100%[===============>] 903.34M 518KB/s in 29m 58s
Then we need to insert the micro SD card we are going to copy the image to and unmount any partitions that are automatically mounted. If you specify the wrong device things are going to go wrong particularly when writing the image as there is no undo function! To help determine which device is the micro SD card you can use this script.
Assuming that the script reports that the micro SD card is ‘sde’ then we can use ‘mount’ to check if we need to unmount any existing partitions, these will be overwritten when we write the new image to the card. In this case there are two mounted partitions ‘/dev/sde1’ and ‘/dev/sde2’ so I have to unmount both partitions.
$ mount |grep sde /dev/sde1 on /media/system/PI_BOOT type vfat /dev/sde2 on /media/system/PI_ROOT type ext4 $ umount /dev/sde1 $ umount /dev/sde2
Then we can use ‘bzip’ to expand the compressed image and write it to ‘/dev/sde’ using ‘dd’, I have not yet encountered any problems using ‘dd’ but there are reports of issues on some distributions. I also found that specifying a block size of 32K when writing the image to the micro SD card speeds things up quite a bit, but both expanding the image and writing it to the micro SD card will take a while.
Note – To write the image we need to be running as the superuser (root) so also need to use ‘su’.
$ bzip2 -d ubuntu-mate-15.04-desktop-armhf-raspberry-pi-2.img.bz2 $ su Password: # dd if=ubuntu-mate-15.04-desktop-armhf-raspberry-pi-2.img \ > of=/dev/sde bs=32768 120000+0 records in 120000+0 records out 3932160000 bytes (3.9 GB) copied, 378.261 s, 10.4 MB/s # sync;sync;sync # exit $
The ‘sync;sync;sync’ command is important as when the ‘dd’ command completes there will be some data still in memory waiting to be written to the device, this is normal behaviour for most Unix like systems. The output buffers will be flushed to the disk at some point, but by synchronizing the file system manually we can make sure that it is safe to remove our SD card, and yes, it folklore dictates that it does have to be done three times (though I can’t remember exactly why anymore!).
Than all you need to do is insert the micro SD card in your Raspbery Pi2, boot, and wait while it loads.
Raspberry Pi is a trademark of the Raspberry Pi Foundation