How to install Ubuntu Desktop on Raspberry Pi 4

Key Value
Summary A complete guide to installing Ubuntu Desktop on a Raspberry Pi 4 (4GB or 8GB).
Categories iot, desktop, raspberrypi
Difficulty 1
Author oliver.smith@canonical.com

Overview

Duration: 2:00

In this tutorial, we walk you through the process of installing Ubuntu Desktop on a Raspberry Pi. If you are looking to install Ubuntu Server on your Raspberry Pi, you can follow this link to that tutorial

Join us on YouTube to learn more about Ubuntu Desktop for 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 (9GB minimum, 16GB 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

Duration: 5:00

:warning: Warning
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 click “Other general-purpose OS”.

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).

Now you have your Ubuntu SD card. Before going on, make sure your Pi is off and insert this SD card. This is what the Pi uses to load all the software you’re about to use.

Boot your Desktop

Duration: 2:00

Now, ensure your HDMI screen and a USB keyboard are plugged in before plugging in and powering on the Raspberry 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 that they 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) Boot from USB with an external SSD

Duration: 5:00

Using an external SSD connected to your Raspberry Pi via a USB 3.0 port can dramatically improve performance as well as give you more flexibility for your storage.

All 8GB Raspberry Pi 4s and newer 4GB models are pre-configured to boot from a USB drive automatically as long as there is no SD card inserted.

For older 4GB models released pre-2021 there is some additional configuration required which is linked on the Discourse version of this Tutorial.

The easiest way to spot if your Pi will support USB boot out-of-the-box is by looking for the trio of black squares between the power supply port and the nearest micro-HDMI port that is only present with the newer models.

The process for using an SSD with your Raspberry Pi is exactly the same as for an SD Card. Simply connect the SSD you want to use to your computer and launch the Raspberry Pi Imager. Select Ubuntu Desktop as your Operating System as before, but this time select the SSD as your Storage option.

The flashing process should continue exactly as before.

When you connect the SSD to your Raspberry Pi and power it on it should automatically boot from the external drive!

:warning: Remember!
Make sure you don’t have an SD Card inserted if you want to boot from USB.

That’s all, folks!

You are done!

For more details about the Raspberry Pi Ubuntu Desktop you can refer to our website.

You might also 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!

Further Reading

Check out these tutorials for ideas on other Pi Projects!

And for more advanced users:

6 Likes

Per this page ( https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md ) the default is already 0xf41, unless the firmware is older than 2020-09-03.

Per this page ( https://github.com/raspberrypi/rpi-eeprom/blob/master/firmware/release-notes.md ) the 2020-09-03 firmware is the default (critical folder).

So as long as the user has the latest critical version, none of the extra steps should be required.

The sed command to replace the boot_order on bootconf.txt is not proper, you have to change it to this one, as you are also replacing the ‘=’ sign, but not adding it.

This should be the correct one:
sed -i -e '/^BOOT_ORDER=/ s/=.*$/=0xf41/' bootconf.txt

Ah, thanks, good catch, fixed.

Seems the desktop install perhaps takes more than 8GB? If so, the instructions should reflect this.

1 Like

Desktop install needs 8.8GB so the suggested size of SDCARD needs to reflect this. It won’t work on a 4GB or 8GB SDCARD

1 Like

rpi-imager starts fails if you use pi 4 with 64-ubuntu operating system!

Assuming this guide is aimed at beginners, it would presumably be helpful to state, prior to the ‘Boot your Desktop’ section, to actually include something along the lines of “with your Pi powered off, insert your new microSD card, and then turn the pi on”. As it stands, it looks like I’ve written my OS to my microSD card, but done nothing else, then expect my pi to boot into Ubuntu. Might be stating the obvious, but I don’t think so.

1 Like

Changing the pi to boot from SSD does not work as stated if the USB adapter is not recognised by the installer. To get this to work I used an SD card and completed the install fully as specified and changed the boot order on the PI.
I then removed the SD card and put it into another Linux computer with the USB SSD plugged. The SSD partitions need to be re-sized (using gparted) to match the SDcard and then the dd commaned used ( “dd if=sdcard-partition of=ssd-partition”) to copy both the boot partition and the “writeable” partition to the SSD. Once copied the “writeable” partition on the SSD can then be expanded to the size of the SSD.
If the USB SATA adapter for the SSD is not recognised by the boot loader, the SSD will fail to be read correctly and you will get block errors. If this is the case, the boot partition of the SSD needs to be mounted on a different Linux computer and the cmdline.txt file edited to use usb-storage.quirks. There is an excellent article on this here: https://jamesachambers.com/raspberry-pi-4-usb-boot-config-guide-for-ssd-flash-drives/

1 Like

Suggestion for a change:
Then set your keyboard layout. For British vs American keyboards you can use the ‘@’ and ‘  ‘ keys to check that they are in the right place for you.

2 Likes

Great article, I chose to install Ubuntu Server 20.04 and everything booted correctly except for one small detail. I was being prompted for a password which I did not know. Just wanted everyone to know that the default username and password are ubuntu/ubuntu . That information will save you the effort of googling an answer for that. Thanks!!

1 Like

This is given in another tutorial specifically for the Ubuntu Server install :smile: I’ll make sure that’s flagged here too though in case people find their way here looking for the server tutorial, thanks for your comment :slight_smile:

Hi, thanks for enabling my favorite desktop for my favorite platform! It installed very nicely. I installed using the rpi-installer v1.5 which has some changes in the UI - you may want to consider updating the screenshot instructions accordingly.

1 Like

Before picking a timezone and after setting the keyboard layout, there is another screen for connecting to a network. But the corresponding text (and screenshot) are missing in the set of steps shown in the tutorial.

The USB Boot step is way more complicated than it should be.
In the official documentation it’s mentioned that all you need to do is:

sudo -E rpi-eeprom-config --edit

then set the BOOT_ORDER option to 0xf41 (that part is correct), then reboot. The rest of the commands ( vcgencmd, sudo rpi-eeprom-update etc.) are pretty much useless.
I was setting this up with a brand-new Pi 4 (8 Gb), which had BOOT_ORDER set to 0x1 by default (no idea why), but it was in fact really easy to fix it with a single command above.

password ubuntu and login ubuntu are not working… any update on this?

Need a section on when it doesn’t work. No graphical interface just ‘user ubuntu login’

so long ubuntu

USB Boot Information for older Raspberry Pi models

:warning: This is a subsection from a previous version of the tutorial aimed at older Raspberry Pi 4s (more specifically 4GB Pis released prior to 2021) posted here for reference.

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)

sudo reboot

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.

:warning: Warning
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:

3 posts were split to a new topic: RPi4 takes too long to boot

On a raspi 4 8gb I installed 20.04 on SD-Card following the manual. It’s great working. The next step is the change to a bootable ssd. The described instruction I can follow. But there is a problem with the last step.

“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.”

There can I find “Hard Drive”? I find only “SD-Karte”.


Could you give a instruction step by step for beginner. Thanks!