Saturday, June 27, 2020

Ubuntu 20.04 for the Raspberry Pi 4!

So it's finally been released -- a stable version of a 64-bit Ubuntu for the Raspberry Pi. This is what many have been waiting for, but the current version is not for the absolute beginner. To get to the GUI Desktop that gives the Raspberry Pi a much needed "Oomph!", we have to do a little command line work, as I think as of this writing, it's still beta. What I have here is a list of things you need to do in order to get to the point where everything will be working as you expect it to if this were Raspian.

Ok, so choose an SD card to put Ubuntu on. I recommand a nice large one, like a 128GB or 256GB -- because if you end up liking it, you'lre going to want to have plenty of room for more apps! Use your Mac or PC, and insert the SD Card into an available USB port. I recommend the new Raspberry Pi installer. It's got the edge on Balena Etcher -- Raspberry Pi installer actually locates the latest supported images and downloads them so you don't have to.

When selecting the OS in the Raspberry Pi installer, first choose Ubuntu.

Then select Ubuntu 20.04 LTS 64-bit.

After burning the SD card, put it into your Raspberry PI and boot. It will take a while, but eventually you will be asked to log in.

username=ubuntu
password=ubuntu

It should ask you to change the password after accepting the login. BE CAREFUL AND CHOOSE A PASSWORD THAT YOU CAN REMEMBER!

When you are done changing the password, it will leave you at a command prompt. Now at this point, you can just start using it as a command line OS, JUST LIKE THE GOOD OLD DAYS! Before graphical desktops, Unix, the predecessor of Linux, was just a command line. DOS, CP/M, Unix, and other pre-1980's operating systems all used their own unique command line language to navigate. But we know you want the GUI, so here is what to do to get everything up and running.

This is what you do after booting your Raspberry Pi 4 with the Ubuntu 20.04 image for the first time. First, we have to update the OS you just installed, so type the following commands:

sudo apt update
sudo apt upgrade
sudo reboot

Installing an Ubuntu Desktop

Next, we have to install the Ubuntu Desktop, so you can use an OS that is more familiar to you. There are many choices, which offer various improvements and compromises. The Default is the Ubuntu Fossa Desktop. if you're in the mood for other desktops, here are a few more. Currently, I'm testing out Ubuntu MATE Desktop, which seems to have better video playback speed.

GNOME is the default desktop for Ubuntu.

Below are the different desktops, and their terminal command lines to install them. You can actually try them all out, or read up on them HERE.

During the install of these desktop environments, you will be asked which Display Manager you want to use, and will be prompted to choose either GDM, GD3, GDM3 (All Variations on the "Gnome Desktop" manager) or SDDM. This is still something I'm experimenting with. I selected GD, because it was supposed to be lighter, and had less bells and whistles, which I figured would create extra work. SDDM is SUPPOSED to have better support for video, but I haven't tried it yet. When I have a chance to compare the two, I'll re-write this section to give my recommendation.

Just remember, it doesn't really matter which one you choose if you're experimenting like me. Just try one, then the other later on, and decide which one is your favorite.

DesktopTerminal command to install it
Ubuntu Fossa Desktopsudo apt-get install ubuntu-desktop
Ubuntu MATE Desktopsudo apt-get install ubuntu-mate-desktop
Gnomesudo apt-get install gnome-session gdm3
KDE Plasma Desktopsudo apt-get install kubuntu-desktop
Budgie Desktopsudo apt-get install ubuntu-budgie-desktop
Xfce/Xubuntu Desktopsudo apt-get install xubuntu-desktop
Cinnamon Desktopsudo apt-get install cinnamon-desktop-environmentp
LXQt Desktopsudo apt-get install lxqt sddm
Gnome Flashback Desktopsudo apt-get install gnome-session-flashback

Don't forget that after installing each of these, you should type in:
sudo reboot

Setting up Remote Desktop access

After rebooting, we should add the Remote Desktop software, to allow you to connect to it with your Windows or Macintosh PC. You can use your Raspian/other Linux computer to access it remotely.

sudo apt install xrdp
sudo systemctl status xrdp
sudo systemctl restart xrdp
sudo reboot

Net-Tools

