Librem 14/Arch: initramfs hook to turn keyboard on during boot

Hey,

I was kind of annoyed the keyboard back light always turned off during boot, making typing my LUKS password painful at night. So I’ve created a tiny mkcpioinit hook you can insert just before encrypt.

Note: this is for Librem 14 on Arch Linux, not PureOS. You also need the version of PureBoot/Coreboot that is not still exposing System76 HID (basically you must have /sys/class/leds/librem_ec:* available on your system)

More details in the README in the repo.

6 Likes

This is amazing! Was annoying me too, thanks for providing this.

1 Like

happy to meet another night owl :slight_smile:

BTW, this is now in the AUR https://aur.archlinux.org/packages/initramfs-l14kbdlight/ (alongside with the EC ACPI DKMS https://aur.archlinux.org/packages/librem-ec-acpi-dkms/, should you need it)

1 Like

Oh nice! That was you that added the EC acpi dkms to AUR, I hadn’t made the connection until now. Thank you for that too, you saved me a few headaches there with the battery not charging lol. Happy to know there is a fellow :owl: out there running Arch on their Librem 14 :smiley:

1 Like

Thank you for writing about this, I though the same when I had to enter my LUKS passphrase in the dark the first time. I am using PureOS and also wanted to turn on the keyboard light during boot.

As far as I understand Debian and thus PureOS uses initramfs-tools instead of mkcpioinit, I adapted your idea as follows (by making local changes – maybe a real Debian package would be nicer…)

Create a file /etc/initramfs-tools/scripts/init-top/l14kbdlight with this content:

#!/bin/sh

PREREQ="udev keymap"
prereqs()
{
        echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
        prereqs
        exit 0
        ;;
esac

# Turn on the keyboard lights on Librem 14:
if [ -e /sys/class/leds/librem_ec:kbd_backlight/brightness ]; then
    echo 255 > /sys/class/leds/librem_ec:kbd_backlight/brightness
    exit 0
fi

(You can also set another number than 255 of course to reduce the brightness.

Run this command:

sudo chmod +x /etc/initramfs-tools/scripts/init-top/l14kbdlight
sudo update-initramfs -u

And reboot :slight_smile:

More information: man initramfs-tools

2 Likes