himblick host-setup

This is part of a series of posts on the design and technical steps of creating Himblick, a digital signage box based on the Raspberry Pi 4.

A RaspberryPi boots using a little FAT partition which contains kernel, device tree, configuration, and everything else necessary to boot.

It has the conveniente of being able to plug the SD card into pretty much any system, and tweak the knobs that are exposed through it.

While we don't expect that people would want to modify the config.txt that controls the boot process, we would like to give people a convenient way to set up things like host name (which makes the device findable on the net), timezone, screen orientation, and wifi passwords.

We decided to go for a himblick.conf file in the boot partition to give simple knobs for the common system customizations:

# Host name
name = himblick

# Country used for WiFi settings
wifi country = de

# System keyboard layout
keyboard layout = us

# System timezone
timezone = Europe/Berlin

# Screen orientation: can be normal, inverted, left, right. Default: normal.
screen orientation = normal

# Screen resolution: can be any of the xrandr screen modes. Default: auto.
screen mode = 1920x1080

# WiFi networks that the device will be able to connect to

[wifi ExampleESSID1]
hash = 0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef

[wifi ExampleESSID2]
password = example cleartext password

WiFi can be configured both with cleartext passwords and with hashes generated by wpa_passphrase.

This can be scheduled to run with systemd early at boot, most importantly before wpa_supplicant is started:

Description=Configure host based on /boot/himblick.conf

ExecStart=/usr/bin/himblick host-setup


Here is the code of the host setup part.

The screen-related parts will be configured by the media player code, right after X starts up.

Here are some details about the various steps:


One just needs to configure the country and the networks: networkd does not need anything else from wpasupplicant.

If we provision something, we can use wpa_passphrase to put hashes in the file, but if someone with less technical skills has to update the WiFi configuration, there's a possibility of just putting passwords in the file.

I'm not really sure how much more secure is the hash over the password: with the hash one can connect to that network just fine. However, I guess one can't use it to retrieve the password itself to try it out on different networks.

Keyboard configuration

Keyboard in Debian is configured in /etc/default/keyboard, which is read by various packages:

After changing /etc/default/keyboard, one should apparently invoke /usr/sbin/dpkg-reconfigure -f noninteractive keyboard-configuration, although I haven't exactly figured out what it does, and whether this is just cargo culting.

udevadm trigger --subsystem-match=input --action=change in instead needed to to trigger reloading the keyboard layout in X without needing to restart X.


The timezone name, in Debian, is stored in /etc/timezone, and /etc/localtime is a symlink to the right timezone under /usr/share/zoneinfo.

However, just calling timedatectl set-timezone Time/Zone, does all that is needed, including the above.


In Debian the hostname is saved in /etc/hostname.

To set in the system, there is the hostname command and possibly other things that the hostnamectl set-hostname command is taking care of.

Here too, just calling hostnamectl set-hostname <hostname> does all that is needed, including the above.