Net-tools gives you a few more useful things to help you figure out networking issues or monitor your network. Just install them. They are useful once you realize you have these features in Windows.

sudo apt install net-tools

Overclocking the Raspberry Pi 4

Next, we need to edit the usercfg.txt file. Ubuntu doesn't let you edit the config files while you're running, unlike Raspian. So we have to use another PC/Mac to edit it. shut down and remove the SD card. Put the card into your PC, locate and double-click on usercfg.txt

You should only do this if you have a CPU fan installed on your Raspberry Pi 4. If you want to be adventurous, you can try the faster (hotter) speeds:

SafesthotVery Hot (beware!)
over_voltage=4 over_voltage=6 over_voltage=6
arm_freq=1750 arm_freq=2000 arm_freq=2147
gpu_freq=620 gpu_freq=750 gpu_freq=750

Create a section of the usercfg.txt file labeled [Pi4]. Add your choice of the lines above to the [Pi4] section. It should look like this:

[pi4]
over_voltage=4
arm_freq=1750
gpu_freq=620

This will overclock the Raspberry Pi 4 at the safest speed. Use the others as long as you have a good fan attached.

Next, there is a video issue with Ubuntu, that limits you to a lower resolution than the 1920x1080 that everyone wants. It also has Overscan, which puts an annoying border around the edge of the screen. To fix that, we need to add a couple more lines to the usercfg.txt file. To enable 1920x1080 resolution, and disable the overscan, Add the following to your usercfg.txt file:

dtoverlay=vc4-fkms-v3d
disable_overscan=1

Save the usercfg.txt file. Be sure to right-click on the drive containing the sd card, and select EJECT before removing it. Insert the SD card into your Raspberry Pi and reboot!

Audio Issues

The Ubuntu setup likes to default to the HDMI Audio out, but there are those of us prefer using headphones, or who have speakers that we'd like to pump the sound through. Unfortunately, there is a problem with Ubuntu's audio manager -- you can select the headphones/analog output all you want, but it just keeps going through the HDMI. To fix this, simply open terminal, and type the following:

amixer -q cset numid=3 1

Now put on your headphones and play some music.
if you need to know, the settings (last number on the command from above) are:
(1=analog, 2=HDMI0, 3=HDMI1).

The Argon One Raspberry Pi Case

For users of the Argon One Raspberry Pi 4 Case with fan, you will need to download the fan control software. Currently, Argon is working on an Ubuntu script for the fan software, so check their website before doing the following:

Open terminal, and type the following:

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

The script will generate a bunch of scripts and config files. The main commands are:

argonone-config to config the fan behavior
argonone-uninstall to remove all the scripts and services (conf file remains though)
argonone-tempmon which monitors the temerature using the linux sysfs.

getting Bluetooth to work

The BLuetooth drivers for the Raspberry Pi 4 do not get installed by Ubuntu (again, it's a beta version, so it'll probably be fixed along with the screen res and other issues). Fortunately, thanks to Damir Biscan from the Raspberry Pi 4 Facebook forum, I got the fix for that. IN terminal, just enter the following, and it will take care of it in one shot -- just reboot after, for it to take effect.

sudo apt install bluetooth pi-bluetooth bluez blueman

After rebooting, your control panel and menu bar items for bluetooth will work.

Kodi users mouse fix

SO if you like to use Kodi, there is an issue that plagues all Raspberry Pi users, regardless of operating system choices. When you open Kodi, the mouse is slow and choppy, and so isn't the video. We fix that in a deceptively simple way.

In terminal, type:
sudo nano /boot/firmware/cmdline.txt

Add the following text at the end of the line in that file (Do not add new lines. it all has to be on the one line)

usbhid.mousepoll=8

Save and close, and reboot!

Kodi should operate at a more normal speed.

Now you are ready to start using 64-bit Ubuntu on your 64-bit Raspberry Pi!

ADDENDUM: If you are having trouble getting Chrome to install on your Raspi with Ubuntu, Click HERE for a solution. Chrome for ARM using Linux is available, but it's not as simple as a download to get it working. Chrome is installed with some of the desktop environments, but not others. I discovered this while trying out Ubuntu Mate.