All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] grub-reboot: Warn when "for the next boot only" promise cannot be kept
@ 2018-08-17 23:33 dann frazier
  2018-09-04 12:23 ` Daniel Kiper
  0 siblings, 1 reply; 2+ messages in thread
From: dann frazier @ 2018-08-17 23:33 UTC (permalink / raw)
  To: grub-devel; +Cc: Jordan Uggla, Colin Watson

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 <dann.frazier@canonical.com>
---
 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 <bug-grub@gnu.org>."; 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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] grub-reboot: Warn when "for the next boot only" promise cannot be kept
  2018-08-17 23:33 [PATCH] grub-reboot: Warn when "for the next boot only" promise cannot be kept dann frazier
@ 2018-09-04 12:23 ` Daniel Kiper
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2018-09-04 12:23 UTC (permalink / raw)
  To: dann frazier; +Cc: grub-devel, Colin Watson, Jordan Uggla

On Fri, Aug 17, 2018 at 05:33:44PM -0600, dann frazier wrote:
> 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 <dann.frazier@canonical.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-04 12:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-17 23:33 [PATCH] grub-reboot: Warn when "for the next boot only" promise cannot be kept dann frazier
2018-09-04 12:23 ` Daniel Kiper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.