Exploring and Customizing GRUB Menu Entries in Ubuntu
Introduction
GRUB (Grand Unified Bootloader) is a crucial component in the boot process of a Linux system. Understanding and customizing its menu entries can provide users with more control and a personalized boot experience.
What is GRUB?
GRUB is a bootloader that facilitates the loading of the operating system during the boot process. It presents a menu to the user, allowing them to choose which operating system or kernel to boot into.
Basic Structure of GRUB Menu Entries
The GRUB menu entries are defined in the configuration file, and each entry specifies the parameters for booting an operating system or kernel. Let's break down the basic structure using a sample command:
bash
sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}'
- sudo grub-mkconfig: Generates the GRUB configuration file.
- grep -iE "menuentry 'Ubuntu, with Linux": Searches for entries related to Ubuntu with Linux, ignoring case.
- awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}': Prints the index and the first seven fields of the matching entries.
Output
0 : menuentry 'Ubuntu, with Linux 5.4.0-80-generic' --class ubuntu
1 : menuentry 'Ubuntu, with Linux 5.4.0-80-generic (recovery mode)'
2 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic' --class ubuntu
3 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic (recovery mode)'
4 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic' --class ubuntu
5 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic (recovery mode)'
so i want to boot my system with 4.15.0-45-generic which is menu entry 4
modified GRUB_DEFAULT="1>4" value in /etc/default/grub executed below command to regenerate a grub config file with modified GRUB_DEFAULT settings.
sudo update-grub
rebooted the ubuntu system.
sudo systemctl reboot
Conclusion
Understanding and customizing GRUB menu entries in Ubuntu empowers users to personalize their boot experience and troubleshoot issues effectively. Experiment with different options and configurations to optimize your system's performance.
Remember to backup your GRUB configuration before making changes and always be cautious when modifying system files. Happy customizing!