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?

xakepp35
  • 287
  • 5
  • 13
  • 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. – graham Oct 29 '19 at 09: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. – graham 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 '21 at 19:07

3 Answers3

3

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
Kulfy
  • 17,416
  • 26
  • 64
  • 103
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.

WinEunuuchs2Unix
  • 99,709
  • 34
  • 237
  • 401
0

I actually wanted to disable numlock but this may well also force the enable situation as well.

I installed numlockx by running:

sudo apt install numlockx

and set the default status in /etc/default/numlockx:

# Configuration file for numlockx

# State of numlog on start of X session
# Accepts following options:
#  auto - turns numlock on unless ran on laptop
#  on - turns numlock on
#  off - turns numlock off
#  keep - does not change numlock state
#  toggle - toggles numlock state
NUMLOCK=off

A sledgehammer approach but worked.

BeastOfCaerbannog
  • 12,964
  • 10
  • 49
  • 77