how can I set num lock on as the boot default in Ubuntu 20.04

Solution 1:

Thanks to this video,

I installed numlockx

sudo apt install numlockx

then setup a startrup application with "numlockx on" as the command.

Solution 2:

On Ubuntu 20.04.1

Source French: https://doc.ubuntu-fr.org/numlockx

$ sudo apt-get update

$ sudo apt-get install numlockx

Add this line after install numlockx:

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

on file "50-slick-greeter.conf"

Path to diretory:

 $ sudo nemo /usr/share/lightdm/lightdm.conf.d/50-slick-greeter.conf


[Seat:*]
greeter-session=slick-greeter
greeter-setup-script=/usr/bin/numlockx on

Solution 3:

No additional package needed, just follow this pathway:

Application Menu > Preferences > LXQt settings > Keyboard and Mouse > Keyboard > Turn on NumLock after login

Solution 4:

This feature is temporarily broken. My preferred workaround uses xdotool (great for desktop automation), install if not already present. Place the following line in a startup script, or can be added to ~/.bashrc if terminal opens on startup:

xdotool key Num_Lock

To make persistent across suspends/hibernates, create (as root) /etc/pm/sleep.d/90_numlock-temp-fix with the following contents:

#!/bin/bash
case "$1" in
  resume|thaw)
    xdotool key Num_Lock
  ;;
esac

Backstory: The following two keys should work to both set numlock on and make that the default bootup state.

  • org.gnome.desktop.peripherals.keyboard numlock-state true
  • org.gnome.desktop.peripherals.keyboard remember-numlock-state true

In 20.04.1, at least so far, they are ignored.

Unused keys are typically a tipoff that the object controls are in a state of flux. There are several dealing with numlock so expect this to be fixed, hopefully in the next minor release (which should be out any time now?).

If these two keys are already set, watch for the bootup numlock state to return to 'off', which means the bug is fixed and this workaround can be removed. (Numlock will then boot 'on'.)