LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 05-19-2022, 01:58 AM   #1
Weapon S
Member
 
Registered: May 2011
Location: Netherlands
Distribution: Debian, Archlinux
Posts: 262
Blog Entries: 2

Rep: Reputation: 49
How do I turn numlock on at console start-up by reconfiguring initramfs?


I'm trying to get numlock to be on at start-up (console password prompt), but I don't use systemd, nor a desktop manager. This Arch Linux Wiki page suggests it can be done by changing some options of initramfs. The exact method seems not applicable to Debian though.

This page seems to offer a solution, but it seems sketchy to me, because the poster admits that they are not well versed in the subject, and adding an extra binary to the boot process (setleds) seems like a roundabout way for something this fundamental. My reasoning is that surely, if the boot process can turn off my numlock from my motherboard settings, there should be a way to tell it to not to turn off numlock.

I couldn't find any relevant kernel parameters either.
 
Old 05-19-2022, 03:45 AM   #2
Weapon S
Member
 
Registered: May 2011
Location: Netherlands
Distribution: Debian, Archlinux
Posts: 262

Original Poster
Blog Entries: 2

Rep: Reputation: 49
Solved... I guess

I looked up how the openrc numlock service tackled this problem (because I use openrc), which can be found here. That service seems to use systemd and an approach very similar to the solution provided at the link to superuser.com. So I used the solution at superuser.com.

Summarized:

/usr/share/initramfs-tools/hooks
Code:
#! /bin/sh -e

PREREQ=""

prereqs () {
    echo "$PREREQ"
}

case $1 in
prereqs)
    prereqs
    exit 0
    ;;
esac

. /usr/share/initramfs-tools/hook-functions

# Add setleds to initrd
if test -x /usr/bin/setleds ; then
   copy_exec /usr/bin/setleds /usr/bin/setleds
fi

exit 0
/usr/share//initramfs-tools/scripts/init-top
Code:
#!/bin/sh

PREREQ="console_setup brltty"
prereqs()
{
    echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
    prereqs
    exit 0
    ;;
esac

if [ -x /usr/bin/setleds ] ; then
   INITTY=/dev/tty[1-8]
   for tty in $INITTY ; do 
       setleds -D +num < $tty 
       done 
fi

exit 0
Run
Code:
# update-initramfs -u
 
  


Reply

Tags
initramfs, numlock



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
numlock turn on auto with start whited Linux - General 2 03-05-2005 11:53 AM
How can I make my debian turn NumLock on automatically? LittlesnowLinux Debian 8 11-26-2004 06:40 AM
making numlock turn on at kdm startup nafan Mandriva 2 08-23-2004 12:12 PM
turn on numlock (wmaker) eduac Linux - Software 1 12-01-2003 01:23 PM
how to turn numlock on automatically? Alf829 Linux - Newbie 6 08-22-2003 08:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 09:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration