3

Is there a possibility to pass a (set of additional) kernel boot parameters to be applied at the next (re)boot, and only at that boot?

  • I know that i could just interrupt grub and manually pass the boot parameters. This is not what i want (think: multiple remote computers that need to be booted with a given kernel option; needing to be physically present during the initial boot phase is a logistical nightmare)

  • I know that i could modify /etc/default/grub and pass the appropriate GRUB_CMDLINE_LINUX_DEFAULT. or just edit /etc/grub/grub.cfg manually). However, i would like to set the parameters only for a single boot and the values in /etc/grub/grub.cfg will be persistent.

  • I also would like to boot the "currently active" kernel, so having a persistent entry in my grub.cfg with the kernel-parameter set, would require to alway be automatically updated when a new kernel is installed.

Background

Actually i'm looking for a simple way to force a filesystem check on (next) reboot. My filesystems are all journalled, so they have a max_mount_count=-1. Since (almost) all of my systems use systemd these days, the good olde tricks like touch /forcefsck won't work, and instead i must pass fsck.mode=force to the kernel options.

I'm aware of Force fsck check after reboot with single command, though this doesn't help much.

The target systems run Debian/jessie with linux-3.16, if that matters (though I would prefer a general solution)

1

I don't think there's a way to do this. The workaround is to make a "permanent" change to the kernel parameters and after the next boot, undo the the change.

0

Several bootloaders implement the so-called boot-once support:

  • For systemd-boot, use systemctl reboot _name_, where _name_ is the name of a boot entry that will be selected at next boot and only the next boot. Caveats: this requires a UEFI system (the selected entry is stored in an EFI variable), and kernel version 4.7 or later compiled with EFI_BOOTLOADER_CONTROL. See efibc: Add EFI Bootloader Control module and systemd-boot. – Johan Myréen Oct 26 '16 at 18:20
  • this allows me to pre-select a boot-entry, which is not necessarily the same as adding a kernel-option. in any case, for this to properly work, i would need a way to have a (persistently numbered) entry of the currently active kernel with the fsck.mode=force. the catch is to make sure, that there is an entry for the current kernel... – umläute Oct 27 '16 at 7:18
  • Syslinux lets you pass a one-time command line, which needn't correspond to any persistent boot entry. Modern Syslinux lets you script bootloader operation in Lua, even. For example, you can scan your boot partition for the latest kernel on the fly, without ever modifying the configuration. Or implement some analogue of /forcefsck. – Ferenc Wágner Oct 27 '16 at 7:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.