7

In Ubuntu 16.04 i was able to open numlock on login screen as default with the help of this url:

How to enable numlock at boot time for login screen?

However it doesn't work with Ubuntu 18.04.It throws an error saying that there is no rc.local directory.

Is there a way to fix this?

Your help is very appreciated!

Thanks a lot.

Stockfish
  • 601

3 Answers3

15

@bonhomag solution worked for me in 18.04 (original post):

You need to set it as gdm user via gsettings command

The solution that should work:

  1. Open terminal via Ctrl+Alt+T, then run command to get root privilege:

    sudo -i

  2. Switch to user gdm in the terminal:

    su gdm -s /bin/bash

  3. Finally set ‘Numlock on’ via gdm user:

    gsettings set org.gnome.settings-daemon.peripherals.keyboard numlock-state 'on'

Restart the computer and done

Albert
  • 151
2

There is a package for numlockx in bionic, version 1.2-7ubuntu1. So apt install numlockxshould do first part of the solution you linked above.

The problem is, there is no rc.local to start it anymore. You will need to configure systemd to run numlockx once after startup like rc.local would have done. This was already described here: How can I execute command on startup (rc.local alternative) on Ubuntu 16.10

Alternatively, you could go with the second answer in the linked answer.

pdr
  • 143
  • 4
0

Ubuntu 22.04

You can use gsettings and tell Gnome to remember the NumLock state by executing this from the terminal:

gsettings set org.gnome.desktop.peripherals.keyboard remember-numlock-state true
sotirov
  • 3,169