0

In earlier Ubuntu versions I would do:

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

But starting from version 16.10 there is no file rc.local, so how to I enable numlock in version 17.04 without desktop environment?

Update: I created rc.local file as described https://askubuntu.com/a/919598/158442, then executed commands mentioned earlier and now numpad works when I connect over SSH. For it to work in VirtualBox I added these lines to rc.local:

# Turn Numlock on for the TTYs:
for tty in /dev/tty[1-6]; do
    /usr/bin/setleds -D +num < $tty
done

And now everything works!

Valdas
  • 121
  • 5
  • Possible, but I do not want to replicate `rc.local` functionality, there were reasons it was removed, I just want to be able to use my numpad :) – Valdas Jul 13 '17 at 08:06
  • You don't need to replicate anything. See https://askubuntu.com/a/919598/158442. Since `rc.local` is run if it exists and is executable, and the default `rc.local` never did anything, obviously there's no need to keep it in the default. Anybody who wants to use simply needs to create it. – muru Jul 13 '17 at 08:53
  • ok, I tried that, but when I do `sudo printf '#!/bin/bash\nexit 0' > /etc/rc.local` I get error Permission denied... – Valdas Jul 13 '17 at 09:58
  • That would be because of https://askubuntu.com/q/230476/158442. I fixed those commands in an edit just now. – muru Jul 13 '17 at 10:03
  • Thank You @muru, numpad now works when I connect over SSH, but it still does not work when typing in the computer itself (I have it running in a VirtualBox) – Valdas Jul 13 '17 at 10:11

1 Answers1

2

I created rc.local file as suggested by @muru and described at https://askubuntu.com/a/919598/158442, then executed commands mentioned earlier and now numpad works when I connect over SSH.

For it to work in VirtualBox I added these lines to rc.local:

# Turn Numlock on for the TTYs:
for tty in /dev/tty[1-6]; do
    /usr/bin/setleds -D +num < $tty
done

And after reboot everything works!

Valdas
  • 121
  • 5