Bug#922425: grub-common: Export and use GRUB_CMDLINE_LINUX_RECOVERY

Kyle Rankin kyle.rankin at puri.sm
Fri Feb 15 18:14:21 GMT 2019


Package: grub-common
Version: 2.02+dfsg1-10
Severity: wishlist

Currently grub does not allow you to set Linux boot arguments that apply
*only* to the "recovery" mode set in /etc/grub.d/10_linux. Instead,
options that you set in GRUB_CMDLINE_LINUX in /etc/default/grub get 
applied both to recovery modes and prepended to GRUB_CMDLINE_LINUX_DEFAULT
for the default boot option. In the process of working on a method to
boot from an OpenPGP smartcard (recent support added to
cryptsetup-initramfs) I ran into this issue as I needed to override the
default /etc/crypttab options with the cryptopts kernel argument in the
case a user loses their OpenPGP smartcard and needs to revert to a LUKS
passphrase in recovery mode.

Implementing the ability to set kernel command line arguments that only
apply during recovery mode would require changes to changes to 3 total
lines, one to export the existing GRUB_CMDLINE_LINUX_RECOVERY variable
so it can be used in /etc/default/grub:

/usr/sbin/grub-mkconfig line 222:

  GRUB_CMDLINE_LINUX_DEFAULT \

becomes

  GRUB_CMDLINE_LINUX_DEFAULT \
  GRUB_CMDLINE_LINUX_RECOVERY \


And two changes that use variable, if set, instead of overwriting it:

/etc/grub.d/10_linux line 91:

  GRUB_CMDLINE_LINUX_RECOVERY=recovery

becomes

  GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY recovery"

/etc/grub.d/10_linux line 93:

  GRUB_CMDLINE_LINUX_RECOVERY=single

becomes

  GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY single"


This change shouldn't have any negative impact on existing users if they
don't set the variable, apart from adding a space to their kernel
command line for the recovery boot options.

--
Kyle Rankin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-grub-devel/attachments/20190215/2b9f7e9e/attachment.sig>


More information about the Pkg-grub-devel mailing list