With the advent of UEFI and secure boot, dissecting grub 2 has become more of a risk, rather than a challenge alone. To workaround the new situation, I install a skeletal base system in a dedicated 1 GB partition. I do this by using debootstrap and chroot. However, it can be done using a normal installation CD/DVD with the condition that a GUI is not installed. Such a barebone installation will in the end ask to install GRUB 2 at the end which makes it bootable.
My setup ONLY makes sense in a multiboot system. Currently, I have five working installations on the same machine! So, it makes more sense to issue the update-grub command whenever a new installation is added to the stack. This is done by booting the installation in control of grub2 and by issuing the update-grub command as root. GRUB 2 is NOT installed in all other installations excluding the one in control of the bootloader.
To make all your installations bootable following kernel updates, you will need to edit the grub.cfg file. The linux line should use /vmlinuz and the initrd line, /initrd.img. All the rest of the respective lines is required unless you know what you are doing. You can make a backup of grub.cfg to avoid your edited versions from being overwritten.
Now, if the format of GRUB 2's menu entries doesn't appeal to your likes you can edit the grub.cfg file. However, you have to strickly observe some rules as syntax errors can easily result in an unbootable system. If you have never written programming code in an advanced programming language, I strongly tell you: YOU MUST KNOW WHAT YOU ARE DOING!
Syntax Rules:
- Lines starting with echo can be deleted. Text between the single quotation marks can be edited but don't use multiple lines of text.
- Similarly text enclosed between the single quotation marks in the line starting with menuentry can be edited.
- Lines starting with linux can be edited to use the symlinks in / instead of the precise kernel file name. This also applies to the line starting with initrd.
- The partition UUID and the partition number can be replaced with those of another partition. This is useful to add bootability to another partition without using the update-grub command.
Code: Select all
menuentry '1: Debian 7 on /dev/sda3' --class debian --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod part_gpt
insmod ext2
set root='(hd0,gpt3)'
search --no-floppy --fs-uuid --set=root 12345678-a888-55a0-b8ee-cc9b2187dabc
echo 'Loading Debian 7 from /dev/sda3...'
linux /vmlinuz root=UUID=12345678-a888-55a0-b8ee-cc9b2187dabc ro quiet acpi_backlight=vendor
initrd /initrd.img
}
Also note that edititing the menuentry line helps unclatter your grub menu. You can also include more meaningful menu entry names like:
Code: Select all
1. Squeeze LTS
2. Wheezy
3. Jessie