Boot with number lock on
Hello, I have just got my pi and started using it, I have noticed that the system boots with num lock off, I use the number pad on the keyboard a LOT so this is a bit of a pain, is there a way to change the boot so that number lock is on by default? Thank-you in advance.
Re: Boot with number lock on
Hi magichat,
I'm having the same issue. I use the NUM lock a lot too. Hopefully someone will post a (simple) solution!
I'm having the same issue. I use the NUM lock a lot too. Hopefully someone will post a (simple) solution!
Re: Boot with number lock on
First post on Raspberry Pi.
This topic is number 1 on google so I figured I could contribute.Test to see if installed.Make a startup script.Insert this code in vim.
You'll need to set the script.Press "i" to input and Ctrl+C and type ":wq!" to finish.Add this to the bottomSave and reboot!
Edit: Forgot chmod
This topic is number 1 on google so I figured I could contribute.
Code: Select all
sudo apt-get install numlockx
Code: Select all
numlockx on
numlockx off
Code: Select all
cd ~/.config
vi numlock.sh
Code: Select all
#! /bin/bash
numlockx on
Code: Select all
chmod +x numlock.sh
Code: Select all
sudo crontab -e
Code: Select all
@reboot cd /home/pi/.config && ./numlock.sh
Edit: Forgot chmod
Re: Boot with number lock on
Thanks LinkCloud,
Much appreciated, I used nano instead of vim as I just can't get used to the annoying semantics of vim, I start gnawing keyboards whenever vim is mentioned
Dan
Much appreciated, I used nano instead of vim as I just can't get used to the annoying semantics of vim, I start gnawing keyboards whenever vim is mentioned

Dan
Re: Boot with number lock on
Thanks that works fine I use leafpad after startx because I too hate vi & it's ilk.
Re: Boot with number lock on
not sure if you can do it via edting
/etc/kbd/config
/etc/kbd/config
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Boot with number lock on
Thanks for the information - you are right (at least with the version of Raspbian that i am running). There is a line in the file that is commented out by default (LEDS=+num). Just remove the '#' character in front of the line, save the file, and reboot and NumLock is set - no other installations or changes are required! But unfortunately if you use the LXDE GUI (startx) it does not inherit this environment setting and it starts with number lock off if this is the only change you make. When you exit back to the console the number lock will be turned back on again.RaTTuS wrote:not sure if you can do it via edting
/etc/kbd/config
Re: Boot with number lock on
Yes, a quick search shows LXDE GUI has number lock default to off.
On GNOME you can set 'remember-numlock-state' using dconf-editor (org>gnome>settings-daemon>peripherals>keyboard) or 'gsettings set org.gnome.settings-daemon.peripherals.keyboard remember-numlock-state true' in terminal.
Likewise, I've found org>gnome>desktop>a11y>keyboard on Raspbian, but no numlock settings
Why a numlock option isn't included in the 'Mouse and Keyboard Settings' preferences tool is beyond me... I've had enough of Linux, and am going back to using my beloved RISC OS
On GNOME you can set 'remember-numlock-state' using dconf-editor (org>gnome>settings-daemon>peripherals>keyboard) or 'gsettings set org.gnome.settings-daemon.peripherals.keyboard remember-numlock-state true' in terminal.
Likewise, I've found org>gnome>desktop>a11y>keyboard on Raspbian, but no numlock settings

Why a numlock option isn't included in the 'Mouse and Keyboard Settings' preferences tool is beyond me... I've had enough of Linux, and am going back to using my beloved RISC OS

Re: Boot with number lock on
this thread is 4 yours oldRichMoly wrote:Yes, a quick search shows LXDE GUI has number lock default to off.
On GNOME you can set 'remember-numlock-state' using dconf-editor (org>gnome>settings-daemon>peripherals>keyboard) or 'gsettings set org.gnome.settings-daemon.peripherals.keyboard remember-numlock-state true' in terminal.
Likewise, I've found org>gnome>desktop>a11y>keyboard on Raspbian, but no numlock settings
Why a numlock option isn't included in the 'Mouse and Keyboard Settings' preferences tool is beyond me... I've had enough of Linux, and am going back to using my beloved RISC OS
however I think you can probably do it via the /etc/kbd/config file [LEDS=+num]
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Boot with number lock on
Thanks, but as urkraft points out, and hence my reply, the GUI (the horrible IMHO Pixel) ignores the config setting. Besides, why should a user have to edit a config setting for something like this?!
Re: Boot with number lock on
dunno much about pixel however this may work as PIXEL is LXDM
sudo apt-get install numlockx
sudo nano /etc/lightdm/lightdm.conf
find
#greeter-setup-script =
and change to
greeter-setup-script = /usr/bin/numlockx on
sudo nano
/etc/xdg/lxsession/LXDE/autostart
and add
/usr/bin/numlockx on
it is this way because this is the sensible configuration
why should other people have to edit something to make it as it should be ... [ha!]
sudo apt-get install numlockx
sudo nano /etc/lightdm/lightdm.conf
find
#greeter-setup-script =
and change to
greeter-setup-script = /usr/bin/numlockx on
sudo nano
/etc/xdg/lxsession/LXDE/autostart
and add
/usr/bin/numlockx on
it is this way because this is the sensible configuration
why should other people have to edit something to make it as it should be ... [ha!]

