Ubuntu 20.10 Server on Raspberry Pi 4 ============================== Author: Momchil Ivanov Date : 2021.04.09 Introduction ------------ This article contains notes on setting up a Ubuntu 20.10 Server on Raspberry Pi 4. Setting up WiFi before first boot --------------------------------- You have the chance to enter the settings for your wifi network prior to the first boot. You need to edit the file network-config in the boot partition of your image. You can add the following: wifis: wlan0: dhcp4: true optional: true access-points: my_wifi_ssid: password: "changeme" Here is an example of the full file network-config: version: 2 ethernets: eth0: # Rename the built-in ethernet device to "eth0" match: driver: bcmgenet smsc95xx lan78xx set-name: eth0 dhcp4: true optional: true wifis: wlan0: dhcp4: true optional: true access-points: my_wifi_ssid: password: "changeme" Setting up WiFi after first boot -------------------------------- In case you have already booted the Pi without setting up the wifi settings, you need to edit the file /etc/netplan/50-cloud-init.yaml. Here is an example of the file contents: network: ethernets: eth0: dhcp4: true match: driver: bcmgenet smsc95xx lan78xx optional: true set-name: eth0 version: 2 wifis: wlan0: access-points: my_wifi_ssid: password: changeme dhcp4: true optional: true Alternatively, you can also edit the network-config file as described in section "Setting up WiFi before first boot". You need to execute # cloud-init clean -r afterwards, in order to automatically recreate the file /etc/netplan/50-cloud-init.yaml with the desired settings. Reading CPU temperature ----------------------- To read the CPU temperature, you can execute: $ awk '{print $1/1000}' < /sys/class/thermal/thermal_zone0/temp Alternatively: $ vcgencmd measure_temp Installing vcgencmd ------------------- The program vcgencmd is used in some examples for the Pi. You can install it with: # apt-get install libraspberrypi-bin Cleaning up the Ubuntu installation ----------------------------------- First, remove snapd. Removing snapd -------------- To remove snap, execute: # snap list # snap remove lxd # snap remove core18 # snap remove snapd # apt-get autoremove --purge snapd # rm -rf ~/snap # rm -rf /snap # rm -rf /var/lib/snapd # rm -rf /var/cache/snapd Disable the automatic installation of snapd: # apt-mark hold snapd Removing cloud-config --------------------- Cloud-config is not needed after the initial setup and can safely be removed. It logs to /var/log/cloud-init.log via /etc/rsyslog.d/21-cloudinit.conf on each boot. To remove cloud-config, execute: # touch /etc/cloud/cloud-init.disabled # reboot # apt-get autoremove --purge cloud-init -y # rm -rf /etc/cloud # rm -rf /var/lib/cloud Removing Apport --------------- To remove apport, execute: # apt-get autoremove --purge apport Removing plymouth ----------------- To remove plymouth, execute: # apt-get autoremove --purge plymouth Setup sshd ---------- To speed up ssh login, execute: # echo 'UseDNS no' >> /etc/ssh/sshd_config Disable motd-news ----------------- $ touch $HOME/.hushlogin