Skip to contentSkip to conversation

at boot-time echoed kernel is older that started kernel

DISCUSSION poma 3 participants 3 messages Feb 19, 2013 – Feb 21, 2013 5 messages not in the archive Kbuild

lore
Share & tools
lore

poma

author
#5 lore raw
In reply to a message not in the archive

On 02/18/13 21:39, Reindl Harald wrote:
[…]

Quoted 3 lines

i would be thankful if even "grub2-mkconfig" would not create this "advanced" submenu at all

Actually there is a patch proposal at 'grub-devel' by Prarit Bhargava, for such a case - disable submenu[1][2].
From this I made ​​two for testing directly without compiling the entire grub's trunk repository[3][4].
Those who would do such test should make a backup of the corresponding files:

patch --backup /usr/sbin/grub2-mkconfig < grub2-mkconfig-disable-submenu.patch
patch --backup /etc/grub.d/10_linux < 10_linux-disable-submenu.patch chmod -x /etc/grub.d/10_linux.orig

/etc/default/grub:

# submenu disabled
GRUB_DISABLE_SUBMENU=true
# submenu enabled
#GRUB_DISABLE_SUBMENU=false
--

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig /usr/sbin/grub2-mkconfig --output=/boot/grub2/grub.cfg

Cheers,
poma

[1] http://lists.gnu.org/archive/html/grub-devel/2013-01/msg00126.html
[2] grub2-disable-submenu.patch
[3] 10_linux-disable-submenu.patch
[4] grub2-mkconfig-disable-submenu.patch

usr/sbin/grub2-mkconfig renamed from usr/sbin/grub2-mkconfig.bkp +2 -1
@@ -216,7 +216,8 @@
   GRUB_INIT_TUNE \
   GRUB_SAVEDEFAULT \
   GRUB_ENABLE_CRYPTODISK \
-  GRUB_BADRAM
+  GRUB_BADRAM \
+  GRUB_DISABLE_SUBMENU
 
 if test "x${grub_cfg}" != "x"; then
   rm -f "${grub_cfg}.new"

=== modified file 'util/grub-mkconfig.in'

grub-mkconfig.in +2 -1
@@ -215,7 +215,8 @@
   GRUB_INIT_TUNE \
   GRUB_SAVEDEFAULT \
   GRUB_ENABLE_CRYPTODISK \
-  GRUB_BADRAM
+  GRUB_BADRAM \
+  GRUB_DISABLE_SUBMENU
 
 if test "x${grub_cfg}" != "x"; then
   rm -f "${grub_cfg}.new"

=== modified file 'util/grub.d/10_hurd.in'

grub.d/10_hurd.in +7 -4
@@ -156,14 +156,15 @@
 for kernel in ${kernels}
 do
 
-  if [ "x$is_first_entry" = xtrue ]; then
+  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+    if [ "x$is_first_entry" = xtrue ]; then
       hurd_entry "$kernel" simple
       submenu_indentation="$grub_tab"
     
       # TRANSLATORS: %s is replaced with an OS name
       echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnuhurd-advanced-$(grub_get_device_id "${GRUB_DEVICE_BOOT}")' {"
+    fi
   fi
-
   hurd_entry "$kernel" advanced
   hurd_entry "$kernel" recovery
   is_first_entry=false
@@ -171,8 +172,10 @@
 
 # If at least one kernel was found, then we need to
 # add a closing '}' for the submenu command.
-if [ x"$is_first_entry" != xtrue ]; then
-  echo '}'
+if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+  if [ x"$is_first_entry" != xtrue ]; then
+    echo '}'
+  fi
 fi
 
 echo "$title_correction_code"

=== modified file 'util/grub.d/10_kfreebsd.in'

grub.d/10_kfreebsd.in +14 -10
@@ -211,15 +211,17 @@
     module_dir_rel=$(make_system_path_relative_to_its_root $module_dir)
   fi
 
-  if [ "x$is_first_entry" = xtrue ]; then
-      kfreebsd_entry "${OS}" "${version}" simple
-      submenu_indentation="$grub_tab"
-    
-      if [ -z "$boot_device_id" ]; then
+  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+    if [ "x$is_first_entry" = xtrue ]; then
+        kfreebsd_entry "${OS}" "${version}" simple
+        submenu_indentation="$grub_tab"
+
+        if [ -z "$boot_device_id" ]; then
 	  boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
