This is an old revision of the document!
Table of Contents
Ubuntu on Raspberry Pi
Notes for configuring Ubuntu 20.04.1 LTS on Raspberry Pi.
Custom Ubuntu image
I currently use a customized Ubuntu image that includes the following modifications:
- Disabled resizing of partitions and filesystems to use entire SD card on first boot in cloud-init
- Disabled automatic patching of Ubuntu on first boot via cloud-init
- Add users, SSH keys, and sudo configuration for Ansible
First boot
On first boot you can find the Pi on the network from a DHCP server (or any other host that has an ARP cache for the subnet including this host) using the following:
#!/bin/bash echo "The following Raspberry Pi 4 devices have been found:" arp -a | grep dc:a6 # add MAC for other models...
Grow filesystem and disable cloud-init
After logging in you should reconfigure the filesystem and disable cloud-init to ensure that it does not automatically modify the filesytem or partitions in future updates.
# disable touch /etc/cloud/cloud-init.disabled # manually modify the partition table and grow the filesystem parted /dev/mmcblk0 resizepart # configure partition 2 as desired quit resize2fs /dev/mmcblk0p2 # optional: remove cloud-init completely apt-get purge cloud-init rm -rf /var/lib/cloud/* # if you do not remove cloud-init be sure not to allow your # configuration to be overwritten in future updates to the package
Make sure not to overwrite the cloud-init config if you
Next do the following:
- set hostname
- Install python for Ansible
- configure /etc/netplan/99-config.yaml
- run ubuntu_ansible_control.yml playbook to update to most recent profile
Add the following to Ansible plays in the future:
* disable ipv6 * timezone * default editor * prune packages * sshd config * disable ubuntu account or remove * configre motd
Hardware notes
Quick reference for Raspberry Pi hardware tools on Ubuntu.