How do I set the Numlock to remain on at boot for decrypting the hard drive?

When I start my computer with Fedora and reach the screen asking for my hard drive decryption password, the numlock status is off by default. How can the boot system be configured so that the numlock status is always on?

Please note that this question is NOT referring to the login screen AFTER the computer has booted up. This question is referring to the screen when decrypting an encrypted hard drive. The main goal of this is to be able to use the number pad to enter a password without having to press the “Num Lock” button to turn on the number pad.

Also, another thing to note is that the BIOS setting doesn’t make a difference whether or not the numlock will remain on or off. There is something that takes place between the computer BIOS and the screen to decrypt the hard drive that shuts off the number pad.

That is a very good question, and I am afraid it is not possible. It is even more of a problem in virtual machines where the num-lock status and the num-lock light are not always in sync.

Thank you for the response.

Just to dig a little deeper, there is a way to fix this in Debian-based systems that I found online. By generally following the instructions on the following link, I found that these scripts work on in keeping Numlock on when getting to the decrypt screen.

With that being said, I’m wondering if something similar can be done in Fedora. I’m not familiar with where the similar directories are in Fedora mentioned in this post. Basically, there are the following directories in Debian-based systems:

/etc/initramfs-tools/hooks
/etc/initramfs-tools/scripts/init-top

I would be willing to try creating the scripts and test it on a Fedora system to see if those instructions for Debian-based systems can work in Fedora, but I haven’t been able to find where the Fedora-equivalent directories are.

So if someone has that information, that would be helpful with testing these scripts on my end.

Thank you!

Maybe you are looking for something like this:

That example illustrates how to add a script to the pre-pivot stage. In your case, you’d probably want your script to run earlier. The order of the hooks/stages is

  1. pre-udev
  2. pre-trigger
  3. initqueue
  4. pre-mount
  5. mount
  6. pre-pivot
  7. cleanup

Hope that helps.

Edit: You may need to change /boot/$(</etc/machine-id)/$(uname -r)/initrd in the aforementioned example to whatever is the correct path for your current initrd. What I provided was correct for my system, but my system is using sd-boot which is not (yet) the default for Fedora Linux. The default GRUB bootloader might still keep the initrd files in the root of /boot. I’m not sure.

Edit2: Since your script also needs the setleds command, you would also need to add --install /usr/bin/setleds to that dracut command so that binary will be available in the initramfs. (Hopefully the setleds command doesn’t have any other dependencies that aren’t already available in the initramfs. But you could set a break point during bootup to test it interactively by adding rd.break=<stage>.)