Grub2 Bootloader

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

GNU GRUB version 2 of the GNU GRand Unified Bootloader. Grub2 is compatible with both MBR and GPT Linux Partition Table types.

GRUB version 1 (also known as "GRUB Legacy") is no longer under development and is being phased out. The GNU GRUB developers have switched their focus to GRUB 2, a complete rewrite with goals including making GNU GRUB cleaner, more robust, more portable and more powerful.

  • /boot/grub/grub.cfg - This is the main configuration file that replaces menu.lst. Unlike menu.lst, this file cannot be edited by hand! I strongly advise against trying to tamper with this file, using chattr command or anything of the sort. Let it be.
  • /etc/grub.d/ - This new directory contains GRUB scripts. These scripts are building blocks from which the grub.cfg file is built. When the relevant GRUB command is executed, the scripts are read in a certain sequence and grub.cfg is created.
  • /etc/default/grub - This file contains the GRUB menu settings that are read by the GRUB scripts and written into grub.cfg. It is the customization part of the GRUB, similar to the old menu.lst, except the actual boot entries.

Ubuntu and its derived distros have a useful script named update-grub and you can use it to update your grub configuration file by running sudo update-grub.

To find out where GRUB 2 is installed, the user can run the following commands:

sudo grub-probe -t device /boot/grub
sudo grub-probe -t fs_uuid /boot/grub

Editing grub.cfg directly is often discouraged. However, developers acknowledge that sometimes the user may wish to simply edit the file manually. Because of the automatic changes induced by update-grub however, manual edits are subject to being overwritten by the system.

After editing /etc/default/grub or the scripts in the /etc/grub.d folder
the user should run sudo update-grub to incorporate the changes into the GRUB 2 menu.

If you have a system where the grub boot menu does not appear on boot, and fast boot is enabled, consider doing the following:

sudo vi /etc/default/grub

Now change the following:

GRUB_TIMEOUT=30

now remove the following:

GRUB_TIMEOUT_STYLE=hidden
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

The reason it is recommended you do this is due to the fact that the SHIFT key trick to give you access to the hidden GRUB boot menu when the system boots does not work most of the time for most systems. Access to the GRUB boot menu can be vital for diagnosis of problems with your system. The Ubuntu/Mint distribution teams are VERY FOOLISH to hide GRUB from users! Very Stupid indeed.

sudo update-grub

and reboot.