3

How can I automatically switch on num lock before request passphrase to unlock full encrypted disk (LVM)?

3 Answers3

1

You should enter your BIOS before booting and there should be an option allowing you to turn on numlock at startup.

Jacques
  • 11
1

Don't be convinced that NumLock is off just because the indicator light is out. As I mentioned in How do I make the Caps Lock key a third Shift key? " testing shows that the NumLock indicator light is flaky even without a KVM switch and has to be tapped twice to get back in sync with NumLock If you always leave it on you can ignore the light or if it bothers you you can tap it twice to get it back in sync. Why this occurs is likely a basis for a new question..."

Edit:

Enable NumLock during startup

Enabling Numlock on startup can be done in several different ways. First install numlockx:

sudo apt-get install numlockx

Place command with init scripts

More information regarding init scripts can be found for example here and here or with a simple google search

sudo sed -i 's|^exit 0.*$|# Numlock enable\n[ -x /usr/bin/numlockx ] \&\& numlockx on\n\nexit 0|' /etc/rc.local

One way to guarantee that numlock will be turned on after bootup for the TTYs is to run setleds via rc.local (a script run after every runlevel change; which in particular runs after booting up). To do so add something similar to the following in the file /etc/rc.local:

# Turn Numlock on for the TTYs:
for tty in /dev/tty[1-6]; do
    /usr/bin/setleds -D +num < $tty
done

Another similar approach:

One might use setleds in /etc/rc to define the initial and default state of NumLock, e.g. by

    INITTY=/dev/tty[1-8]
    for tty in $INITTY; do
         setleds -D +num < $tty
    done

Another approach would be to add a reboot cron task this combined with setleds in your script should do exactly what your looking for.

Sources:

https://help.ubuntu.com/community/NumLock#Enable_NumLock_during_startup

man setleds

Elder Geek
  • 36,752
0

What finally worked for me (on Ubuntu 22.04.2) was to update XKBOPTIONS in /etc/default/keyboard to include numpad:pc. This enabled the numpad on several occasions during boot, including (albeit without lighting up the indicator in my case) during the disk unlock/decryption step

f.e.:

XKBLAYOUT="us"
XKBOPTIONS="numpad:pc"
Jonas D.
  • 101