RPi Install

  1. Get Raspbian / Raspberry Pi OS

  2. Copy image to SD card

  3. Enable metadata checksums for ext4:

    e2fsck -fD /dev/${sdcard}2
    resize2fs -b /dev/${sdcard}2
    tune2fs -O metadata_csum /dev/${sdcard}2


This enables 64bit mode which supports longer checksums.

  1. Mount:

    mount /dev/${sdcard}2 /mnt
  2. Enable SSHD:

    ln -s /lib/systemd/system/ssh.service /mnt/etc/systemd/system/sshd.service
    ln -s /lib/systemd/system/ssh.service /mnt/etc/systemd/system/multi-user.target.wants/ssh.service


It’s possible use chroot to enable SSHD via systemctl but that only works if the binary format of the target is supported:

systemctl --root /mnt enable ssh
  1. Set temporary password for pi:

    sudo chpasswd -c SHA512 --root /mnt <<<"pi:${PASSWORD}"
  2. Manage ethernet via networkd

    Create /mnt/etc/systemd/network/50-ether.network:

  3. Disable dhcpcd:

    rm /mnt/etc/rc2.d/S01dhcpcd
  4. Enable networkd:

    systemctl --root /mnt enable systemd-networkd
  5. Enabled resolved:

    systemctl --root /mnt enable systemd-resolved
  6. Create random seed for systemd-random-seed.service:

    install -m 600 -o root -g root /dev/null /mnt/var/lib/systemd/random-seed
    dd if=/dev/urandom of=/mnt/var/lib/systemd/random-seed bs=1 count=512
  7. Umount:

    umount /mnt
  8. Bring RPi online and connect via SSH

  9. Remove dhcp client:

    apt remove dhcpcd5