For years, the setting of NumLock button in KDE usually does not work. If you set it to “on” in
System Settings -> Input Devices -> Keyboard
then this setting most likely will be ignored, and after boot the user has to press that button on the keyboard to have NumLock on. This is bothersome if the password to login contains numbers.
Google helped to find a solution. If SDDM is used for login screen, which is the default, then add these lines in file
Don’t tinker. NumLock is set in the bios. System Numlock is set in /etc/sysconfig/keyboard and can be changed using “yast2 sysconfig”.
## Type: list(bios,yes,no)
## Default: bios
#
# NumLock on? ("yes" or "no" or "bios" for BIOS setting)
# This setting may interfere with GNOME /org/gnome/settings-daemon/peripherals/keyboard/remember-numlock-state DConf key.
KBD_NUMLOCK="bios"
In my experience, I had to tinker too. There’s no NumLock setting in BIOS, and I don’t recall the issue being fixed by setting to “yes”. I may have done it wrong somehow though, as I was trying to get it working mostly for the graphical session. Later I discovered that in vt’s the numpad wouldn’t work (no numlock key).
/etc/sysconfig/keyboard is used to source this routine, and we can see it uses the setleds above for a given tty.
## Path: Hardware/Keyboard
## Description: Keyboard settings for the text console
## ServiceRestart: kbdsettings
#
...
## Type: list(bios,yes,no)
## Default: bios
#
# NumLock on? ("yes" or "no" or "bios" for BIOS setting)
# This setting may interfere with GNOME /org/gnome/settings-daemon/peripherals/keyboard/remember-numlock-state DConf key.
KBD_NUMLOCK="bios"
...
## Type: string
## Default:
#
# ttys for the above settings
# Example: "tty1 tty2"
# "" for tty's 1-6
#
KBD_TTY=""
It shouldn’t have anything to do with X. Are you positive it works for X, and if so, have you set KBD_TTY to include tty7? On X it fails to call setleds, or more precisely, to open /dev/tty7.
KBD_NUMLOCK overrides bios, plasma settings override KBD_NUMLOCK. tty1…6 default to numlock=no and may be changed in /etc/sysconfig/keyboard. X11 checks for file numlock-on which is created or deleted by /usr/sbin/kbdsettings. Settings are:
Thanks, it’s indeed a better solution, as it fixes for both consoles and Xorg. I’ll propose changing the docs for /etc/sysconfig/keyboard to include that Xorg picks it up too, not just text consoles. Do you think it makes sense? I feel somewhere in the Xorg docs should mention this as well, but have no idea where.
Unfortunately it’s too short and inaccurate. Section 3 should be deleted as “Expert Settings” are no longer available. Add at the end of the section:
The following settings may be changed using yast2 > sysconfig > hardware > keyboard:
Repeat Rate
Delay before Repetition Starts
Start-up States for Num Lock, Caps Lock, and Scroll Lock
Devices on which the values for Num Lock, Caps Lock, and Scroll Lock should be set
Disable Caps Lock
I clicked “Edit source” but learned a fork was needed to propose changes to the documentation. When I looked further it says it would apply to SLE but the documentation says it applies to Leap 15.2. I am left confused.