"GNU GRUB is a Multiboot boot loader. It was derived from GRUB, the GRand Unified Bootloader, which was originally designed and implemented by Erich Stefan Boleyn." - https://www.gnu.org/software/grub/

Examples

Update defaults

The basic workflow for updating grub is to edit /etc/default/grub then run sudo update-grub. The update-grub man page states that "update-grub is a stub for running grub-mkconfig -o /boot/grub/grub.cfg to generate a grub2 config file.", and thus you can run run grub-mkconfig to see what would be created.

Disable onboard frame buffer

I used this configuration to get text mode linux to boot on a Mac Mini with a bad graphics card that would not load a desktop environment. The machine was locking up at boot in OS X. Hardware test would boot with a striped color anomalies, but would never finish. Ubuntu Xenial would not boot correctly even to text mode without these settings.

In /etc/default/grub:

GRUB_CMDLINE_LINUX_DEFAULT="video=vesafb:off nofb vga=normal nomodeset"

Force brightness at boot

On a 15" macbook pro, ubuntu 18.04 was giving me a problem where the LCD was set very dim and the keys to change brightness were not working. I had to configure /etc/default/grub with the following:

GRUB_CMDLINE_LINUX_DEFAULT="acpi_backlight=video"

An alternate was acpi_backlight=vendor, but for me this was still quite dim. You can also alter your screen brightness on the fly by sending a value between 0-100 like this: echo 0 > /sys/class/backlight/acpi_video0/brightness

Notable commands, files and dirs

  • /boot/grub/grub.cfg - The grub config that is actually used at boot
  • /etc/grub.d - A directory with some of the configs that are combined to create /boot/grub/grub.cfg
  • /etc/default/grub - Default grub options
  • update-grub - Used to regenerate /boot/grub/grub.cfg
  • grub-set-default - Used to configure the default menu entry during reboot, only for bare metal machines
  • grub-set-default-legacy-ec2 - Used to configure the default menu entry on ec2 machines