Headless installation of RaspberryPiOS

Saturday, February 4, 2023

raspberrypiheadless

Since I broke my PiHole previous installation, I had to reintall it from scratch on a the RaspberryPi 0W I’m using for it. This is more like a short note for myself, since the process has changed a bit since my last post on it. For more details, read the official headless installation documentation.

First, download the latest image and install it on an SD Card (decompress the image with unxz):

sudo dd if=/path/to/image.img of=/dev/mmcblk0 conv=fsync status=progress
sync

To enable ssh, create a file named ssh in the boot partition, eg:

touch /media/bacardi55/boot/ssh

To create a user automatically, it now requires a userconf.txt in the boot partition. The file needs to have a single line in the format username:encryptedPassword.

To encrypt the password you want to use:

openssl passwd -6

And then type your password. Example with test as a password:

$6$WvOe.eTqsUHauZG3$Rk0WrFDvGCn7iuVagP85rxslyhatV25OGGwVL3gQOajaDudlqJEw1/KbHaRaXDMJumIokSTQfjidr2sC5FLyF.

So the userconf.txt file would look like this with the user test and password test:

test:$6$WvOe.eTqsUHauZG3$Rk0WrFDvGCn7iuVagP85rxslyhatV25OGGwVL3gQOajaDudlqJEw1/KbHaRaXDMJumIokSTQfjidr2sC5FLyF.

If wireless network needs to be configured before first boot, edit the /etc/wpa_supplicant.conf file as usual. In my case, the Pi0W uses a wired connection and the IP is fixed by the router.

Then I just add to follow again the PiHole documentation.


Contact

If you find any issue or have any question about this article, feel free to reach out to me via email, mastodon, matrix or even IRC, see the About Me page for details.

See Also

Setting up OpenPGP Web Key Directory (WKD)

New laptop part 3: i3wm configuration