You are not logged in.
Pages: 1
Topic closed
My disk is encrypted with LUKS and I'd like to activate numlock automatically, since I type the digits inside my password normally with the numpad.
I've followed the wiki-article, on how to enable the numlock during early bootup using mkinitcpio: https://wiki.archlinux.org/title/Activa … _on_bootup
The AUR-package has been installed the normal way (git clone, makepkg -si, etc.) (no aur-helper or something else has been used) and added the HOOK-Tag inside the /etc/mkinicpio.conf file.
After that, I rebuilded the image using mkinitcpio -p linux. The numlock hook gets recognised, so I though It would work as intended.
Here's the HOOK-variable, for everyone who's interested:
HOOKS=(base systemd autodetect keyboard sd-vconsole numlock modconf kms block sd-encrypt filesystems)
I'm using systemd-boot and a UKI on my device.
When I restart the device, the hook doesn't work. I boot into the OS and then the numlock key isn't turned on.
Now my question is: Is there something off about the PKG, not working with LUKS and/or UKI or am I doing something completely wrong?
Because as I read through the wiki the hooks get executed from left to right.
And since the numlock hook is set to be executed before sd-encrypt, I don't know why the numlock key hasn't been turned on.
However, when I execute the command, that's inside the hook-file under /usr/lib/initcpio/hooks/numlock, it works as intended.
Last edited by Veldora (2023-02-14 10:09:34)
Offline
Your initramfs is using systemd-init and custom mkinitcpio hooks are intended for busybox-init .
In case you can't switch to a busybox-init, you will need a systemd service that runs before cryptsetup and sets numlock on .
There is https://aur.archlinux.org/packages/syst … lockontty/ but that looks like it will start too late in the boot process.
https://bbs.archlinux.org/viewtopic.php?id=248836 is about a similar issue, read it thoroughly.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
Sorry for the late answer.
I've been ill for the whole last week and couldn't do anything during that time.
But now coming back to the topic:
That did the trick.
I now made a mkinitcpio HOOK with a systemd-service, that get's executed before sd-encrypt.
Thank you very much.
Last edited by Veldora (2023-02-14 10:15:32)
Offline
Hi, would you mind sharing your solution please? I'm currently trying to achieve something somewhat similar.
Hope it's not necrobumping, the topic is barely the months old :-)
Thanks!
Offline
Hi @otaj
Sure, here ya go:
https://paste.gg/p/anonymous/4d4e479c7b … 0733faf111
Beware, it has been optimized for usage in combination with sd-encrypt.
Make sure to add the numlock hook BEFORE sd-encrypt (if you're even using it) in your mkinicpio.conf and regenerate the initramfs.
For most of our devices, it has been running quite a while without problems.
Last edited by Veldora (2023-06-12 12:10:40)
Offline
hello so I want to do the same exact thing but that link seems to be dead can you yeah just resend that file
Offline
Alternatively, can we add instructions to the Arch wiki?
Offline
hello so I want to do the same exact thing but that link seems to be dead can you yeah just resend that file
I'm not a fan of necrobumping my old, solved posts, but the link is working for me.
What I can do however is this:
/usr/bin/numlock:
#!/bin/bash
for tty in /dev/tty[0-9]; do
/usr/bin/setleds -D +num < "$tty"
done
/usr/lib/initcpio/install/numlock:
#!/bin/bash
build() {
add_binary /bin/bash
add_binary /usr/bin/setleds
add_binary /usr/bin/numlock
cat >"$BUILDROOT/usr/lib/systemd/system/numlock.service" <<EOF
[Unit]
Description=Numlock before LUKS
Before=cryptsetup-pre.target
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/numlock
EOF
add_systemd_unit cryptsetup-pre.target
cd "$BUILDROOT/usr/lib/systemd/system/sysinit.target.wants" || exit
ln -sf /usr/lib/systemd/system/cryptsetup-pre.target cryptsetup-pre.target
ln -sf /usr/lib/systemd/system/numlock.service numlock.service
}
help() {
cat <<HELPEOF
This hook adds support to enable numlock before sd-encrypt hook is run.
HELPEOF
}
Offline
Closing. -- By request and to prevent necrobumps.
Offline
Pages: 1
Topic closed