Introduction
In this article, I'm going to show you how you can setup Ubuntu 26.04 Server on a Raspberry Pi. I used a Pi 4 B 8GB but the process is the same for other supported models.
I'll also show you a fix for a bug in the network setup that kept cropping up after the first boot of the Pi 4, but this might impact other models as well.
I will only be covering the setup using a MicroSD card. Some Pi's support booting off a USB SSD or hard drive and in the Pi 5's case, an NVMe PCIe SSD, but this is out of scope for this tutorial.
YouTube Video
If you would prefer to see a video of this article, there is a YouTube video available below. This also covers setting up Ubuntu 26.04 Desktop. The timestamp for Ubuntu 26.04 Server setup starts at 4 minutes and 26 seconds.
System Requirements
I'll quickly go over the system requirements for 26.04 Server. You'll need:
- The Raspberry Pi Imager tool installed on a PC or Mac. It's available to download for Windows, Mac and Linux from here. The version I used is 2.0.10.
- A supported Pi. All of them require a minimum of 1GB ram. The supported models are:
- A Pi 5, Compute Module 5, Pi 500 and 500+.
- A Pi 4, Compute Module 4 and the Pi 400.
- A Pi 3B, 3B+ and Compute Module 3.
- A Pi Zero 2W. Although this model doesn't have 1GB RAM (it has 512MB), Ubuntu does support it but I personally would not recommend using it. The reason is that a fresh install of Ubuntu 26.04 Server uses around 345MB of RAM at idle, so there isn't much left to work with.
- A Class 10 or UHS-1 MicroSD card with 32GB of Storage. The minimum is 4GB but I wouldn't go lower than 32GB. You likely would also struggle to find cards lower than 16GB these days. The MicroSD cards I usually use are SanDisk Extreme or Extreme Pro but other vendors will work as well.
- A MicroSD Card reader for your PC or Mac.
- A Power adapter for your Pi.
- An Ethernet cable if you want to run it using a wired connection. For servers, I would always recommend running them over a wired connection instead of Wi-Fi.
- And lastly, a case to house it in.
That is all you need to run it headless. If you want to, you can attach a keyboard and monitor if you want to access the command line console.
Imaging The MicroSD Card
Before you start, make sure that all the data on the MicroSD that you want to keep is backed up off of it. The card will be erased during this process.
1 - To begin with, open up the Pi Imager tool once you have installed it.
2 - Click On App Options and disable "Eject media when finished".
3 - Click save. An adjustment to one of the files on the MicroSD card will need to be made so we don't want to eject it until that is done.
4 - Select your Pi from the list and click next.
5 - Scroll down to "Other general-purpose OS" and click it.
6 - Select Ubuntu.
7 - Select Ubuntu 26.04 Server (26.04) and click next.
8 - Select your SD Card from the list of storage devices and click next.
9 - You'll then be asked to customise the OS settings. You can skip it if you want.
10 - Set the hostname for your Pi and click next when you are done.
11 - Set the local settings for your area and click next.
12 - Set the username and password and click next.
13 - Set the Wi-Fi SSID and password, if you want to use Wi-Fi. If not, leave these fields blank. Click next.
14 - For Enable SSH, set it to on and use either of the authentication methods that you would prefer. The simplest is password authentication. Click next when done.
15 - Click on Write.
16 - Double check the MicroSD Card is the right one and click "I understand, erase and write".
17 - Enter your password for your account on your PC or Mac, if asked and click ok.
18 - The MicroSD card will now be written to.
19 - Click Finish when it is done.
Fix For Network Issue
Now, if you were to eject the MicroSD card and put it into the Pi and boot it up, it will look like it worked fine, which for the most part is true, but there is an issue at the moment.
That issue is that during the first boot, for some reason, it doesn't bring the system-networkd service back up after applying the netplan config, as shown below.
The network interface (eth0) shows as up but has no IP address assigned due to it not being able to request one via DHCP.
This means that you cannot SSH to the Pi or even get a ping response from it.
I did some troubleshooting and there wasn't anything obvious as to why that is. The netplan config was ok, and I could see that it had applied it in the /etc/netplan config file (see image below) that Ubuntu creates from the custom config that is part of the imaging process.
This could be specific to the Pi 4, but I don't have a Pi 5 to test with so it might work fine on that.
To resolve it, there are three fixes I found. You only need to do one of them and it would require a monitor and a keyboard as you'll need access to the console.
- restart the systemd-networkd service by running
sudo systemctl restart systemd-networkd. - Reapply the Netplan config by running
sudo netplan apply. - The last option is to run
sudo rebootto reboot the Pi.
In each case, the network will come back up and any future reboots will not have the problem. It only occurs on the first boot after a fresh image has been applied.
If you want to avoid having to attach a keyboard and monitor and have it do one of the fixes automatically when it is booting up for the first time, do the following:
- Before you eject the MicroSD card after writing the image to it, open up a text editor such as VS Code.
- Open up the MicroSD card in Finder, Windows Explorer or your file manager in Linux.
- Drag and drop the user-data file into VS Code.
- Under the runcmd section at the bottom of the file, add a new line after the command or commands that are in there, followed by two spaces, a dash, another space and one of these three options (I usually opt for the netplan apply option). Only one is needed so the choice is yours:
[ netplan, apply ][ systemctl, restart, systemd-networkd ][ reboot ]
- Save the file. The result should look similar to the below.
Close the file and then close VS Code.
Any commands that are under the runcmd section will only run on the first boot. They will not run again.
You can now eject the MicroSD Card and install it into your Pi. It should now work as expected, with the network connection(s) working correctly.
I hope that was of use to you. Thanks for reading and have a nice day!






















Top comments (0)