+++ Saturday 15 March 2025 +++ Headless Raspberry Pi 4 ======================= A lot have changed over the years, and it has become more difficult to run headless Raspberry Pies. This has all to do with security, the changes are understandable. My Raspberry Pi 4 with 4 Gb RAM was out of use for some time. The last time it ran, it was on FreeBSD. There is no micro SD card in the slot, so I probably re-purposed that for something else. Some time ago I tried to revive the board, but got stuck because I didn't have a Micro HDMI connector and the serial console is nowadays disabled by default. Micro HDMI converter -------------------- I bought a small cable, that functions as a Micro HDMI to HDMI converter. The Micro HDMI connector is indeed very small. Many reviews of converter cables or converter connectors complain about the fragility of the connector, it is easy to bend it. So, I'll try to be careful with my converter cable. Getting Raspberry Pi OS Lite ---------------------------- For an article I'm writing, my Raspberry needs to run the "official" Raspberry Pi OS Lite. The Raspberry Pi OS website has some propaganda about the Raspberry Pi Imager, a tool that can download and configure Raspberry Pi OS images and copy the result to a micro SD card. I didn't see any solution for my FreeBSD laptop, so it has to be done manually. Of course, downloading an image, decompressing it, and dd-ing it to a micro SD card is not challenging. The missing part is the configuration. Adding a user ------------- In the past, the Raspberry Pi OS came with a default user 'pi', with a default password. Those days are over, we have to manually add a user. This, of course, I discovered when trying to login after connecting a monitor and keyboard to the board. The way to add a user is to add a small file named 'userconf.txt' to the boot-partition. To create this file, create an encrypted password with OpenSSL: echo 'secret-password' | openssl passwd -6 -stdin > userconf.txt After this, open the userconf.txt file in your editor and add the username before the password, separated by a colon: : Insert the micro SD card in the slot on Raspberry Pi board, and boot. Now we can log in with this username and password. System config ------------- Next, we have to do some system config stuff. When logged into the Raspberry Pi OS Lite, we can start the configurator with the command `raspi-config'. First, I choose the option to use the entire micro SD card. The card I use is a 64 Gb card. This is what `df -h' now shows: Filesystem Size Used Avail Use% Mounted on udev 1.6G 0 1.6G 0% /dev tmpfs 380M 1.2M 379M 1% /run /dev/mmcblk0p2 57G 2.4G 52G 5% / tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock /dev/mmcblk0p1 510M 55M 456M 11% /boot/firmware tmpfs 380M 0 380M 0% /run/user/1000 All looks fine. We also use this tool to enable SSH and the serial port. When the board is accessable over the network with SSH, I won't need the serial port. But just in case, I enabled it anyway. Network config -------------- The OS uses DHCP to set the network, but I prefer a fixed IP address. To set the network configuration, we need another tool, which we start with the command `nmtui'. With this, we can set the configuration for eth0, including the default gateway and nameserver. Attach to network ----------------- If everything went OK, we should now be able to attach the board to the network and access it over SSH. After the shutdown of the system, disconnected the Micro HDMI connector and the keyboard, moved the board and power supply to the cupboard with the internet router, hooked it up with an UTP network cable and plugged the power supply into the mains socket. After some time came the reassuring ping response in the xterm on my laptop. Also logging in over SSH worked. Mission accomplished. Last edited: $Date: 2025/03/15 14:44:56 $