*updated 2020 Oct 21, change the method to obtaining desktop GUI and adding some troubleshooting
In this tutorial, I will write about how to set complete Ubuntu server 20.04 into Raspberry Pi 4 (B) including the desktop GUI. Note that mine is 8GB version, so I use Ubuntu 64-bit for that. It may works with 32-bit or 64-bit/Pi 3 pairs. I also use Argon One case with fan control. There will be slight workaround than what is written in Argon One instruction manual.
*you can skip this part to the technical part below if you’re in hurry
After my “not-so-satisfied” experience with Jetson Nano (I can tell you more about my Jetson Nano some other time), I reluctant to get my hand on some other single board computer. Most part is due to limitation of ARM-supported package that I use on my project. However, recent trends which Apple move into ARM-architecture and ARM acquisition by NVIDIA, I think I need to take a second chance to get along with ARM device.
Considering price, support, and flexibility during set-up make me choose Raspberry Pi 4 (B) for now. Good news is that my interest come when they already launch the model B with 8GB memory (64-bit!). The bad news, well, Raspberry Pi OS 64-bit still in beta phase. 😦 So I need to figure out using other distro that has both 64-bit and ARM support.
Will I take it or leave it? Why not take this as a learning opportunity? I browse and find out that this small board can fulfill most of my need for the project. With some workaround for sure. But it’s not as limited like what I experience with Jetson Nano. Note that I didn’t say Jetson Nano is bad, but it’s not suitable for me right now.
Now, why did I choose Raspberry Pi 4 Model B?
- It has 8GB version! While normally single board computer stuck at 2GB and 4GB options.
- Wireless connection already there (WLAN and Bluetooth 5). No more looking for cables for set up.
- Many option for desktop environment if you want (and its work), including 64-bit version. And it can be installed without too much a fuss.
- Community support are great, so third-party package will be found at some point when you need.
Let’s get to the point.
What I Have
- Raspberry Pi 4 model B 8GB
- 32GB microSD card
- Argon One Pi 4 case
- Ubuntu server 20.04 LTS (you can download it here)
- Power Supply USB-C 3A/5V
- Monitor, mouse and keyboard (I’m not doing headless)
- Micro HDMI to HDMI converter
Install Ubuntu 20.04 on Raspberry Pi 4
A. Prepare SD Card
- write the Ubuntu 20.04 installation into the microSD with Raspberry Pi imager software:
- The imager software appearance will be like this:
- Choose your operating system, in this case I pick Ubuntu 20.04 64-bit. Note that by selecting the OS this way, it will download the image file along the way. But once it downloaded, it will be keep in your computer. Alternatively, you can download whatever distro image you want and use the last option in the OS selection menu.
- After choose your OS, then select your SD card to be written. Then click write.
It will format and delete all the data inside your SD card!
B. Network Configuration (Wi-Fi)
*you can skip this if you’re using LAN connection
- After you finish writing image file into the SD card, it will have 2 partition. One of them will have all files and setting needed for installation. Open it and try to find “network-config” file.
(if you’re using linux to prepare your SD card, it will be like the image)
- Open the files and uncomment (delete the #) in front of these lines:
wifis: wlan0: dhcp4: true optional: true access-points: "<wifi network name>": password: "<wifi password>"
Now change the wifi name and password with your own wifi. The name and password need to be inside quote mark. For example:
wifis: wlan0: dhcp4: true optional: true access-points: "my-wifi-name": password: "my-wifi-password"
- Save the file. Now your SD card ready to be used.
C. Argon One Casing Installation
*you can skip this if you’re only looking for Ubuntu Server 20.04 installation
What intrigued me with this case is they have both passive (via silicon pad) and active cooling (using PWM fan). For that reason, they include 2 other board to work with our raspberry. As you notice in the picture, first board will be connected to the audio and micro HDMI port of the raspberry. This is to make all the port positioned at the back. Meanwhile, another board with PWN fan already fixed in the aluminum part of the case. We just connect our raspberry with the case by the GPIO.
Just follow the instruction from the guide, screw all the parts. Now you’re ready to go! As you can see the size is only around my palm. (FYI, I’m a small feature man). They also provide accessible GPIO port under the lid. Forget the order of GPIO? don’t worry, they laser etch it for you.
After the case is set, connect the power cable, LAN (if you use it), and screen with your micro HDMI connection. Don’t forget to put in micro SD. Argon one provide micro SD port below the case. So we can install and remove it anytime.
D. Booting and Ubuntu Server 20.04 Installation
*Follow this link if you connect remotely to your Raspberry, this part will not cover the headless setup
- After several minutes, you will see familiar black screen of linux. You will see login prompt. Before typing username and password, wait a minute until it show some ssh key information. Otherwise your login will be failed.
- When asked username and password, use “ubuntu” for both (without quote mark).
- You will be asked to change the password for the first time. You can also add new user later.
- Your Ubuntu server is ready to go.
Don’t forget to update your system:
sudo apt update sudo apt upgrade
You may find some problem during set-up. Here is some troubleshooting for it: (may be updated)
- Network not working (observed when you try to update the system). If this is the case, just reboot the system by
- Update not working due to expired certificate. This is may caused by wrong date (you will notice it set at April 2020). In some case, your internet may have firewall that prevent your system to automatically adjust the date. Modify the date and time by using
sudo date --set="2020-10-20 10:05:59".
- In similar case you can also update your time zone. For example, I use
sudo timedatectl set-timezone Asia/Taipei.
E. Fix Argon One Temperature Control Feature
Now that you assume everything is working, you want to set-up fan control in Argon One case. But when you following the instruction, it gives you an error and you cant install it.
In my case, I found someone pointed its because Ubuntu 20.04 no longer use python 2. Hence the script provided is not working. Good news someone rewrite it. (credits to Meuter). To download and install it, just follow:
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
Note that this script are tested on Raspberry Pi 4. Make sure to use with your own risk. The command is also similar with original:
argonone-configto config the fan behaviour
argonone-uninstallto remove all the scripts and services (conf file remains though)
- He also including custom command:
argonone-tempmonwhich monitors the temperature using the Linux
F. Ubuntu Minimal Desktop Installation with Tasksel
After some trial and error, I thinking that using
tasksel maybe the easiest way for most people. Tasksel is a utility for installing multiple related packages at once.
sudo apt-get install tasksel
After you successfully install it, just type this command to get any package you want:
You will get bright screen and option to choose for. You will notice some option already been marked. Let them be, it means that our Ubuntu Server installation already cover those packages. Now just select Ubuntu Desktop Minimal (or anything you want). I don’t need all the bloatware for my Raspberry Pi, and minimal option will not include around 80 packages.
After installation is finish (takes a while), now we need to prepare “fake” KMS for frame-buffer. Otherwise there will be some GUI instability.
- Open /boot/firmware/syscfg.txt.
- Edit the file by adding this line: dtoverlay=vc4-fkms-v3d.
Now you’re set to go. Just reboot the system and you will get the minimal desktop GUI waiting for you. In the picture you will notice some “black border” around the display. You can find some workaround somewhere. As I’m not really care to fix it. 😉
G. Troubleshoot Bluetooth, Wi-Fi and LAN not Showing in the Settings
Now you already got your desktop, you notice that LAN status is unmanaged, no Wi-Fi showing up, and Bluetooth is not detected. Don’t worry, it can be solved.
pi-bluetooth package. This work fine at least for me.
Wi-Fi and LAN: This is because Ubuntu Server manage our network with Netplan. We need to find out *.yaml file (which is the network config we done before):
- Go to
/etc/netplan/and find any .yaml file. The name may be different but the extension should be same. For me the name will be 50-cloud-init.yaml.
- Open the file and add
renderer: NetworkManagerto the line so it will become something like this: (spacing matter!)
network: version: 2 renderer: NetworkManager
- Finally rebuild the Netplan and restart your system
sudo netplan --debug generate sudo netplan apply reboot
That’s all I want to cover with my own experience. Below is some troubleshooting that I found later. It may get updated when I find new problem with my Pi 4. Thanks for reading!