Bug#741464: grub-pc-bin: hangs after displaying boot menu

Marco Gamberoni gamberoni at libero.it
Sun Feb 1 22:16:59 UTC 2015


On Mon, 15 Dec 2014 10:51:43 +0100 Jeroen Dekkers <jeroen at dekkers.ch> wrote:
> Thu, 16 Oct 2014 17:57:20 +0200 Sven Joachim <svenjoac at gmx.de> wrote:
...
> I tried to reproduce this in a virtual machine (using kvm), but under
> kvm everything seems to work fine including the german keyboard
> layout. When I tried it on real hardware I could reproduce the
> problem, but instead of freezing I got garbage input after switching
> terminal_input to at_keyboard.
> 
> 
> Kind regards,
> 
> Jeroen Dekkers
> 
> 
I see this same at_keyboard behaviour: working in VirtualBox, delivering garbage on this real hardware:
 - an HP Proliant DL380 Gen5 machine
 - with a Compaq PS/2 keyboard italian layout attached
 - booted from an iso image made with grub-mkrescue (GRUB) 2.02~beta2-15, containing a keyboard layout file made with
      ckbcomp -model pc105 -layout it | grub-mklayout -o pc105-it.gkb

The iso image boots to a grub command line, where these commands reproduce the buggy behaviour:
    set debug=atkeyb
    terminal_input at_keyboard
now any key produces garbage, and a message
    term/at_keyboard.c:461: Unknown key 0xf0 from set 1
Having read
    http://web.archive.org/web/20040604041507/http://panda.cs.ndsu.nodak.edu/~achapwes/PICmicro/keyboard/atkeyboard.html
it is obvious what's going on: at_keyboard is using scankey set 1 but the keyboard is using set 2 and the keyboard controller is not translating.
The cause of the mismatch is the XLAT bit in the keyboard controller command byte that transitions from 1 to 0 while grub executes terminal_input at_keyboard. 
I can prove my theory only using a serial port to maintain a working input channel to grub:
    serial
    terminal_input at_keyboard serial_com1
gives a non working at_keyboard and a working serial input. From the serial input, these grub commands make at_keyboard work:
    outb 0x64 0x60 ; outb 0x60 0x40 0x40
outb is not documented in info grub, what they do is setting to 1 the XLAT bit in the keyboard controller command byte.
Now grub happily accepts
    keymap (cd)/pc105-it.gkb
that gives me the working at_keyboard with italian layout I will need it to enter LUKS passphrases.

I suppose the fact that this one liner IS NOT DOING THE JOB (the keyboard controller does not get the XLAT bit set)
    terminal_input at_keyboard ;  outb 0x64 0x60 ; outb 0x60 0x40 0x40
should signify something, but I have not found what, looking at at_keyboard.c
    http://code.metager.de/source/xref/gnu/grub/grub-core/term/at_keyboard.c#grub_keyboard_controller_init
Clearly, the initialization performed in grub_keyboard_controller_init is incomplete, but I cannot see where the XLAT bit gets reset after 'terminal_input at_keyboard' command returns.

Ciao

Marco Gamberoni



More information about the Pkg-grub-devel mailing list