How to install Ubuntu Server on your Raspberry Pi

FYI: Windows, the Raspberry Pi Imager software ejects the device after imaging (I’ve not checked to see if the same behavior appears on Linux/Mac). Because of this, prior to editing network-config, etc. removing and re-inserting the SD Card is is needed so that Windows mounts and assigns a drive letter to the boot partition. Once this is done, from the Windows user perspective the files to modify are found at the root level of the drive letter assigned to the SD Card, typically E:\ on systems without other removable media.

I would recommend adding a part about sharing the users laptop’s internet connection over wifi until the user can get wifi set up on the pi (After installing a Desktop Environment). This would be good for new users who are not used to having to edit configuration files. I found this on ubuntu help: https://help.ubuntu.com/community/Internet/ConnectionSharing

This is a great guide, but I found that wireless network connectivity was not automatic. After first login and changing my password I had to do the following:
sudo netplan apply
sudo systemctl daemon-reload
After that the WiFi connected.

New users would not know how to do this or where to even begin.

I would like to second the latest reply from @lucidlytwisted:

The reason that the wireless network is not connecting on first boot is that the suggested config includes optional: true for the wireless network and that results in cloud-config NOT forcing a connection which it would need to since the system time is off and because of that the DHCP lease is failing.

It should simply be mentioned that when only a wireless network is to be used then optional: should be set to false.

By the way, the correct work-around procedure on first boot is to reset the DHCP lease by doing:

sudo dhclient -r wlan0
sudo dhclient wlan0

Thanks for considering this; did cost me half an hour to find out what exactly is failing on first boots :-/

1 Like

I would suggest these changes in the network.config file especially for those who are not using HDMI display and keyboard.

At the end of all the texts, we need to append these lines

##Reboot after cloud-init completes
power_state:
  mode: reboot

Final code after adding the above lines into the network.config file is like:

wifis:
      wlan0:
      dhcp4: true
      optional: true
      access-points:
        "home network":
          password: "1234567"
##Reboot after cloud-init completes
power_state:
  mode: reboot

Reference: https://cloudinit.readthedocs.io/en/latest/topics/examples.html#reboot-poweroff-when-finished

https://raspberrypi.stackexchange.com/questions/111722/rpi-4-running-ubuntu-server-20-04-cant-connect-to-wifi

My understanding of cloud init is sketchy at best, but on an installation on a pi 4 I’ve just done I had to indent the “wlan0” to get it to work properly. I can’t get it to display here.

Humblest apologies for not replying to you. This has now been addressed in the tutorial, wifi won’t start on first boot. This is a problem with cloud-init calling netplan generate instead of netplan apply. Relevant bugs are https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1870346 (on the cloud-init side) and https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1874377 (on the netplan side). In the meantime, assuming yur WiFi credentials are correct you should just be able to reboot and it will connect.

1 Like

All things you mentioned update. Sorry its taken so long to get to.

1 Like

Has there been any solution to the problem of not having “sudo reboot” work on the RaspberryPi 4 when setting it up for the first time using a wireless connection? I have modified the necessary net-config file and I get to the point to do the reboot and enter “sudo reboot” as directed. As many have mentioned, at this point it asks for a password. Plz do not tell me that I am going to have to go wired to get this set up as it is quite a space to the cable modem. There are SO many people much smarter than I that work on these projects. There MUST be a better way…I have really wanted to Love Ubuntu throughout the years but have become so frustrated when working with anything other than Intel based systems…I just do not have several days to set up an OS on my different devices. Plz tell me there is a solution! I do not like the present OS on the Pi and would love to get Ubuntu working on it.

Hey, pctyson o/ I can feel and understand your frustration, my truest apologies, I want you to love Ubuntu on a Raspberry Pi too. Try these:

  • The password should either be ‘ubuntu’ or the password you set earlier in the setup process.

  • If you can’t reboot run “sudo netplan apply” after login on your first boot

If either of these things work let me know and I’ll update the above, if not, let me know and we’ll figure it out

1 Like

Hi,

I’m trying to Install Ubuntu Core 18 64bit (Raspberry Pi 3/4) In step 3. Wi-Fi of Ethernet, Getting setup with Wi-Fi. There is a note which states: “… it can be done on Windows and MacOS too.”
This is my first time working with any of this so I’m not sure if I’m doing something wrong or that is a misinformation since I have no file called ‘network-config’ on my SD card. I have read somewhere that Raspberry Pi Imager creates 2 partitions, one of them I can access with Windows, but not the other. Is that the reason why I can’t see the ‘network config’ file ? Because it’s in a partition I can’t access ?

In the screenshot below it shows me the ‘system boot’ so I assume I can access the correct partition.

The network-config file only appears on Ubuntu Server for Pi installations, not Core. This is because Core boots to a first-time configuration tool that includes options for setting up the ethernet and wifi interfaces.

As a “pre-installed” image, Ubuntu Server for Pi boots straight to a login prompt; it’s basically a variant of the Ubuntu cloud images you’ll see in various places like EC2 or Azure, hence the usage of cloud-init to initialize things like the networking interfaces.

1 Like

Just a side-note that a fix for the wifi-on-first-boot issue should finally be landing with groovy’s release. Relevant tickets:

Note that this does not mean that existing images are fixed; as this is a first-time boot issue, we’d need to re-spin the images to do that and I’m not (yet) convinced that effort is warranted vs waiting for the next Focal point-release which will incorporate the changes anyway.

1 Like

Just a minor remark: After the first boot the login screen comes up, nevertheless it takes a few minutes until the user “ubuntu” is created in the background and so you are ready to login. Would be good to mention in this howto.

Good Morning! Thank you for the great job! I’d like to suggest a UFW headless configuration, to set the security of our new rasp server!

On 24 October 2020. I tried to use the Raspberry Pi Imager to download the shiny new 20.10 Ubuntu server.
The Imager downloader image does not include any “network config” file, however the image downloaded from Ubuntu does.

24 October 2020. Is ssh disabled by default still ?
If so a text file called “ssh” needs to be added to the boot directory

I followed the https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview.
It worked OK, but I didn’t find a user-id, but guessed the the user-id was ubuntu. I used the “ip address show” command to get the ip address. instead of “arp” and when i checked on my Raspberry PI 3, the “arp” command has to be installed.

I am having Trouble while booting the ubuntu Server on the Raspberry pi 4 for the first time. I am typing the Login id and Password as “ubuntu” for both as given in the tutorial. But it keeps on showing Login error. Kindly please help.

1 Like

20.10 is ignoring the /boot/ssh file.

I don’t think there is a way to do it headless.