Bug#782552: recordfail false positive causes headless servers to hang on boot

Robie Basak robie.basak at ubuntu.com
Tue Apr 14 02:32:17 UTC 2015


Package: grub-common
Version: 2.02~beta2-22
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu vivid ubuntu-patch

Downstream report: https://launchpad.net/bugs/1443735

A headless system will hang indefinitely waiting on user interaction
after a well timed double power failure. This patch changes the default
GRUB_RECORDFAIL_TIMEOUT to 30, so interactive users still get the
opporunity to intervene after a real boot failure, but headless users
will not end up stuck after boot failures that were really power
failures.

diff -Nru grub2-2.02~beta2/debian/patches/quick_boot.patch grub2-2.02~beta2/debian/patches/quick_boot.patch
--- grub2-2.02~beta2/debian/patches/quick_boot.patch	2015-02-11 19:53:36.000000000 +0000
+++ grub2-2.02~beta2/debian/patches/quick_boot.patch	2015-04-14 02:00:20.000000000 +0100
@@ -18,7 +18,7 @@
 
 Author: Richard Laager <rlaager at wiktel.com>
 Forwarded: no
-Last-Update: 2014-01-17
+Last-Update: 2015-04-14
 
 Patch-Name: quick_boot.patch
 ---
@@ -31,10 +31,10 @@
  util/grub.d/30_os-prober.in | 21 ++++++++++++++++
  7 files changed, 117 insertions(+), 13 deletions(-)
 
-diff --git a/configure.ac b/configure.ac
-index 7c8d0af..2a7e410 100644
---- a/configure.ac
-+++ b/configure.ac
+Index: grub2-2.02~beta2/configure.ac
+===================================================================
+--- grub2-2.02~beta2.orig/configure.ac
++++ grub2-2.02~beta2/configure.ac
 @@ -1594,6 +1594,17 @@ else
  fi
  AC_SUBST([QUIET_BOOT])
@@ -53,18 +53,23 @@
  LIBS=""
  
  AC_SUBST([FONT_SOURCE])
-diff --git a/docs/grub.texi b/docs/grub.texi
-index 46b9e7f..28743d5 100644
---- a/docs/grub.texi
-+++ b/docs/grub.texi
-@@ -1490,6 +1490,15 @@ This option may be set to a list of GRUB module names separated by spaces.
+Index: grub2-2.02~beta2/docs/grub.texi
+===================================================================
+--- grub2-2.02~beta2.orig/docs/grub.texi
++++ grub2-2.02~beta2/docs/grub.texi
+@@ -1490,6 +1490,20 @@ This option may be set to a list of GRUB
  Each module will be loaded as early as possible, at the start of
  @file{grub.cfg}.
  
 + at item GRUB_RECORDFAIL_TIMEOUT
-+If this option is set, it overrides the default recordfail setting. The
-+default setting is -1, which causes GRUB to wait for user input. This option
-+should be set on headless and appliance systems where access to a console is
++If this option is set, it overrides the default recordfail setting. A setting
++of -1 causes GRUB to wait for user input indefinitely. However, a false
++positive in the recordfail mechanism may occur if power is lost during boot
++before boot success is recorded in userspace. The default setting is 30, which
++causes GRUB to wait for user input for thirty seconds before continuing. This
++default allows interactive users the opportunity to switch to a different,
++working kernel, while avoiding a false positive causing the boot to block
++indefinitely on headless and appliance systems where access to a console is
 +restricted or limited.
 +
 +This option is only effective when GRUB was configured with the
@@ -73,11 +78,11 @@
  @end table
  
  The following options are still accepted for compatibility with existing
-diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
-index 7b55c27..a968e0f 100644
---- a/grub-core/normal/menu.c
-+++ b/grub-core/normal/menu.c
-@@ -604,6 +604,30 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
+Index: grub2-2.02~beta2/grub-core/normal/menu.c
+===================================================================
+--- grub2-2.02~beta2.orig/grub-core/normal/menu.c
++++ grub2-2.02~beta2/grub-core/normal/menu.c
+@@ -604,6 +604,30 @@ run_menu (grub_menu_t menu, int nested,
        static struct grub_term_coordinate *pos;
        int entry = -1;
  
@@ -108,10 +113,10 @@
        if (timeout_style == TIMEOUT_STYLE_COUNTDOWN && timeout)
  	{
  	  pos = grub_term_save_pos ();
-diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
-index 62780bf..17350d4 100644
---- a/util/grub-mkconfig.in
-+++ b/util/grub-mkconfig.in
+Index: grub2-2.02~beta2/util/grub-mkconfig.in
+===================================================================
+--- grub2-2.02~beta2.orig/util/grub-mkconfig.in
++++ grub2-2.02~beta2/util/grub-mkconfig.in
 @@ -236,7 +236,8 @@ export GRUB_DEFAULT \
    GRUB_ENABLE_CRYPTODISK \
    GRUB_BADRAM \
@@ -122,10 +127,10 @@
  
  if test "x${grub_cfg}" != "x"; then
    rm -f "${grub_cfg}.new"
-diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
-index 0c82f23..8dc5592 100644
---- a/util/grub.d/00_header.in
-+++ b/util/grub.d/00_header.in
+Index: grub2-2.02~beta2/util/grub.d/00_header.in
+===================================================================
+--- grub2-2.02~beta2.orig/util/grub.d/00_header.in
++++ grub2-2.02~beta2/util/grub.d/00_header.in
 @@ -21,6 +21,8 @@ prefix="@prefix@"
  exec_prefix="@exec_prefix@"
  datarootdir="@datarootdir@"
@@ -135,7 +140,7 @@
  
  export TEXTDOMAIN=@PACKAGE@
  export TEXTDOMAINDIR="@localedir@"
-@@ -44,6 +46,7 @@ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ; then GRUB_TIMEOUT_BUTTON="$GRUB_TIMEOUT
+@@ -44,6 +46,7 @@ if [ "x${GRUB_TIMEOUT_BUTTON}" = "x" ] ;
  
  cat << EOF
  if [ -s \$prefix/grubenv ]; then
@@ -148,7 +153,7 @@
    fi
  }
 +EOF
- 
++
 +if [ "$quick_boot" = 1 ]; then
 +    cat <<EOF
 +function recordfail {
@@ -170,7 +175,7 @@
 +}
 +EOF
 +fi
-+
+ 
 +cat <<EOF
  function load_video {
  EOF
@@ -181,7 +186,7 @@
  {
 +    cat << EOF
 +if [ "\${recordfail}" = 1 ] ; then
-+  set timeout=${GRUB_RECORDFAIL_TIMEOUT:--1}
++  set timeout=${GRUB_RECORDFAIL_TIMEOUT:-30}
 +else
 +EOF
      if [ "x${3}" != "x" ] ; then
@@ -232,10 +237,10 @@
  fi
  EOF
  }
-diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
-index 0616c6d..aa2c369 100644
---- a/util/grub.d/10_linux.in
-+++ b/util/grub.d/10_linux.in
+Index: grub2-2.02~beta2/util/grub.d/10_linux.in
+===================================================================
+--- grub2-2.02~beta2.orig/util/grub.d/10_linux.in
++++ grub2-2.02~beta2/util/grub.d/10_linux.in
 @@ -22,6 +22,7 @@ exec_prefix="@exec_prefix@"
  datarootdir="@datarootdir@"
  ubuntu_recovery="@UBUNTU_RECOVERY@"
@@ -254,10 +259,10 @@
    if [ x$type != xrecovery ] ; then
        save_default_entry | grub_add_tab
    fi
-diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
-index 1c44cf2..1106ad1 100644
---- a/util/grub.d/30_os-prober.in
-+++ b/util/grub.d/30_os-prober.in
+Index: grub2-2.02~beta2/util/grub.d/30_os-prober.in
+===================================================================
+--- grub2-2.02~beta2.orig/util/grub.d/30_os-prober.in
++++ grub2-2.02~beta2/util/grub.d/30_os-prober.in
 @@ -20,12 +20,26 @@ set -e
  prefix="@prefix@"
  exec_prefix="@exec_prefix@"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20150414/151279a8/attachment.sig>


More information about the Pkg-grub-devel mailing list