Stoppt die Vorratsdatenspeicherung! Jetzt klicken & handeln!Willst du auch bei der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:

six demon bag

Wind, fire, all that kind of thing!

2017-04-28

Useful settings for grub on Debian

Boot a kernel just once

If you want to test a new kernel without having access to the console you need to make sure that the system comes back up with the old kernel if the new one panics. Add a setting panic=2 to the kernel commandline in /etc/default/grub to have the system automatically reboot in case of a kernel panic, and tell grub to boot a saved kernel by default:

GRUB_DEFAULT="saved"
GRUB_CMDLINE_LINUX="panic=2"


Then tell grub which kernel to boot by default, and which kernel to boot on the next startup:

update-grub
grub-set-default 1    # boot 2nd menu entry by default
grub-reboot 0         # boot 1st menu entry on next boot

The commands just change the boot configuration, they don't actually reboot the system.

To be able to view the kernel list without having to reboot and dig through submenus you may want to add the following setting to /etc/default/grub and run update-grub:

GRUB_DISABLE_SUBMENU="y"

Note: The value must be "y". GRUB_DISABLE_SUBMENU="true" does not work.

Now you can list the boot menu entries with something like

grep -oP "^menuentry '\K[^']*" /boot/grub/grub.cfg

or

awk -F"'" '/^menuentry/ {print $2}' /boot/grub/grub.cfg

The first listed entry has index 0, the second has index 1, and so on.

If you don't want the automatically generated recovery boot options you can suppress them by adding GRUB_DISABLE_RECOVERY="true".

Console resolution

The console resolution can be changed with the following settings in /etc/default/grub

GRUB_GFXMODE=1024x768x24
GRUB_GFXPAYLOAD_LINUX=keep

A list of available resolutions can be obtained by running vbeinfo (or videoinfo on EFI systems) from the grub console (press C at the boot menu/prompt). An alternative that can be run from a terminal without a reboot is

hwinfo --framebuffer

If the kernel doesn't preserve the resolution you may need to transfer control from the kernel back to the XServer by adding the option nomodeset to the kernel commandline:

GRUB_CMDLINE_LINUX="nomodeset panic=2"

Posted 03:10 [permalink]