Last edited by RaTTuS on Tue Jan 03, 2017 7:45 am, edited 1 time in total.
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Boot with number lock on
Thanks again, I'll give that a try, when I'm with my Pi 
Whilst I like having Num Lock on by default, my main reason for it on the Pi is so I can see from the keyboard LED if my kids have left the damn thing on... again!
No fan noise, obscured power LED and supply, and non-functioning DPMS (another setting I have to change in Config I believe) so they turn the monitor off between usage, I guess it's inevitable...

Whilst I like having Num Lock on by default, my main reason for it on the Pi is so I can see from the keyboard LED if my kids have left the damn thing on... again!
No fan noise, obscured power LED and supply, and non-functioning DPMS (another setting I have to change in Config I believe) so they turn the monitor off between usage, I guess it's inevitable...
Re: Boot with number lock on
just leave it running - it uses so little power ....
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
-
- Posts: 1
- Joined: Fri Dec 30, 2016 8:40 pm
- Location: Newark, DE, USA
Re: Boot with number lock on
@RaTTuS - your prescription was right on the money.
Thanks for helping! The only correction I needed to make on my pi 3 was the directory to find the autostart file as below. You may have intended to type lxsession instead of xsession.
/etc/xdg/lxsession/LXDE/
My kernel/system build is:
$ uname -a
Linux raspberrypi 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux
I'm keeping a diary of all these system tweaks. I've needed to make many (from out of the box) to suit my preferences and get basic components of the hardware working properly.
Cheers!

/etc/xdg/lxsession/LXDE/
My kernel/system build is:
$ uname -a
Linux raspberrypi 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux
I'm keeping a diary of all these system tweaks. I've needed to make many (from out of the box) to suit my preferences and get basic components of the hardware working properly.
Cheers!
Re: Boot with number lock on
fixed and yes a typomsjames19702 wrote:@RaTTuS - your prescription was right on the money.Thanks for helping! The only correction I needed to make on my pi 3 was the directory to find the autostart file as below. You may have intended to type lxsession instead of xsession.
/etc/xdg/lxsession/LXDE/
/...
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
WARNING - some parts of this post may be erroneous YMMV
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe
Re: Boot with number lock on
Not to necro this thread, but...
If you want numlock turned on so that the tenkey works without having to remember to press the num lock key, you can add
to the end of your ~/.bashrc
It won't turn on until you log in, which is okay for me at least, since I can't really do anything with the tenkey until I'm logged in anyway.
If you want it turned on before login (to use the LED as power indicator), I just found a post on the Debian forum
It's a little more complicated, but it works!
Here's the gist in case the link dies:
From a terminal:
All credit goes to user cybermcm on the Debian forum.
If you want numlock turned on so that the tenkey works without having to remember to press the num lock key, you can add
Code: Select all
setleds -D +num
It won't turn on until you log in, which is okay for me at least, since I can't really do anything with the tenkey until I'm logged in anyway.
If you want it turned on before login (to use the LED as power indicator), I just found a post on the Debian forum
It's a little more complicated, but it works!
Here's the gist in case the link dies:
From a terminal:
- add
Code: Select all
pi@raspberrypi:~$ sudo nano /usr/bin/numlock
and save.Code: Select all
#!/bin/bash # Turn Numlock on for the TTYs: for tty in /dev/tty[1-6]; do /usr/bin/setleds -D +num < "$tty"; done
- add
Code: Select all
pi@raspberrypi:~$ sudo nano /etc/systemd/system/numlock.service
and save. (Capitalization is important!)Code: Select all
[Unit] Description=numlock [Service] ExecStart=/usr/bin/numlock StandardInput=tty RemainAfterExit=yes [Install] WantedBy=multi-user.target
Code: Select all
pi@raspberrypi:~$ sudo systemctl enable numlock.service
- reboot and see if it works for you, too!
All credit goes to user cybermcm on the Debian forum.
Last edited by puzzola on Wed Jan 23, 2019 2:47 am, edited 2 times in total.
Re: Boot with number lock on
Tried this but... "bash: $: command not found " ... Using Raspberry 3 B+
Re: Boot with number lock on
rpdom wrote:
Oops, yeah, I should've made that clearer. Fixed, I hope? Thanks!Pugg wrote:
-
- Posts: 221
- Joined: Tue May 22, 2012 11:19 pm
Re: Boot with number lock on
Wow, that's a lot of steps just to get the numlock key on at start-up. Why isn't it the other way around? What percentage of people use the numpad for cursor direction when there are dedicated keys to the left of them?
Raspberry Pi 3 B and B+
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"