In this tutorial, we walk you through the process of installing Ubuntu Desktop on a Raspberry Pi.
What you’ll learn
- How to create a bootable Ubuntu Desktop microSD card
- How to setup your Ubuntu Desktop for daily use
What you’ll need
- A microSD card (4GB minimum, 8GB recommended)
- A computer with a microSD card drive
- A Raspberry Pi 4
- A micro USB-C power cable
- A monitor with an HDMI interface
- A micro HDMI cable
- A USB keyboard
Prepare the SD Card
Following these steps will erase all existing content on the microSD card.
First, insert the microSD card into your computer.
You need to install the right Raspberry Pi Imager for your operating system. You can do this on ubuntu by running:
sudo snap install rpi-imager
Or on other operating systems follow these links:
Once this is done, start the Imager and open the “CHOOSE OS” menu.
Scroll down the menu and click “Ubuntu”.
You will then be able to see a list of Ubuntu downloads to choose from. Select the “Ubuntu 20.10 Desktop (Raspberry Pi 4)” option. As indicated in the imager this only works for the Raspberry Pi 4 with 4GB or 8GB RAM.
Select the image and open the “SD Card” menu. Select the microSD card you have inserted, and click “WRITE”. Then just sit back and wait for the magic to happen… (This magic might take a few minutes)
Boot your Desktop
Ensure your HDMI screen and a USB keyboard are plugged in before powering the Pi. You will be able to see the boot process on screen and, eventually, the first run wizard.
First, set your language:
Then set your keyboard layout. For British vs American keyboards you can use the ‘@’ and ‘ “ ‘ keys to check are in the right place for you.
Now pick yourself a timezone. This is used to give you the correct time and so it knows when to change for the summer:
Once that’s sorted we ask you to set up a user and set a password:
And finally, welcome to your Ubuntu Desktop:
(optional) USB Boot
You can also now boot from a USB attached hard-drive or SSD with no microSD card involved. You have to do this after booting from an SD card however because all Raspberry Pi 4 models ship with an EEPROM configuration that boots from SD cards only. But we can change that.
The first check you’ve got an up to date EEPROM version on your Pi 4:
sudo apt install rpi-eeprom
Extract the current bootloader configuration to a text file:
sudo vcgencmd bootloader_config > bootconf.txt
Next we need to set the
BOOT_ORDER option to
0xf41 (meaning attempt SD card, then USB mass-storage device, then repeat; see pi4 bootloader configuration for more information).
Alternatively vim bootconf.txt and make the edits yourself if you don’t like sed-hacking
sed -i -e '/^BOOT_ORDER=/ s/=.*$/=0xf41/' bootconf.txt
Now we generate a copy of the EEPROM with the update configuration:
rpi-eeprom-config --out pieeprom-new.bin --config bootconf.txt /lib/firmware/raspberrypi/bootloader/critical/pieeprom-2020-09-03.bin
Set the system to flash the new EEPROM firmware on the next boot
sudo rpi-eeprom-update -d -f ./pieeprom-new.bin
To apply any changes (the EEPROM is only updated during the early stages of boot)
Now we need to get the image onto a hard drive. That’s the easy part. If you roll this tutorial back to “Prepare the SDcard” and go through it replacing “SD card” with “Hard Drive” you’ll have it.
You should now be able to boot from your hard-drive. Congratulations.
Be aware that some drives have issues being used to boot the Pi. In particular:
- Spinning hard-disks required a lot more power than SSDs and will very likely require a powered USB hub.
- Hubs themselves can cause compatibility issues, so you’re better off with an SSD to boot off (typically no need for a hub and no spin-up time issues).
There’s lots of good information on both the Pi forums and various GitHub issues for debugging boot issues; here’s a selection of links in a rough “look at this first” order from our top Pi guy:
- Pi Forums: Is your Pi not booting?
- Pi Forums: USB MSD boot EEPROM
- Pi Forums: Pi 4 USB3 SSD slow speeds?
- Pi Docs: Pi 4 Bootloader Configuration
- GitHub Issue: Enclosure doesn’t power on after reboot
That’s all, folks!
You are done!
For more details about the Raspberry Pi Ubuntu Desktop you can refer to our website.
And from there explore other Ubuntu projects enabled for the Raspberry Pi like the Ubuntu Appliance portfolio.
You also might want to install some software on your Pi. Ubuntu has extensive repositories available, that you can browse at packages.ubuntu.com.
You can use the snap command to install snap packages. The Snap Store is where you can find the best Linux open source and proprietary apps to install on your Raspberry Pi and get started with any project!