[HowTo] Automatically enabling NumLock on ttys

There already are various methods for automatically enabling NumLock in graphical sessions, but I personally find it handy to also automatically have it enabled in tty sessions, and maybe you do too. Well, here’s how to do it. :wink:

You need a package from the AUR, called systemd-numlockontty. As most software packages available through the AUR, this package comes as source code only, which will be built into binary code on your local system via makepkg and a PKGBUILD script. It doesn’t take very long to build, though. :wink:

First, you must fetch and build the package from the AUR, as follows… :arrow_down:

pamac build systemd-numlockontty

… or, if you wish, … :arrow_down:

yay -S systemd-numlockontty

For those who prefer another AUR helper than yay, such as trizen or picaur, you can of course substitute yay in the above command by trizen, picaur, or whichever other AUR helper you prefer. And if you do use either of those, then you already know this. :stuck_out_tongue:

Of course, for those of you who are allergic to the command line, you can also fetch, build and install this package via your GUI package manager of choice if it has AUR access enabled. But then again, if you’re really allergic to the command line, then why would you even want to enable NumLock on ttys in the first place, right? :stuck_out_tongue:

Anyway, once the package has been built and installed, you can immediately enable it in your running instance and have it run at every next boot all in one go, like so… :arrow_down:

sudo systemctl enable --now systemd-numLockOnTty.service

Note: If you have journald or another system logger directly mirroring its output to tty12 — which should be the default nowadays — then your NumLock will not be enabled on tty12. There’s no point in that anyway, because tty12 is not an interactive console.


1 Like