Ubuntu 22.04 on Raspberry PI 4

MOTD ubuntu
Welcome to ubuntu 22.04

A new version of Ubuntu is just released, and I need a ssh jumpbox. Well here are my steps for setting this up. I have an argus case for my Raspberry PI 4 4GB, so I have added some steps on how to set that up. I also did upgrade the firmware of my Raspberry PI even though I see some websites recommend only using Raspberry OS for this. The first steps are done in a Windows environment but there should be no problem doing something similar on Linux and Mac. If you have any tips or comments please comment below.

Download
First of all, you need to download the image. The Raspberry Pi Imager just in the next step does not have 22.04 available yet.
You can download the image here: https://ubuntu.com/download/raspberry-pi
Since I do not plan to have a monitor connected, my choice was Ubuntu Server 22.04 LTS 64bit.

SD
Download the Raspberry Pi Imager and install it. When starting it click Choose OS and scroll to the bottom and click Use Custom. From here select the image you just downloaded. Then Choose your SD card and click WRITE.

WIFI
If you don’t need wifi set up you can skip this step, else edit the network-config file located on the root of your SD card.
This is a dummy configuration to connect to a wireless network with the name home network and the password 123456789.

wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      "home network":
        password: "123456789"

Connect
When the SD card and Wifi are done, insert the SD card into your Raspberry Pi and boot. Wait a few minutes and connect to it with the username/password combo ubuntu/ubuntu. The password needs to be changed the first time you log in. If you need help finding the Raspberry PI on your network(DHCP IP) I will recommend reading about the ARP commando, or checking if your router has the possibility to show devices on your network.

Remember to check for updates by running these commands.

sudo apt update && sudo apt upgrade

New user
Since the default username is ubuntu, and the ssh service will be available from the internet I don’t want to use this ubuntu user.

Create a new user with the adduser command.

sudo adduser username

Then get the list of groups the user ubuntu is a member of with this command.

sudo groups ubuntu

Then add your new user to these groups with this command(only one group at the time).

sudo sudo adduser username groupname

When this is done, log in with your new user and verify that you have the right permissions.

Block ssh for old user
My next step in setting this up is denying the ubuntu user to connect through SSH. Well, what I really do is set in the sshd config what user is allowed to log in. Edit your /etc/ssh/ssh_config file and add this line.

AllowUsers username

This will only allow this user to log in, all others will fail.

Argon case
I use a case for my Raspberry Pi with the name Argus One.
It has both passive and active cooling, a power button and more.
To read more check this link https://www.argon40.com/products/argon-one-v2-case-for-raspberry-pi-4

Their software does not work by default on Ubuntu for some reason, so you need to run this. Credits to https://github.com/meuter/ how have made this fix.

cd /tmp/
wget https://raw.githubusercontent.com/meuter/argon-one-case-ubuntu-20.04/master/argon1.sh
chmod a+x argon1.sh
sudo ./argon1.sh

Remember to always check a script manually before running it!

This gives you the commands below.

"argonone-config" to do configurations of the fan behaviour
"argonone-uninstall" to remove all the scripts and services
"argonone-tempmon" which monitors the temperature

Update firmware
BE CAREFUL WITH THIS, IT MAY BRICK YOUR PI

I wanted to upgrade my firmware on the Raspberry Pi. I guess it’s not that important but I still like to have my things updated.

You can check the version you are using with this command.

sudo rpi-eeprom-update

And then if you need and want, upgrade with this one.

sudo rpi-eeprom-update -a
sudo reboot

Sources:
https://ubuntu.com/download/raspberry-pi
https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview
https://desertbot.io/blog/raspberry-pi-create-add-user
https://ostechnix.com/allow-deny-ssh-access-particular-user-group-linux
https://kharisecario.wordpress.com/2020/10/20/raspberry-pi4-ubuntu-argon/
https://askubuntu.com/questions/1253070/raspberry-pi-4-firmware-upgrade-eeprom-over-ubuntu-20-04
https://www.argon40.com/products/argon-one-v2-case-for-raspberry-pi-4

Disclaimer:
This is what I did, and it worked for me. I do not take any responsibility for any of the scripts, commands or tips in this tutorial/walkthrough.

2 thoughts on “Ubuntu 22.04 on Raspberry PI 4”

Leave a Reply