Bug#795136: grub-common: Possibility to prevent effect from GRUB_TIMEOUT=0 by keyboard during boot.

Oleksandr Gavenko gavenkoa at gmail.com
Mon Aug 10 20:54:17 UTC 2015


Package: grub-common
Version: 2.02~beta2-22
Severity: normal

I like GRUB_TIMEOUT=0 setting as always think that holding SHIFT or ESC key
during boot stop GRUB2 from automatically selecting menu entry.

Shift key come in mind from https://help.ubuntu.com/community/Grub2 article.

But holding shift does not stop GRUB from loading, this may be achieved by
config like (I test it):

  $ cat /sudo:root at deblaptop:/etc/grub.d/50_shift_key

  #!/bin/sh
  cat <<EOF
  if keystatus --shift ; then
      set timeout=-1
  fi
  EOF

I have filling that "keystatus --shift" check I already have seen in GRUB
configs (in more complicated condition check), but it was removed in newer
package versions.

I don't know proper number for script but /etc/grub.d/00_header and
/etc/grub.d/30_os-prober have assignment to $timeout so must come after them.

It is possible to rewrite condition into somewhat safer variant - change
behavior only when timeout too small (not tested for syntax correctness):

  if [ $timeout -ge 0 -a $timeout -le 2 ] ; then
    if keystatus --shift ; then
        set timeout=-1
    fi
  fi

-- 
Best regards!



More information about the Pkg-grub-devel mailing list