dgordon42
Posts: 764
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Booting Stretch to the CLI with NumLock on [Solved]

Sun Sep 03, 2017 12:10 pm

Has anyone found a way to boot a fresh copy of Raspbian Stretch to the CLI with NumLock on?

In Jessie, I could set (uncomment) "LEDS=+num" in '/etc/kbd/config' to do this, but the '/etc/kbd/' directory is not present in Stretch by default.

I have tried adding "LEDS=+num" to the '/etc/default/console-setup' and '/etc/default/keyboard' files, but no luck.

I have installed "numlockx", but that only works with the GUI.

Thanks,
Dave.
Last edited by dgordon42 on Sun Sep 10, 2017 11:51 am, edited 1 time in total.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: Booting Stretch to the CLI with NumLock on

Sun Sep 03, 2017 12:20 pm

In Jessie, I could set (uncomment) "LEDS=+num" in '/etc/kbd/config' to do this, but the '/etc/kbd/' directory is not present in Stretch by default.
Have you tried creating that directory/file? I know it is basic, but sometimes this works.
Maybe it was just an oversight on the part of the Stretch-makers - not creating the directory.
If this post appears in the wrong forums category, my apologies.

dgordon42
Posts: 764
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Booting Stretch to the CLI with NumLock on

Sun Sep 03, 2017 12:48 pm

Martin Frezman wrote:Have you tried creating that directory/file? ...
Maybe it was just an oversight on the part of the Stretch-makers - not creating the directory.
Thanks for the reply.
The 'kbd' package is installed in Stretch by default, but the '/etc/kbd/' directory is deliberately left out. There is some information in the file '/usr/share/doc/kbd/NEWS.Debian.gz'. This file suggests using the 'console-setup' package to set up the keyboard, but I cannot find a way using this package to set the NumLock to on.
The NEWS.Debian file also says that if you upgrade to Stretch, the '/etc/kbd/*' will exist, but suggests that you move your settings and delete it, but it dose not say to where.

I do intend to try creating '/etc/kbd/config' with just a "LEDS=+num" entry, but I thought I would ask here first to see if there is a more up to date method.

Thanks,
Dave.

Martin Frezman
Posts: 1020
Joined: Mon Oct 31, 2016 10:05 am

Re: Booting Stretch to the CLI with NumLock on

Sun Sep 03, 2017 1:50 pm

So, that's a "no", right?
If this post appears in the wrong forums category, my apologies.

dgordon42
Posts: 764
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Booting Stretch to the CLI with NumLock on

Sun Sep 03, 2017 2:03 pm

Martin Frezman wrote:So, that's a "no", right?
Correct.
The '/usr/share/doc/kbd/NEWS.Debian.gz' file in Stretch recommends not keeping the '/etc/kbd/' directory in Stretch, but does not ban it.
As having the machine boot up with NumLock off is not a major problem, I plan on waiting a day or so to see if there is a "Stretch" way of doing this. If I don't get any answers, I was planing on creating a '/etc/kbd/config' file anyway to see what happens.

Thanks,
Dave.

dgordon42
Posts: 764
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Booting Stretch to the CLI with NumLock on

Sat Sep 09, 2017 6:25 pm

Tried creating the '/etc/kbd/config' file with the line "LEDS=+nums", but the Pi still boots with NumLock off.

Dave.

gkaiseril
Posts: 654
Joined: Mon Aug 08, 2016 9:27 pm
Location: Chicago, IL

Re: Booting Stretch to the CLI with NumLock on

Sat Sep 09, 2017 8:45 pm

You can add the appliction numlockx and then add "numlockx 0n" to your startup script.
f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng.

dgordon42
Posts: 764
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Booting Stretch to the CLI with NumLock on [Solved]

Sun Sep 10, 2017 11:50 am

gkaiseril wrote:You can add the appliction numlockx and then add "numlockx 0n" to your startup script.
I have numlockx installed, but that only works in the X GUI

I am now using the script suggested in 'setleds' man page, and calling it with '@reboot' in crontab, and the Pi is booting to the CLI with NumLock on.

I am marking this Solved.

Thanks for the replies,
Dave.

MikeZWorx
Posts: 1
Joined: Wed Jan 17, 2018 1:22 am

Re: Booting Stretch to the CLI with NumLock on [Solved]

Wed Jan 17, 2018 1:33 am

To turn Numlock on at startup (on Raspbian Stretch) :

Code: Select all

sudo apt-get install numlockx

Code: Select all

sudo nano /usr/share/lightdm/lightdm.conf.d/01_debian.conf
At the end, add

Code: Select all

greeter-setup-script=/usr/bin/numlockx on
Save. Reboot. Yer Done.

Credit: unix.stackexchange.com/questions/375920/numlock-on-startup-on-linux-mint-18-2

chris87p
Posts: 2
Joined: Mon Jul 23, 2018 12:04 am

Re: Booting Stretch to the CLI with NumLock on [Solved]

Fri Aug 03, 2018 9:24 am

I'm going to write out step by step instructions, because I had trouble figuring out what the actual solution was. One solution works only for the CLI and one works only for the GUI. It looks like they both set Num Lock independently when they boot. I just did both.

To Boot to CLI with Num Lock On

Use your rc.local file to set Num Lock to on during boot. Edit the rc.local! file using:

Code: Select all

sudo  nano /etc/rc.local
Insert the following after the comments and before exit 0.

Code: Select all

INITTY=/dev/tty[1-8]
for tty in $INITTY; do
     setleds -D +num < $tty
done
Now Num Lock will come on when you boot into the CLI. But it will turn off again when the Destkop/GUI boots.

To Boot to Desktop/GUI with Num Lock On

Code: Select all

sudo apt-get install numlockx
I didn't have to add anything to my default file to get numlockx to auto-start. But if you have trouble, you should check out MikeZWorx's post above.

Return to “Raspbian”