Skip to contentSkip to conversation

grub2: Patch to correct hidden timeout behavior

PATCH Andreas Cadhalpun 2 participants 2 messages Nov 22, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

I'm using Debian with grub version 2.00-20.
My /etc/default/grub configuration contains the following lines:
GRUB_TIMEOUT=-1
GRUB_HIDDEN_TIMEOUT=3

Expected behavior: When booting, grub should display a three second countdown and if no key is pressed, boot the default grub entry, after the countdown finishes.

Current behavior: When booting, grub displays a three second countdown and if no key is pressed, the grub menu is shown, after the countdown finishes.

The problem lies in the 00_header.in script [1], specifically:
if sleep$verbose --interruptible ${1} ; then
set timeout=${2}
fi

This just always sets the countdown to GRUB_TIMEOUT, even if the sleep is not interrupted. I think it should be something like:

if sleep$verbose --interruptible ${1} ; then
set timeout=0
else
set timeout=${2}
fi

I created a patch to fix this (see attachment). Please include the patch.

Best regards,
Andreas

1: http://git.savannah.gnu.org/cgit/grub.git/tree/util/grub.d/00_header.in

util/grub.d/00_header.in +2 -0
diff -rup grub2-2.00.orig/util/grub.d/00_header.in grub2-2.00/util/grub.d/00_header.in
@@ -315,6 +315,8 @@ EOF
 	fi
 	cat << EOF
 if sleep$verbose --interruptible ${1} ; then
+  set timeout=0
+else
   set timeout=${2}
 fi
 EOF
#1 lore raw
Quoted 11 lines · Andreas Cadhalpun

Hi,

I'm using Debian with grub version 2.00-20.
My /etc/default/grub configuration contains the following lines:
GRUB_TIMEOUT=-1
GRUB_HIDDEN_TIMEOUT=3

Expected behavior: When booting, grub should display a three second countdown and if no key is pressed, boot the default grub entry, after the countdown finishes.

Quoted 9 lines

Current behavior: When booting, grub displays a three second countdown and if no key is pressed, the grub menu is shown, after the countdown finishes.

The problem lies in the 00_header.in script [1], specifically:
if sleep$verbose --interruptible ${1} ; then
set timeout=${2}
fi

AFAIR this behaviour is documented and reason for it are platforms without keystatus. Just set GRUB_TIMEOUT to 0 to have behaviour that you want.

Quoted 23 lines

This just always sets the countdown to GRUB_TIMEOUT, even if the sleep is not interrupted. I think it should be something like:

if sleep$verbose --interruptible ${1} ; then
set timeout=0
else
set timeout=${2}
fi

I created a patch to fix this (see attachment). Please include the patch.

Best regards,
Andreas

1: http://git.savannah.gnu.org/cgit/grub.git/tree/util/grub.d/00_header.in

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel