Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
keyboard layout in single-user boot mode
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Sat Nov 19, 2011 11:29 am    Post subject: keyboard layout in single-user boot mode Reply with quote

Hi,

I use OpenRC-0.9.4 and baselayout-2.
I can't manage to log in at single-user boot prompt (maintenance password asked): it looks like my default keyboard layout (IT) is not loaded.
Is there a way to configure a non-US keyboard layout for runlevel S, without tweaking my inittab? Better off would be having it in GRUB...

Cheers,

^s
Back to top
View user's profile Send private message
tclover
Guru
Guru


Joined: 10 Apr 2011
Posts: 516

PostPosted: Sat Nov 19, 2011 11:40 am    Post subject: Re: keyboard layout in single-user boot mode Reply with quote

sphakka wrote:
I can't manage to log in at single-user boot prompt (maintenance password asked): it looks like my default keyboard layout (IT) is not loaded.

Of course it's not loaded if keymap init service is not started. The same is true for consolefont and other init services. If you can boot into boot runlevel, then go ahead and you'll be able to login.

If ever you have an initramfs with loadable keymap/font at boot time (kernel cmdline or default behaviour of the init script), you could get your keymap/font loaded. Alternatively, if that said initramfs offers a minimal/rescue shell, you could pretty well load manually the keymap/font and then switch root with something like `exec switch_root /newroot /sbin/init 1' to boot to single mode with your it keymap loaded.

NOTE: looak at my signature for such an initramfs that offers all that easily. You can even boot to single/boot, any runlevel with a kernel cmdline as well. Anyway, youu can pretty much add any aditional reasonable tools to it for maintenance purpose, fsck for example.
_________________
home/:mkinitramfs-ll/:supervision/:e-gtk-theme/:overlay/
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Sat Nov 19, 2011 1:31 pm    Post subject: Re: keyboard layout in single-user boot mode Reply with quote

tclover wrote:
If ever you have an initramfs with loadable keymap/font at boot time (kernel cmdline or default behaviour of the init script), you could get your keymap/font loaded.

I thought of doing that, but I wonder if there is a more direct way (my PC is a laptop and I don't use any external keyboard).
I see that loadkeys allows to dump a 'defkeymap' for the kernel sources, so f.i. (found at http://en.gentoo-wiki.com/wiki/TinyGentoo)
Code:

/usr/src # loadkeys -m /usr/share/keymaps/i386/qwerty/it.map.gz > defkeymap-3.0.6-gentoo.it.c
/usr/src # cp defkeymap-3.0.6-gentoo.it.c linux/drivers/char/defkeymap.c

Maybe a bit too radical/hackish... I'll try it, hoping not to screw up anything -- finger crossed ;-)
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Sat Nov 19, 2011 2:41 pm    Post subject: [SOLVED] keyboard layout in single-user boot mode Reply with quote

Hurray, it works!

But the correct location for defkeymap in recent kernels (mine is 3.0.6) is 'drivers/tty/vt/defkeymap.c', thus the correct command sequence is:
Code:

[ /usr/src/linux # make clean ]
/usr/src/linux # make menuconfig
/usr/src/linux # loadkeys -m /path/to/your.map.gz > drivers/tty/vt/defkeymap.c
/usr/src/linux # make


Mind to inject your keymap *after* 'make menuconfig' else it'll overwrite the keymap with the shipped one.

No more keyboard idiosyncrasies at rescue boot, he, he 8-)

As for GRUB, a possible solution is to configure a set of key swaps via 'setkey'. See .f.i http://www.kanotix.com/index.php?module=pnWikka&tag=GrubBootManager.
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Sat Nov 19, 2011 2:45 pm    Post subject: Reply with quote

Argh, a dot sneaked in the link for GRUB conf. It is http://www.kanotix.com/index.php?module=pnWikka&tag=GrubBootManager
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Fri Apr 06, 2012 8:28 pm    Post subject: Beware of custom defkeymap built into the kernel Reply with quote

Back on this after some misadventure.

As I wrote before, this hack of building a custom keymap into the kernel worked fine, until I tried by mistake to load a different keymap ('us') and... damn, *crashed* the kernel :roll:
I don't know if that's a kernel bug...

Beware!
Back to top
View user's profile Send private message
Jaglover
Watchman
Watchman


Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Fri Apr 06, 2012 8:31 pm    Post subject: Reply with quote

If you boot into single user mode no password is required, just add init=/bin/bash to the kernel command line.
_________________
My Gentoo installation notes.
Please learn how to denote units correctly!
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Fri Apr 06, 2012 8:49 pm    Post subject: Reply with quote

Jaglover wrote:
If you boot into single user mode no password is required, just add init=/bin/bash to the kernel command line.


Yep, I know that, thanks (and with openrc, rc_shell=/sbin/sulogin should be changed as well, in '/etc/rc.conf'). My problem is that I never managed to use a keyboard with a physical layout that doesn't match the keymap...

Let's say that, instead of the hassle of blindly fiddling with keys + mounting /usr read-only + calling loadkeys, I chose the risk of hacking. I'm quite proud anyway to have found a way of crashing the kernel in a repeatable manner 8).
Back to top
View user's profile Send private message
sphakka
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jun 2003
Posts: 77

PostPosted: Sat Apr 07, 2012 7:14 pm    Post subject: Reply with quote

BTW, another annoying issue I have is that the keyboard (standard AT, driver compiled into the kernel) doesn't go up immediately after sysinit is started: it takes approximately 20 seconds -- that's also preventing me from using opnerc's interactive feature :-( I searched around a lot for an explanation but found nothing. Has anybody any idea?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum