How to set 'numlock on' as default at login screen?

@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


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.