feature request + patch: GRUB_CMDLINE_LINUX_RECOVERY
Hi,
I'd like to propose a patch to add a configuration parameter called GRUB_CMDLINE_LINUX_RECOVERY.
All credits for the initial idea and first implementation (as far as I know) go to Kyle Rankin at Purism. I used his improvement without being aware that it is not a standard feature inluded in original grub. His implementation can be found here https://source.puri.sm/pureos/packages/smartcard-key-luks.
There are situations when it would be helpfull to be able to set command line options to use only when generating a recovery entry for grub.cfg, e.g.
- when using systemd starting a debug shell using "systemd.debug-shell"
- when using luks disk encryption as shown in the work of Kyle
The inclusion of GRUB_CMDLINE_LINUX_RECOVERY as in the patch below shouldn't change the behaviour of grub at all if not used in a configuration. Users not setting the variable shouldn't see any difference.
Chris
docs/grub.texi +8 -0
@@ -1411,6 +1411,14 @@ entry for recovery mode. This option lists command-line arguments to add only to the default menu entry, after those listed in @samp{GRUB_CMDLINE_LINUX}. +@item GRUB_CMDLINE_LINUX_RECOVERY +Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu +entries will be generated for each Linux kernel: one default entry and one +entry for recovery mode. +This option lists command-line arguments to add only to the recovery menu +entry, before those listed in @samp{GRUB_CMDLINE_LINUX}. +The default is @samp{single}. + @item GRUB_CMDLINE_NETBSD @itemx GRUB_CMDLINE_NETBSD_DEFAULT As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
util/grub-mkconfig.in +1 -0
@@ -225,6 +225,7 @@ export GRUB_DEFAULT \ GRUB_DISTRIBUTOR \ GRUB_CMDLINE_LINUX \ GRUB_CMDLINE_LINUX_DEFAULT \ + GRUB_CMDLINE_LINUX_RECOVERY \ GRUB_CMDLINE_XEN \ GRUB_CMDLINE_XEN_DEFAULT \ GRUB_CMDLINE_LINUX_XEN_REPLACE \
util/grub.d/10_linux.in +5 -1
@@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in ;; esac +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then + GRUB_CMDLINE_LINUX_RECOVERY='single' +fi + # Default to disabling partition uuid support to maintian compatibility with # older kernels. GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
@@ -287,7 +291,7 @@ while [ "x$list" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" recovery \ - "single ${GRUB_CMDLINE_LINUX}" + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" fi list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
util/grub.d/20_linux_xen.in +5 -1
@@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in ;; esac +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then + GRUB_CMDLINE_LINUX_RECOVERY='single' +fi + # Default to disabling partition uuid support to maintian compatibility with # older kernels. GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
@@ -343,7 +347,7 @@ while [ "x${xen_list}" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" "${xen_version}" recovery \ - "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" fi list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
+1
Quoted 118 lines · Chris Vogel
Hi,
I'd like to propose a patch to add a configuration parameter called
GRUB_CMDLINE_LINUX_RECOVERY.All credits for the initial idea and first implementation (as far as I know) go to Kyle Rankin at Purism. I used his improvement without being aware that it is not a standard feature inluded in original grub. His implementation can be found here
https://source.puri.sm/pureos/packages/smartcard-key-luks.There are situations when it would be helpfull to be able to set command line options to use only when generating a recovery entry for grub.cfg, e.g.
- when using systemd starting a debug shell using "systemd.debug-shell"
- when using luks disk encryption as shown in the work of KyleThe inclusion of
GRUB_CMDLINE_LINUX_RECOVERYas in the patch below shouldn't change the behaviour of grub at all if not used in a configuration. Users not setting the variable shouldn't see any difference.Chris
docs/grub.texi +0
-0@@ -1411,6 +1411,14 @@ entry for recovery mode. This option listscommand-line arguments to add
only to the default menu entry, after those listed in @samp{GRUB_CMDLINE_LINUX}.+@item
GRUB_CMDLINE_LINUX_RECOVERYdocs/grub.texi +2
-0+Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu +entries will be generated for each Linux kernel: one default entry andone
docs/grub.texi +2
-0+entry for recovery mode. +This option lists command-line arguments to add only to the recoverymenu
docs/grub.texi +3
-0+entry, before those listed in @samp{GRUB_CMDLINE_LINUX}. +The default is @samp{single}. + @item GRUB_CMDLINE_NETBSD @itemx GRUB_CMDLINE_NETBSD_DEFAULT As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT},but for
util/grub-mkconfig.in +1
-0@@ -225,6 +225,7 @@ export GRUB_DEFAULT \ GRUB_DISTRIBUTOR \ GRUB_CMDLINE_LINUX \ GRUB_CMDLINE_LINUX_DEFAULT \ + GRUB_CMDLINE_LINUX_RECOVERY \ GRUB_CMDLINE_XEN \ GRUB_CMDLINE_XEN_DEFAULT \ GRUB_CMDLINE_LINUX_XEN_REPLACE \util/grub.d/10_linux.in +4
-0@@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in ;; esac +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then + GRUB_CMDLINE_LINUX_RECOVERY='single' +fi + # Default to disabling partition uuid support to maintiancompatibility with
# older kernels. GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}util/grub.d/10_linux.in +1
-1@@ -287,7 +291,7 @@ while [ "x$list" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" recovery \ - "single ${GRUB_CMDLINE_LINUX}" + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" fi list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`util/grub.d/20_linux_xen.in +4
-0@@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in ;; esac +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then + GRUB_CMDLINE_LINUX_RECOVERY='single' +fi + # Default to disabling partition uuid support to maintiancompatibility with
# older kernels. GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}util/grub.d/20_linux_xen.in +0
-0@@ -343,7 +347,7 @@ while [ "x${xen_list}" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}""${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
util/grub.d/20_linux_xen.in +1
-1if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" "${xen_version}" recovery \ - "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}""${GRUB_CMDLINE_XEN}"
util/grub.d/20_linux_xen.in +0
-0fi list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 6 lines
Philip Rhoades PO Box 896 Cowra NSW 2794 Australia E-mail: [email protected]
Dear Chris,
Am 11.09.21 um 19:23 schrieb Chris Vogel:
Quoted 85 lines
I'd like to propose a patch to add a configuration parameter called
GRUB_CMDLINE_LINUX_RECOVERY.All credits for the initial idea and first implementation (as far as I know) go to Kyle Rankin at Purism. I used his improvement without being aware that it is not a standard feature inluded in original grub. His implementation can be found here https://source.puri.sm/pureos/packages/smartcard-key-luks.
There are situations when it would be helpfull to be able to set command line options to use only when generating a recovery entry for grub.cfg, e.g.
- when using systemd starting a debug shell using "systemd.debug-shell"
- when using luks disk encryption as shown in the work of KyleThe inclusion of
GRUB_CMDLINE_LINUX_RECOVERYas in the patch below shouldn't change the behaviour of grub at all if not used in a configuration. Users not setting the variable shouldn't see any difference.Chris
docs/grub.texi +8
-0@@ -1411,6 +1411,14 @@ entry for recovery mode. This option lists command-line arguments to add only to the default menu entry, after those listed in @samp{GRUB_CMDLINE_LINUX}. +@item GRUB_CMDLINE_LINUX_RECOVERY +Unless @samp{GRUB_DISABLE_RECOVERY} is set to @samp{true}, two menu +entries will be generated for each Linux kernel: one default entry and one +entry for recovery mode. +This option lists command-line arguments to add only to the recovery menu +entry, before those listed in @samp{GRUB_CMDLINE_LINUX}. +The default is @samp{single}. + @item GRUB_CMDLINE_NETBSD @itemx GRUB_CMDLINE_NETBSD_DEFAULT As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but forutil/grub-mkconfig.in +1
-0@@ -225,6 +225,7 @@ export GRUB_DEFAULT \ GRUB_DISTRIBUTOR \ GRUB_CMDLINE_LINUX \ GRUB_CMDLINE_LINUX_DEFAULT \ + GRUB_CMDLINE_LINUX_RECOVERY \ GRUB_CMDLINE_XEN \ GRUB_CMDLINE_XEN_DEFAULT \ GRUB_CMDLINE_LINUX_XEN_REPLACE \util/grub.d/10_linux.in +5
-1@@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in ;; esac +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then + GRUB_CMDLINE_LINUX_RECOVERY='single' +fi + # Default to disabling partition uuid support to maintian compatibility with # older kernels. GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}@@ -287,7 +291,7 @@ while [ "x$list" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" recovery \ - "single ${GRUB_CMDLINE_LINUX}" + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" fi list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`util/grub.d/20_linux_xen.in +4
-0@@ -43,6 +43,10 @@ case ${GRUB_DEVICE} in ;; esac +if [ "x${GRUB_CMDLINE_LINUX_RECOVERY}" = "x" ] ; then + GRUB_CMDLINE_LINUX_RECOVERY='single' +fi + # Default to disabling partition uuid support to maintian compatibility with # older kernels. GRUB_DISABLE_LINUX_PARTUUID=${GRUB_DISABLE_LINUX_PARTUUID-true}
util/grub.d/20_linux_xen.in while [ "x${xen_list}" != "x" ] ; do · line 353
Quoted 8 lines
util/grub.d/20_linux_xen.in +1
-1@@ -343,7 +347,7 @@ while [ "x${xen_list}" != "x" ] ; do "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}" if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then linux_entry "${OS}" "${version}" "${xen_version}" recovery \ - "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" + "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}" fi list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
Thank you for upstreaming downstream feature. Please send it as git formatted patch (and maybe git send-email) with a commit message [1] and Signed-off-by lines to the list with the maintainers in Cc.
Kind regards,
Paul