You are not logged in.

#1 2023-02-03 07:52:09

Veldora
Member
From: Sol III, Milky Way
Registered: 2023-01-26
Posts: 48

[SOLVED] Numlock not activating during boot time (systemd-boot)

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

#2 2023-02-03 12:03:02

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,038

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

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

#3 2023-02-14 10:09:23

Veldora
Member
From: Sol III, Milky Way
Registered: 2023-01-26
Posts: 48

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

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

#4 2023-04-25 07:51:07

otaj
Member
Registered: 2019-10-08
Posts: 7

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

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

#5 2023-06-12 12:05:59

Veldora
Member
From: Sol III, Milky Way
Registered: 2023-01-26
Posts: 48

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

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

#6 2023-09-22 17:04:12

Beh_25864
Member
Registered: 2023-04-25
Posts: 4

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

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

#7 2023-09-22 17:19:36

cloverskull
Member
Registered: 2018-09-30
Posts: 207

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

Alternatively, can we add instructions to the Arch wiki?

Offline

#8 2023-10-18 13:19:11

Veldora
Member
From: Sol III, Milky Way
Registered: 2023-01-26
Posts: 48

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

Beh_25864 wrote:

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

#9 2023-10-18 13:40:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: [SOLVED] Numlock not activating during boot time (systemd-boot)

Closing. -- By request and to prevent necrobumps.

Offline

Board footer

Powered by FluxBB