Console

Using a separate service

Now you should enable the numLockOnTty.service daemon. Read Daemons for more details.

Extending getty@.service

This is simpler than using a separate service (especially since systemd-198) and does not hardcode the number of VTs in a script. Create a directory for drop-in configuration files:

# mkdir /etc/systemd/system/getty@.service.d

Now add the following file in this directory.

activate-numlock.conf

[Service]
ExecStartPost=/bin/sh -c 'setleds +num < /dev/%I'

Note: Extending unit files with snippets is supported since systemd-198. For older versions you can turn the snippet into a complete unit by including the default getty@.service, but you have to make sure the new unit is used. See revision 250379 of this page for details.

Bash alternative

Add setleds -D +num to ~/.bash_profile. Note that, unlike the other methods, this will not take effect until after you log in.

X.org

Various methods are available.

startx

Install the numlockx package and add it to the ~/.xinitrc file before exec: