Received: from list by lists.gnu.org with archive (Exim 4.71) id 1fqoP7-0004tC-8T for mharc-grub-devel@gnu.org; Fri, 17 Aug 2018 19:43:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57651) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqoP3-0004rh-5V for grub-devel@gnu.org; Fri, 17 Aug 2018 19:43:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqoFY-0005dZ-J3 for grub-devel@gnu.org; Fri, 17 Aug 2018 19:33:53 -0400 Received: from complete.lackof.org ([198.49.126.79]:41006) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqoFY-0005cx-CF for grub-devel@gnu.org; Fri, 17 Aug 2018 19:33:48 -0400 Received: from localhost (c-107-2-141-103.hsd1.co.comcast.net [107.2.141.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by complete.lackof.org (Postfix) with ESMTPSA id 91E5E33E001E; Fri, 17 Aug 2018 17:33:44 -0600 (MDT) Date: Fri, 17 Aug 2018 17:33:44 -0600 From: dann frazier To: grub-devel@gnu.org Cc: Jordan Uggla , Colin Watson Subject: [PATCH] grub-reboot: Warn when "for the next boot only" promise cannot be kept Message-ID: <20180817233344.GA5021@xps13.dannf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Virus-Scanned: clamav-milter 0.100.0 at complete.lackof.org X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 198.49.126.79 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 23:43:40 -0000 The "for the next boot only" property of grub-reboot is dependent upon GRUB being able to clear the next_entry variable in the environment block. However, GRUB cannot write to devices using the diskfilter and lvm abstractions. Ref: https://lists.gnu.org/archive/html/grub-devel/2009-12/msg00276.html Ref: https://bugs.launchpad.net/bugs/788298 Signed-off-by: dann frazier --- util/grub-reboot.in | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/util/grub-reboot.in b/util/grub-reboot.in index 4d4f75704..ef3b5c049 100644 --- a/util/grub-reboot.in +++ b/util/grub-reboot.in @@ -20,6 +20,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ +sbindir=@sbindir@ sysconfdir="@sysconfdir@" PACKAGE_NAME=@PACKAGE_NAME@ PACKAGE_VERSION=@PACKAGE_VERSION@ @@ -32,6 +33,7 @@ fi self=`basename $0` grub_editenv=${bindir}/@grub_editenv@ +grub_probe=${sbindir}/@grub_probe@ rootdir= bootdir= grubdir=`echo "/@bootdirname@/@grubdirname@" | sed 's,//*,/,g'` @@ -56,6 +58,8 @@ submenus or sub-submenus require specifying the submenu components and then the menu item component. The titles should be separated using the greater-than character (>) with no extra spaces. Depending on your shell some characters including > may need escaping. More information about this is available in the GRUB Manual in the section about the 'default' command. "; echo + echo + gettext "NOTE: In cases where GRUB cannot write to the environment block, such as when it is stored on an MDRAID or LVM device, the chosen boot menu entry will remain the default even after reboot. "; echo echo gettext "Report bugs to ."; echo } @@ -131,6 +135,18 @@ fi grubdir=`echo "${bootdir}/@grubdirname@" | sed 's,//*,/,g'` +abstractions=`$grub_probe --target=abstraction ${grubdir}/grubenv` +for abstraction in $abstractions; do + case "$abstraction" in + diskfilter | lvm) + gettext_printf "\nWARNING: Detected GRUB environment block on $abstraction device\n" + gettext_printf "%s will remain the default boot entry until manually cleared with:\n" "${entry}" + gettext_printf " grub-editenv ${grubdir}/grubenv unset next_entry\n\n" + break + ;; + esac +done + # Restore saved_entry if it was set by previous version prev_saved_entry=`$grub_editenv ${grubdir}/grubenv list | sed -n 's/^prev_saved_entry=//p'` if [ "$prev_saved_entry" ]; then -- 2.18.0