How to install Ubuntu Server on your Raspberry Pi

put dd instructions for people who don’t want to use some other unnecessary program to copy data to a memory card

It’s very easy to set-up a Raspberry Pi to boot from USB. Can you add a section on copying the to a USB drive, or directly installing everything on a USB drive?

If you install without a monitor, you can change user-data-chpasswd-expire :false .

The provided steps don’t work for me with a PI 4, ubuntu 20.04, and a POE hat. No IP ever arrives on the network for me to configure it headlessly.

I see a green light flash somewhat randomly for a few minutes until it appears to have booted, and then no green light after this point at all.

Does Ubuntu suport the POE Hat natively? if not it would be a nice improvement to see.

Also be aware that the ssid is case sensitive, and if you get anything wrong the first time, because cloud-init only tries once, you will need to re-image the card and try again.

Thanks for including the section on configuring a static IP address. I noticed that this section can be improved in 3 aspects:

  1. The example IP addresses given in the text are different from the example IP addresses in the example config file excerpt. This may confuse readers. The example IP addresses should be aligned between descriptive text and config file excerpt.
  2. The choice of IP address and subnet in the config file excerpt is 192.168.101.23/24. The 23/24 part may confuse readers because numbers 23 and 24 are so close, but here they have nothing to do with each other.
  3. The IP address and subnet configuration in the config file excerpt 192.168.101.23/24 will make it impossible for this network interface to reach the gateway4: 192.168.1.1 configured in the next line. The given example should be consistent so that it configures a working static IP setup if given gateway and nameserver actually exist.

I therefore suggest to change the section to read as follows:

Set a static IP

To set a static IP you need to replace the

dhcp4: true

line in the network-config file with lines that specify the intended IP address as well as its default gateway and DNS server. You can do this for either the eth0 or wlan0 interface (or both). It is important that you get the indenting right for this work correctly

For example, if you were planning to give the pi the address 192.168.1.230 in the 192.168.1.0/24 subnet with a default gateway of 192.168.1.1 and a DNS server of 192.168.1.53 then the following text would work. The same structure works for both the eth0 or wlan0 sections in the file:

ethernets:
  eth0:
    addresses:
      - 192.168.1.230/24
    gateway4: 192.168.1.1
    nameservers:
      addresses: [192.168.1.53]
    optional: true

I suggest to change ssh ubuntu@<Raspberry Pi’s IP address> to ssh -o PreferredAuthentications=password ubuntu@<Raspberry Pi’s IP address>. Password is rarely the preferred type of authentication these days. And Raspberry Pi just returns “Too many authentication failures” error.

Two problems :slight_smile:

  1. Isp for Etcher is wrong should be https://www.balena.io not .oi.
  2. Many users with Pi 4B have a SSD or similar, so instructions to install onto that devise would be somewhat handy to put it mildly.

There might be more as I have only got as far as updating the SD card :frowning:

Someone really needs to make changes long the lines suggested by @ ianmacs in October 2021. Anyone who doesn’t know their way around Linux networking configuration and is just trying to follow the instructions verbatim will be hopelessly lost and not get a reachable system. All of the suggestions made in that October post are good.

@wjcarpenter that post is a wiki. YOU can edit it.

It’s a great way to contribute to the Ubuntu community.

2 Likes

I don’t see how. The only thing I see is a link to suggest changes, and that link brings me to this forum thread. But maybe you are looking at a different place than I am. I’m looking at https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi. If there’s a way for me to update it directly, I’d be happy to do so.

The ‘edit’ button is at the bottom of the very first post in this thread.

1 Like

Done! Thanks for the assist, @ian-weisser.

A small suggestion of mine would be to add a reference to the partition names to mount the sdcard to change the configuration if running from linux.
From ubuntu 21.04 I see this as:

root@myhost:/# fdisk -l /dev/mmcblk0
Disk /dev/mmcblk0: 58.24 GiB, 62534975488 bytes, 122138624 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdeca7dfc

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk0p1 *      2048  526335  524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      526336 7946215 7419880  3.5G 83 Linux

So the partition to edit and/or mount is /dev/mmcblk0p1 which can be mounted with mount /dev/mmcblk0p1 /mnt and the file to edit then is config.txt

Also given the cloud init stuff it would be nice to know how to provide an ssh public key to this config so that the install will only allow access from the specified public key if this is provided. That seems to be safer. If this is possible adding a simple instructions to do this would be good as it saves time: the pi would boot and ssh to the user would work directly.

Thanks for considering.

Very good tutorial, but I was not able to boot my raspberry pi.
I am using Pi Imager to install Ubuntu 20.04 LTS OS on an SD card. Then I plug the card into my Pi and try to log in to my Raspberry Pi 4 via SSH using the Putty software in Windows 10 (I am using wifi and trying to make an ssh connection.).
I used the IPv4 address as Host Name, and the command prompt opens. But I have an “access denied” problem when I inserted “ubuntu” as the username and password.
I have tried with different SD cards, but still, this issue exists.

Is there anyone with the same issue?
Thank you for your help.

Update for the “Headless install” section:
I have two Rpi 4’s purchased in Europe/UK 2022.05
Both report MAC addresses starting with e4:5f:01
Maybe an update is needed to the ’ Determining the Pi’s IP address’ section?

Try this:
In the Pi Imager, go into the settings and check you have ‘Set username and password’ ticked - and replace both with values of your choosing. Check ‘SSH’ is also enabled and using password authentication. Now create the boot image.
Start the Pi, allow it to settle for 5 minutes then open a command prompt in Windows 10 and type ssh username@pi_address and see if that works. Replace ‘username’ with the one you added to the Imager and ‘pi_address’ with either the IP address of the Pi or the machine name/domain if your network can resolve that.

@rhys-davies
I’ve got editor rights now so I’ve modified the tutorial to reflect the new MAC address. Rather than add a new line suggesting an installer potentially run three different arp requests, I’ve put the three possible options into one grep (findstr for Win). This allows the install text to be simplified.

Hope this is acceptable, useful and aids clarity.

1 Like

Yes, this solution has solved my problem.
Really appreciate and thank you for the assistance.

Just a thought that I personally think may make improve this excellent guide (thanks!)
How about including a direct link to https://ubuntu.com/download/raspberry-pi for those who will not be using the Raspberry Pi Imager?