Bug 2020927

Summary: GRUB_TERMINAL_INPUT=at_keyboard makes grub stay on boot menu instead of starting the timeout
Product: Red Hat Enterprise Linux 8 Reporter: Pradeep Jagtap <prjagtap>
Component: grub2Assignee: Bootloader engineering team <bootloader-eng-team>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.4CC: jcastran, pjanda, pzatko, rharwood, rmetrich
Target Milestone: rcKeywords: OtherQA
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: grub2-2.02-114.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 15:31:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch fixing the issue
none
No countdown with 2.02-106.el8.x86_64
none
Countdown with 2.02-114.el8.x86_64 none

Description Pradeep Jagtap 2021-11-07 12:18:11 UTC
Description of problem:
 GRUB_TERMINAL_INPUT=at_keyboard makes grub stay on boot menu instead of starting the timeout

Version-Release number of selected component (if applicable):
grub2-pc-2.02-99.el8_4.1.x86_64

How reproducible:
Steps to Reproduce:
1. Add below line in /etc/default/grub fi;e
         GRUB_TERMINAL_INPUT="at_keyboard"
2. Regenerate grub.cfg file
       # grub2-mkconfig -o /boot/grub2/grub.cfg
3. Reboot the system

Actual results:
Grub menu is shown, no timeout available, need to manually select the kernel

Expected results:
Grub menu with timeout

Comment 3 Renaud Métrich 2021-11-08 16:21:08 UTC
Argh! I'll work on this tomorrow.
Actually I'm not sure this was ever tested since I was more concerned with making sure "a" prints a "a" in non-us keyboards, than verifying timeout was still working ...

Comment 4 Renaud Métrich 2021-11-09 08:53:56 UTC
I confirm I can reproduce as well.

A workaround is to use the following property in /etc/default/grub and rebuild the menu:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
GRUB_TIMEOUT_STYLE="countdown"
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Comment 5 Renaud Métrich 2021-11-09 09:43:54 UTC
This was fixed Upstream by:

commit 33203ca3484717712b54e199c46ae8a818374284
Author: Michael Bideau <mica.devel>
Date:   Wed Oct 2 23:48:10 2019 +0200

    at_keyboard: Fix unreliable key presses
    
    This patch fixes an issue that prevented the at_keyboard module to work
    (for me). The cause was a bad/wrong return value in the
    grub_at_keyboard_getkey() function in grub-core/term/at_keyboard.c file
    at line 237. My symptoms were to have an unresponsive keyboard. Keys
    needed to be pressed 10x and more to effectively be printed sometimes
    generating multiple key presses (after 1 or 2 sec of no printing). It
    was very problematic when typing passphrase in early stage (with
    GRUB_ENABLE_CRYPTODISK). When switched to "console" terminal input
    keyboard worked perfectly. It also worked great with the GRUB 2.02
    packaged by Debian (2.02+dfsg1-20). It was not an output issue but an
    input one.
    
    I've managed to analyze the issue and found that it came from the commit
    216950a4e (at_keyboard: Split protocol from controller code.). Three
    lines where moved from the fetch_key() function in
    grub-core/term/at_keyboard.c file to the beginning of
    grub_at_keyboard_getkey() function (same file). However, returning -1
    made sense when it happened in fetch_key() function but not anymore in
    grub_at_keyboard_getkey() function which should return GRUB_TERM_NO_KEY.
    I think it was just an incomplete cut-paste missing a small manual
    correction. Let's fix it.

See also attached patch.

Comment 6 Renaud Métrich 2021-11-09 09:44:30 UTC
Created attachment 1840840 [details]
Patch fixing the issue

Comment 10 Renaud Métrich 2022-02-15 13:56:36 UTC
Created attachment 1861249 [details]
No countdown with 2.02-106.el8.x86_64

Comment 11 Renaud Métrich 2022-02-15 13:57:07 UTC
Created attachment 1861250 [details]
Countdown with 2.02-114.el8.x86_64

Comment 12 Renaud Métrich 2022-02-15 13:59:00 UTC
I can confirm it works with 2.02-114.el8.x86_64 compared to 2.02-106.el8.x86_64.

Screenshots attached.

Procedure:

1. Configure at_keyboard with FR keyboard and reboot (https://access.redhat.com/solutions/5624811)

  --> no countdown

2. Update to 2.02-114.el8.x86_64 and execute "grub2-install" and reboot

  --> 5 seconds countdown

Comment 14 Petr Janda 2022-02-17 17:42:15 UTC
Verified: tested based on comment 12

Comment 19 errata-xmlrpc 2022-05-10 15:31:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Low: grub2 security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:2110