-      fi
-      # TRANSLATORS: %s is replaced with an OS name
-      echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'kfreebsd-advanced-$boot_device_id' {"
+        fi
+        # TRANSLATORS: %s is replaced with an OS name
+        echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'kfreebsd-advanced-$boot_device_id' {"
+    fi
   fi
 
   kfreebsd_entry "${OS}" "${version}" advanced
@@ -233,8 +235,10 @@
 
 # If at least one kernel was found, then we need to
 # add a closing '}' for the submenu command.
-if [ x"$is_first_entry" != xtrue ]; then
-  echo '}'
+if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+  if [ x"$is_first_entry" != xtrue ]; then
+    echo '}'
+  fi
 fi
 
 echo "$title_correction_code"

=== modified file 'util/grub.d/10_linux.in'

grub.d/10_linux.in +15 -12
@@ -226,18 +226,20 @@
     linux_root_device_thisversion=${GRUB_DEVICE}
   fi
 
-  if [ "x$is_first_entry" = xtrue ]; then
-    linux_entry "${OS}" "${version}" simple \
-    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+    if [ "x$is_first_entry" = xtrue ]; then
+      linux_entry "${OS}" "${version}" simple \
+      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
 
-    submenu_indentation="$grub_tab"
+      submenu_indentation="$grub_tab"
     
-    if [ -z "$boot_device_id" ]; then
-	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+      if [ -z "$boot_device_id" ]; then
+	  boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+      fi
+      # TRANSLATORS: %s is replaced with an OS name
+      echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
     fi
-    # TRANSLATORS: %s is replaced with an OS name
-    echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
-  fi
+fi
 
   linux_entry "${OS}" "${version}" advanced \
               "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
@@ -252,8 +254,9 @@
 
 # If at least one kernel was found, then we need to
 # add a closing '}' for the submenu command.
-if [ x"$is_first_entry" != xtrue ]; then
-  echo '}'
+if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+  if [ x"$is_first_entry" != xtrue ]; then
+    echo '}'
+  fi
 fi
-
 echo "$title_correction_code"

=== modified file 'util/grub.d/10_netbsd.in'

grub.d/10_netbsd.in +13 -9
@@ -157,15 +157,17 @@
 
   gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2
 
-  if [ "x$is_first_entry" = xtrue ]; then
-      netbsd_entry "knetbsd"   "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
-    submenu_indentation="$grub_tab"
+  if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+    if [ "x$is_first_entry" = xtrue ]; then
+        netbsd_entry "knetbsd"   "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
+      submenu_indentation="$grub_tab"
     
-    if [ -z "$boot_device_id" ]; then
-	boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+      if [ -z "$boot_device_id" ]; then
+	  boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
+      fi
+      # TRANSLATORS: %s is replaced with an OS name
+      echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'netbsd-advanced-$boot_device_id' {"
     fi
-    # TRANSLATORS: %s is replaced with an OS name
-    echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'netbsd-advanced-$boot_device_id' {"
   fi
 
   netbsd_entry "knetbsd"   "$k" advanced "${GRUB_CMDLINE_NETBSD_DEFAULT}"
@@ -179,8 +181,10 @@
 
 # If at least one kernel was found, then we need to
 # add a closing '}' for the submenu command.
-if [ x"$is_first_entry" != xtrue ]; then
-  echo '}'
+if [ "x${GRUB_DISABLE_SUBMENU}" = x ]; then 
+  if [ x"$is_first_entry" != xtrue ]; then
+    echo '}'
+  fi
 fi
 
 echo "$title_correction_code"
etc/grub.d/10_linux renamed from etc/grub.d/10_linux.bkp +9 -6
@@ -240,9 +240,10 @@
     linux_root_device_thisversion=${GRUB_DEVICE}
   fi
 
-  if [ "x$is_first_entry" = xtrue ]; then
-    linux_entry "${OS}" "${version}" simple \
-    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+  if [ "x${GRUB_DISABLE_SUBMENU}" = xfalse ]; then 
+    if [ "x$is_first_entry" = xtrue ]; then
+      linux_entry "${OS}" "${version}" simple \
+      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
 
     submenu_indentation="\t"
     
@@ -251,6 +252,7 @@
     fi
     # TRANSLATORS: %s is replaced with an OS name
     echo "submenu '$(gettext_printf "Advanced options for %s" "${OS}" | grub_quote)' \$menuentry_id_option 'gnulinux-advanced-$boot_device_id' {"
+    fi
   fi
 
   linux_entry "${OS}" "${version}" advanced \
@@ -266,8 +268,9 @@
 
 # If at least one kernel was found, then we need to
 # add a closing '}' for the submenu command.
-if [ x"$is_first_entry" != xtrue ]; then
-  echo '}'
+if [ "x${GRUB_DISABLE_SUBMENU}" = xfalse ]; then 
+  if [ x"$is_first_entry" != xtrue ]; then
+    echo '}'
+  fi
 fi
-
 echo "$title_correction_code"
#6 lore raw

Am 19.02.2013 21:31, schrieb poma:

Quoted 19 lines · Reindl Harald

[…]

Quoted 3 lines

i would be thankful if even "grub2-mkconfig" would not create this "advanced" submenu at all

Actually there is a patch proposal at 'grub-devel' by Prarit Bhargava, for such a case - disable submenu[1][2].
From this I made ​​two for testing directly without compiling the entire grub's trunk repository[3][4].
Those who would do such test should make a backup of the corresponding files:

patch --backup /usr/sbin/grub2-mkconfig < grub2-mkconfig-disable-submenu.patch
patch --backup /etc/grub.d/10_linux < 10_linux-disable-submenu.patch chmod -x /etc/grub.d/10_linux.orig

/etc/default/grub:

Quoted 8 lines
# submenu disabled
GRUB_DISABLE_SUBMENU=true
# submenu enabled
#GRUB_DISABLE_SUBMENU=false
--

cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.orig /usr/sbin/grub2-mkconfig --output=/boot/grub2/grub.cfg

sounds like GRUB2 becomes useable somewhere in the future

hopefully we see https://bugzilla.redhat.com/show_bug.cgi?id=840204
fixed too upstrem which is a major break and edit distribution files is no sane opton since GRUB2 started to call a turing-complete scripting language somehow "configuration"

#7 lore raw
In reply to poma
Quoted 10 lines · poma

On 02/18/13 21:39, Reindl Harald wrote:
[…]

Quoted 3 lines

i would be thankful if even "grub2-mkconfig" would not create this "advanced" submenu at all

Actually there is a patch proposal at 'grub-devel' by Prarit Bhargava, for such a case - disable submenu[1][2].

Reindl and poma,

FYI the latest fedora (it might be in rawhide by now) built grub2 has GRUB_DISABLE_SUBMENU functionality. It would be good to get testing on this...

http://koji.fedoraproject.org/koji/buildinfo?buildID=386531

* Thu Feb 14 2013 Peter Jones <[email protected]> - 2.00-16
- Allow the user to disable submenu generation

You can simply add 'GRUB_DISABLE_SUBMENU="true"' to /etc/default/grub and it magically works :)

P.