This guide does not require a booted device. Create or modify the files on the SD card.
Device: Raspberry Pi 4B OS: Ubuntu 22.04.4 LTS (Jammy Jellyfish)"
There are two partitions: system-boot
and writable
.
system-boot
contains the boot files and it is also acloud-init
datasource (NoCloud
).writable
is the OS root.
Modify the file /etc/netplan/50-cloud-init.yaml
. This file is in the writable
partition.
The changes should look similar to the file 50-cloud-init.yaml
in this gist.
Substitute <MY_WIFI_SSID>
and <MY_WIFI_PASSWORD>
with your Wifi name and password.
This method doest not persist after a reboot because
cloud-init
re-provisions the system overwriting the config. It is helpful for one-time boot.
Similar to the steps in Approach 1, modify /network-config
file.
This file is present in the system-boot
partition. Substitute the template variables
<MY_WIFI_SSID>
and <MY_WIFI_PASSWORD>
with your Wifi name and password.
Ultimately, append the contents of user-data
to /user-data
file located in the boot partition.
Eject and insert the SD card to your Raspberry Pi and connect it to a power source.