Activating Numlock on Bootup

From ArchWiki
Revision as of 09:07, 5 August 2012 by Gen2ly (talk | contribs) (cleanup)
Jump to: navigation, search

zh-CN:Activating Numlock on Bootup


To activate NumLock during normal bootup in TTY (Teletype) consoles 1-6 (tty1 -> tty6) add the following line to /etc/rc.local:

for tty in /dev/tty?; do /usr/bin/setleds -D +num < "$tty"; done

If the NumLock LED is on but the number pad still works as an arrow keypad it may be because of a conflict between setleds and Xserver. Limit the for command only to the consoles you have set on /etc/inittab:

for tty in /dev/tty{1..6}; do ...

Various methods are available.


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

# ~/.xinitrc
# Executed by startx (run your window manager from here)

numlockx &

exec window_manager


If you use KDM as a login manager, add:

numlockx on

to the /usr/share/config/kdm/Xsetup, or the /opt/kde/share/config/kdm/Xsetup for KDM3.

Note that this file will be overwritten on update without creating a .pacnew file. To prevent this, add the following line to /etc/pacman.conf file (omit the leading slash in the path):

NoUpgrade = usr/share/config/kdm/Xsetup

KDE4 Users

Go to System Settings, under the Hardware/Input Devices/Keyboard item you will find an option to select the behavior of NumLock.

Alternate Method

Alternatively, add the script the ~/.kde4/Autostart/numlockx containing:

numlockx on

And make it executable:

$ chmod +x ~/.kde4/Autostart/numlockx


First make sure that you have numlockx (from extra) installed then add the following code to /etc/gdm/Init/Default:

if [ -x /usr/bin/numlockx ]; then
      /usr/bin/numlockx on


In the file /etc/slim.conf find the line and uncomment it (remove the #):

#numlock             on