Grub2 Bootloader
GNU GRUB version 2 of the GNU GRand Unified Bootloader
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.