View previous topic :: View next topic |
Author |
Message |
sphakka Tux's lil' helper
Joined: 24 Jun 2003 Posts: 77
|
Posted: Sat Nov 19, 2011 11:29 am Post subject: keyboard layout in single-user boot mode |
|
|
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 |
|
|
tclover Guru
Joined: 10 Apr 2011 Posts: 516
|
Posted: Sat Nov 19, 2011 11:40 am Post subject: Re: keyboard layout in single-user boot mode |
|
|
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 |
|
|
sphakka Tux's lil' helper
Joined: 24 Jun 2003 Posts: 77
|
Posted: Sat Nov 19, 2011 1:31 pm Post subject: Re: keyboard layout in single-user boot mode |
|
|
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 |
|
|
sphakka Tux's lil' helper
Joined: 24 Jun 2003 Posts: 77
|
Posted: Sat Nov 19, 2011 2:41 pm Post subject: [SOLVED] keyboard layout in single-user boot mode |
|
|
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
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 |
|
|
sphakka Tux's lil' helper
Joined: 24 Jun 2003 Posts: 77
|
|
Back to top |
|
|
sphakka Tux's lil' helper
Joined: 24 Jun 2003 Posts: 77
|
Posted: Fri Apr 06, 2012 8:28 pm Post subject: Beware of custom defkeymap built into the kernel |
|
|
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
I don't know if that's a kernel bug...
Beware! |
|
Back to top |
|
|
Jaglover Watchman
Joined: 29 May 2005 Posts: 8291 Location: Saint Amant, Acadiana
|
|
Back to top |
|
|
sphakka Tux's lil' helper
Joined: 24 Jun 2003 Posts: 77
|
Posted: Fri Apr 06, 2012 8:49 pm Post subject: |
|
|
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 . |
|
Back to top |
|
|
sphakka Tux's lil' helper
Joined: 24 Jun 2003 Posts: 77
|
Posted: Sat Apr 07, 2012 7:14 pm Post subject: |
|
|
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 |
|
|
|