Linux Format

Run Ubuntu 20.04

Les Pounder loves Ubuntu and Pi, so all the better that he can now run his favourite distro on his favourite hardware!

- Les Pounder is an Associate Editor at Tom’s Hardware and a freelance Creative Technologi­st. He blogs about his discoverie­s at bigl.es.

It’s maker heaven for Les Pounder as he loves Ubuntu and the Pi, so all the better that he can now run his favourite distro on his favourite hardware!

Raspberry Pi OS, formerly Raspbian, has been the official operating system since the Raspberry Pi arrived in 2012. But over the years there have been a few attempts to port the popular Ubuntu distro to the Pi. With Ubuntu 20.10 being released in October 2020 – the first Ubuntu to be officially released for the Pi – we thought it would be fun to see if we can install Ubuntu 20.04 on a Raspberry Pi 4, and see what we can do.

The simplest way to get the latest version of Ubuntu is via the Raspberry Pi Imager tool, available from https://www.raspberryp­i.org/downloads/. Download and install the tool, then open it and select the Ubuntu Server 20.04 64-bit image, which will download the image from Canonical’s servers. Insert a 16GB microsd card into your computer and select it as the drive to write to. When ready, click WRITE to start the process and it should take no longer than 10 minutes to download and flash the Ubuntu server image. Once completed, eject the microsd card and insert it into your Raspberry Pi 4. Connect your keyboard, mouse, HDMI, Ethernet and finally power to boot into Ubuntu Server for the first time.

The first boot will take the longest, and even when it looks like it’s ready to log in, it will need a little longer. Wait five minutes, then press Enter and you will be prompted to log in. The default username and password is ‘ubuntu’ and you will be prompted to change the password.

Make sure that your Ethernet connection is working by pinging Google’s DNS server:

$ ping 8.8.8.8

If the output reads Unable to reach destinatio­n then check your network before moving onward. Right now we have a basic Ubuntu server install, but there is no desktop or GUI. That is where Martin Wimpress’

Desktopify tool comes in. Martin is the Director of Engineerin­g for Ubuntu Desktop at Canonical so he is well-versed in this subject. Desktopify is a script which installs and configures a base Ubuntu Server image into a full Ubuntu desktop install. To download his script type this into the terminal:

$ git clone https://github.com/wimpysworl­d/ desktopify.git

Now change directory to the downloaded files. $ cd desktopify

Next we’ll run the desktopify command and pass it one argument: the desktop environmen­t we want to use. We initially chose Ubuntu as we used a Raspberry Pi 4 8GB, but later we chose to install xubuntu by running the same command in the terminal. To change the desktop environmen­t, simply change the name at the end of the line, like so:

$ ./desktopify --de ubuntu

The install process will take some time, so grab a cup of tea and wait. When it is complete, reboot the Raspberry Pi.

$ reboot

The Raspberry Pi will boot to the Ubuntu login screen; enter your username and password and the login will continue to the desktop. We are now using Ubuntu 20.04 on the Raspberry Pi 4!

Let’s do a little housekeepi­ng. First we’ll ensure that we have the latest list of software repositori­es, and then ensure our system is up to date. In a terminal type the following.

$ sudo apt update

$ sudo apt upgrade -y

The Ubuntu 20.04 install comes with Python libraries for working with the GPIO, but it is missing two things, the pip Python package manager, and a decent Python editor. To fix that let’s install pip. In a terminal type:

$ sudo apt install python3-pip

For a Python editor we have many different choices, but we chose to install two: Geany, which is a general text editor with support for Python, and Mu, a simple

Python editor geared towards learners. To install them type either or both of these lines in a terminal.

$ sudo apt install geany

$ sudo apt install mu-editor

Can we use the GPIO?

To test the GPIO we are going to connect an LED to GPIO17, as per the diagram in the download for this project. This LED will flash (blink) to prove that we can control the GPIO. Open the Mu editor and select Python 3 mode. The test code is only three lines of Python. from gpiozero import LED led = LED(17) led.blink(0.1,0.1)

Save the code as blink.py and click Run to see the LED quickly flash.

Does Ubuntu Support HATS?

HATS, add-on boards for the Raspberry Pi, fit atop the 40 pins of the GPIO and provide extra functional­ity for our projects. We tested three common boards: Unicorn HAT and Explorer HAT Pro from Pimoroni, and Joy Bonnet (a joystick controller) from Adafruit. The Unicorn HAT was the simplest board, using only three GPIO pins for power and a data connection. After installing the Python 3 library using pip, we saw all 64 LEDS light up in a rainbow. The Explorer HAT Pro worked after installati­on, but it did require us to install an extra package to enable I2C (a specialist data protocol) to use the board. All aspects of the board worked with no issues. Sadly the Adafruit Joy Bonnet did not work and threw errors during installati­on. The best policy to employ when looking to use HATS with Ubuntu on the Pi is to ask the sellers/creators before handing over your money.

Can we overclock the Raspberry Pi?

The stock 1.5GHZ of the Raspberry Pi 4 is plenty for most, but there are some users who crave pushing their Pi to the limit and with an overclock we get a free boost of speed. Please note that before attempting this you will need to invest in some adequate cooling for your Raspberry Pi 4. The Pimoroni Fan Shim is a cheap and effective cooling option, or an all-metal case can be used to passively cool the Pi.

To overclock the Pi we need to shut down the Pi, remove the microsd card and insert it into another computer. A partition called system-boot will appear, and in there we find config.txt which acts as a simple tool to configure our system. In this case we will add a section called Overclock and within it include the following details:

# Overclock arm_freq=2100 gpu_freq=750 over_voltage=6

This will set the CPU to 2.1GHZ, and the GPU to 750MHZ – quite a jump from stock speeds. The over_ voltage option provides additional voltage to the CPU in order to increase its speed. This is not an ‘one size fits all’ solution and you may find that your Pi does not boot with these values in place. If so, gradually reduce the CPU speed to 2GHZ, 1.9GHZ and so on and try again until it works. Save the file and remove the card from your computer, place it into the Pi and power up.

 ??  ?? Using the Xubuntu desktop we managed to run a slick, great looking and responsive session.
Using the Xubuntu desktop we managed to run a slick, great looking and responsive session.
 ??  ??
 ??  ?? Youtube playback at 1080P was not great; even at 720P, a 60fps video would struggle. Installing h264ify can help, but it also presents its own set of problems.
Youtube playback at 1080P was not great; even at 720P, a 60fps video would struggle. Installing h264ify can help, but it also presents its own set of problems.
 ??  ?? Bashtop is a great and easy to use system monitoring tool that covers every aspect of your system.
Bashtop is a great and easy to use system monitoring tool that covers every aspect of your system.

Newspapers in English

Newspapers from Australia