Grub

Note: this guide is intended for BIOS systems and may not be correct for UEFI ones (but it may be, I didn't check).

Grub (GRand Unified Bootloader) is the de facto boot loader for Linux. It resides on the MBR (Master Boot Record, fancy name for the first sector of a disk) and is in charge of starting the operative system.

The structure of the MBR is the following: 446 bytes for the bootloader + 64 bytes of partition table + 2 bytes of signature = 512 bytes.

Install Grub

GNU Grub Manual

Normally GRUB should be installed by the installation process. If for any reason this didn't happen, or if the installation has become corrupt, you can reinstall it with this method.

Note: I only tested this in a virtual machine.

Customize Grub

Change the timeout

To change the timeout of grub menu, i.e. the time to wait before grub automatically launch the first option of the boot menu, set GRUB_TIMEOUT={seconds}

Add kernel resume option

For hibernation to work correctly, the linux kernel has to know from which partition to resume (the swap partition). Set GRUB_CMDLINE_LINUX="resume={swap partition}"

Disable OS probing

By default when update-grub is run, it searches through all hard drives to find all OSes and add them to the menu. You can disable this (and just have your running OS in Grub menu) by setting GRUB_DISABLE_OS_PROBER=true.

Delete Grub

If you want to remove Grub from an hard drive (installed by mistake, hard drive no longer contains a bootable system, etc) do the following. If you don't have any other hard drive with a bootloader installed, you won't be able to boot into the machine any more.

Note: as always when dealing with operations that write to disk, do a backup before in case anything goes wrong. In this case also backup the partition table (sfdisk --dump {hard drive} > {output file}).