3

There is no problem in other OS. Default expected behavior for standart PC - is that you:

  • Set up NumLock initial status in the bios
  • It remains same in bootloader
  • It remains same at login screen
  • It remains same in desktop session, until you intentionally change it.

So here seems to be a problem, in some "malicious" code, that forcefully disables it, during boot. Question is: What exactly disables it? What binary? Or what source file? Can I remove it, at least locally, on my machine, in order to stop Ubuntu from changing NumLock state at boot?

Or maybe that's a tweak, like Troubleshooting features > [V] Force disable num lock at boot, that was occasionally enabled by default?

I've concluded some searches, what I've found is that:

  • Official information is outdated. There is no such menu in Ubuntu Settings as per 18.04 LTS.
  • A couple of threads, here and there, are also not answering where does the illness seats.
  • Installing and using numlockx is a stub. Why do we need disable (initially enabled) NumLock, and then use additional software to re-enable it? Such an advice really sounds like somthing "conceptually wrong".

Can you help to find out, where is the disease source, and how to fight it?

4
  • 2
    AFAIK it's a hardware issue. I have 2 PCs both running 18.04 LTS. One has a usb keyboard (Num Lock works on boot) the other is a PS2 keyboard (Num Lock doesn't persist on boot). There is no malicious code issue. You are barking up the wrong tree. – 24601 Oct 29 '19 at 9:01
  • @Graham USB keyboard, NumLock does not persists in Ubuntu. But does in another OS. So its definetely a software issue. – xakepp35 Oct 29 '19 at 12:24
  • Nope, can't accept that. The PC where the USB keyboard is working was previously the PC with the PS2 keyboard and didn't work. Same machine, same OS different hardware. This is not a software issue. – 24601 Oct 29 '19 at 14:08
  • @24601 I am experiencing under 20.04 the same problem as xakepp35. In the BIOS I did set Num Lock = On, but during boot it turns off! Maybe this behaviour is because I am using a mini-pc, so Ubuntu is thinking I am using a laptop and laptops don't have a numeric keypad? Other OS from USB-stick does behave as expected. – ffonz Apr 16 at 19:07
2

For Ubuntu Gnome 18.04+

When you are at the login screen the user ID active is gdm (Gnome Desktop Manager). To change that profile login with your own user ID and use:

sudo -i
xhost +SI:localuser:gdm
su gdm -s /bin/bash
gsettings set org.gnome.settings-daemon.peripherals.keyboard numlock-state 'on'
gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click true

For a plethora of even more options:


For Ubuntu Unity 16.04+

Install the the program numlockx:

$ sudo apt update && sudo apt install numlockx

$ numlockx -h
NumLockX 1.2
(C) 2000-2001 Lubos Lunak <l.lunak@kde.org>
(C) 2001      Oswald Buddenhagen <ossi@kde.org>

Usage: numlockx [on|off|toggle|status]
on     - turns NumLock on in X ( default )
off    - turns NumLock off in X
toggle - toggles the NumLock on and off in X
status - gets the NumLock status

Next step is to get it running during login screen:

$ locate 50-unity-greeter.conf
/usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf

$ sudo -H gedit /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf

At bottom of file add:

greeter-setup-script=/usr/bin/numlockx on

Save file and login again.


Catchall when everything fails

Install numlockx as show above. Then

$ sudo -H gedit /etc/rc.local

At bottom of file add:

/usr/bin/numlockx on

Save file and reboot.

3
  • 1
    Hello, thanks for your input. I've tried it but it didn't work. It does not even toggles state on a running machine.. – xakepp35 Oct 31 '19 at 7:22
  • @xakepp35 Turned out many options in the link don't work. I've updated answer with catchall at bottom that worked for me just now. – WinEunuuchs2Unix Oct 31 '19 at 11:07
  • 19.10 responds No such key “numlock-state” – Torben Gundtofte-Bruun Mar 24 '20 at 19:30
2

Ubuntu 20:

All the same reasoning applies but the specific key/values have changed

org.gnome.desktop.peripherals.keyboard remember-numlock-state true
org.gnome.desktop.peripherals.keyboard numlock-state false
1
  • 1
    does not work under Hyper-V – gmlvsv Jun 20 '20 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.