How to enable numlock at boot time for login screen?

On many machines, you can set whether or not Number Lock is turned on on boot, in the BIOS settings (accessible when you first power on the machine).

Otherwise, there are a number of ways to enable (or disable) Number Lock in software, depending on your specific needs. The most useful ways are listed here.

If you want Number Lock turned on when Ubuntu starts (not before that on the GRUB menu, and not afterwards when logging in, and not just for specific virtual consoles), then install numlockx and make the initialization script /etc/init.d/rc.local use it to enable Number Lock:

sudo apt-get update
sudo apt-get -y install numlockx
sudo sed -i 's|^exit 0.*$|# Numlock enable\n[ -x /usr/bin/numlockx ] \&\& numlockx on\n\nexit 0|' /etc/init.d/rc.local

Source: NumLock, by Contributors to the Ubuntu documentation wiki, last line taken verbatim (as this source permits).


Here's what worked for me:

  1. Ensure that numlockx is installed:

    sudo apt-get install numlockx
    
  2. Edit the file /etc/lightdm/lightdm.conf

    gksudo gedit /etc/lightdm/lightdm.conf
    
  3. Add the following line to the file:

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

14.04

Yes, use locate command as follow:

locate 50-unity-greeter.conf

The output is:

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

So, the file you need to edit is the above file.

sudo apt-get install numlockx
gksu gedit /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf

Add this line at the end of file:

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