Installing Ubuntu on a Raspberry Pi 4

To install Ubuntu on your Raspberry Pi 4 you’ll want to download the 32-bit Ubuntu Server image for full compatibility with accessories. Alternatively, you can download the more performant 64-bit Ubuntu Server image.

Once you’ve decided on the image to use download it to the “Downloads” folder.

Insert the microSD card (whose contents you want to erase!) into the system with the downloaded image.

Identify the microSD card’s address by opening the “Disks” application and look for the “Device” line. If the line is in the /dev/mmcblk0p1 format, then your drive address is: /dev/mmcblk0. If it is in the /dev/sdb1 format, then the address is /dev/sdb.

Now unmount it by right-clicking its icon in the launcher bar, the eject icon in a file manager or the square icon in the “Disks” application.

Open a terminal (Ctrl+Alt+T) to copy the image to your removable drive.

Run the following command in the terminal:

xzcat ~/Downloads/<image-file.xz> | sudo dd of= bs=32M

Then in the terminal also run:

sync

Now remove the microSD card, insert it into your Raspberry Pi 4 and power it on.

When you receive the login prompt use “ubuntu” for the username and password. On first boot cloud-init will perform some initial configuration of the device so you may not be able to immediately login. After logging in you will be asked to change the default password.

Keep in mind that the image we provide is a server one so there is not a desktop environment. However, you can easily install different ones via apt some popular ones are xubuntu-desktop and lubuntu-desktop e.g. sudo apt-get install xubuntu-desktop and sudo apt-get install lubuntu-desktop.

Enjoy!

5 Likes

I haven’t seen it mentioned in the documentation, but since sshd is installed there’s no need for a keyboard and monitor. I was able to set up my Pi 4 headless. I just ran ssh ubuntu@ubuntu.

Also, I noticed the ZFS kernel modules are missing from the 64-bit image. Is there a reason for this?

Thanks.

The basic reason is that until the Pi 4, the platform has always been considered to have too little RAM to use ZFS in a realistic manner. The 4Gb variant of the Pi 4 changes that somewhat, although it’s notable that most guides still suggest considerably more RAM than that, and I’ve no idea how it would perform on relatively slow SDIO-based storage (using it with a USB3-attached drive might be viable though).

If you wish to experiment, you can still install the kernel modules relatively easily with:

$ sudo apt install zfs-dkms

This should also pull in the zfs-zed daemon and zfsutils-linux packages, but be prepared for a fair bit of compile time. The result appears to runs happily on all the Pis I attempted (a 3B and a 3B+ with 1Gb of RAM, and a 4B with 4Gb of RAM) but I can’t vouch for the performance; I only ran a few brief tests setting up a zpool on some spare storage, and playing around with some volumes and snapshots to see if it worked. I didn’t see any drastic dips in available memory, but then I didn’t delve into anything involving de-dupe (apparently a bit of a memory-hog).

It might be worth re-visiting the question of ZFS kernel modules for the Pi at some point; to that end, do let us know how you get on with it (if you decide to try it)!

I’ve set up my 4GB Pi 4B as a Time Capsule for use by macOS systems for Time Machine backups. I’m using a USB3 SSD for storage, and that’s where it would be convenient to use ZFS.

I’m not sure I want to have a whole compilation environment installed on my little appliance so I probably won’t try zfs-dkms, but if the ZFS modules are included in the future, say in Focal, I’ll certainly give it a try.

Thanks.

Would you please file a launchpad bug against the kernel requesting zfs for arm64 for the pi? I’d like to get it on the team’s backlog.

1 Like

It looks like a bug was already filed: #1852119.

Thanks.

1 Like

The Raspberry Pi 4 model B comes with different choices of RAM: 1GB, 2GB and 4GB. However, our official support for this board is currently limited to the 1GB and 2GB versions. Due to a kernel bug, USB ports are not supported out of the box in the official arm64 image on the 4GB RAM version. Kernel fixes have been identified by Canonical engineers. We are currently testing these fixes extensively. We will push updates within weeks, following successful test completion.

Is this still an issue with 4GB Pi 4s?

No, it is fixed with the latest images

1 Like

I’m also interested in using a pi4 as a low power NAS server. I just got a 4Gb model, and I’ll try the zfs-dkms route and gauge the performance on an external USB3 HDD. So far I’ve been happy with a simple hdparm -t test, which on the pi4 shows the same performance on that external disk as when it’s plugged in on my X1 laptop.