diff --git a/rpi/bootstrap.md b/rpi/bootstrap.md new file mode 100644 index 0000000..729895c --- /dev/null +++ b/rpi/bootstrap.md @@ -0,0 +1,18 @@ +This is the cloud-init file that can be used in the 20.10 raspi image + +The image was originally mounted using + + mkdir mnt + sudo mount -o loop,offset=1048576 ubuntu-20.10-preinstalled-server-arm64+raspi.img mnt + +Then copy `mnt/user-data` with the contents from this snippet, i.e. + + cp user-data.yaml mnt/user-data + +Unmount the folder + + umount mnt + +Now write to the sdcard, in my example below `/dev/sda` is the sdcard + + sudo dd if=ubuntu-20.10-preinstalled-server-arm64+raspi.img of=/dev/sda bs=4M conv=fsync diff --git a/rpi4_hpl.md b/rpi/rpi4_hpl.md similarity index 100% rename from rpi4_hpl.md rename to rpi/rpi4_hpl.md diff --git a/rpi/user-data.yaml b/rpi/user-data.yaml new file mode 100644 index 0000000..28edd78 --- /dev/null +++ b/rpi/user-data.yaml @@ -0,0 +1,64 @@ +#cloud-config + +ssh_import_id: + - lp:arif-ali + +## Update apt database and upgrade packages on first boot +package_update: true +package_upgrade: true + +byobu_by_default: enable + +## Install additional packages on first boot +packages: + - aptitude + - byobu + - git + - linux-modules-extra-raspi + - nano + - openssh-server + - rpi-eeprom + - rsync + - salt-minion + - snapd + - ubuntu-minimal + - ubuntu-release-upgrader-core + +## Write arbitrary files to the file-system (including binaries!) +write_files: + - path: /root/reset.sh + content: | + #!/bin/bash + + export DEBIAN_FRONTEND=noninteractive + export APT_LISTCHANGES_FRONTEND=none + + hold_apps="byobu git linux-modules-extra-raspi nano openssh-server rpi-eeprom rsync salt-minion snapd ubuntu-release-upgrader-core" + + sudo -E apt-get update + sudo -E aptitude markauto '~i!~nubuntu-minimal' + sudo -E apt-mark hold ${hold_apps} + sudo -E apt-get -yq autoremove + dpkg -l | grep ^rc | awk '{print $2}' | xargs -i sudo -E dpkg --force-all -P "{}" + sudo -E apt-mark unhold ${hold_apps} + sudo -E apt-get -y install ${hold_apps} + sudo -E apt-get update + sudo -E apt-get -y upgrade + #sudo -E salt-call state.highstate + permissions: '0755' + owner: root:root + +# Configure salt +salt_minion: + grains: + physical_type: rpi + +# Runs any command that we need to run post install +runcmd: + - [ /root/reset.sh ] + - [ "snap", "set", "lxd", "criu.enable=true" ] + +# Creates a 8GB swap file in / +swap: + filename: /swap.img + size: 8589934592