How Do I Change GRUB Boot Options?

GRand Unified Bootloader, or GRUB, is the default bootloader for various Linux distributions, including Ubuntu, Fedora, Debian, and more, and its primary reason is to load and run the operating system. When a user starts up the system, the first thing after the manufacturer’s logo comes up is the GRUB menu using which the OS to boot is selected using the “up & down” keys. Changing the GRUB boot options can help troubleshoot boot-related issues and, of course, customization. But how can it be done?

The GRUB boot options are discussed in today’s writing, and the audience will learn the following.

Why is it Required to Change the GRUB Boot Options?

The following are reasons why the GRUB boot options need to be modified.

  • To change the default boot entry. It is beneficial when multiple operating systems are installed, and there’s a need to set a preferred one to the top.
  • Set the GRUB timeout before the designated option is selected.
  • Add an image in the background.

How to Modify the GRUB Boot Options?

The path “/etc/default/grub” has the GRUB boot configuration file with all the settings that can be modified per the user’s requirements. Any text editor can open it, but before doing that, let’s create a backup using this command below.

$ sudo cp /etc/default/grub /etc/default/grub.bak

Once the command to backup the GRUB configuration file is executed, confirm the changes using this command.

$ nano /etc/default/grub.bak

The above image separates the fields and values by “=.” The fields are set on the left side, while the values are placed on the right, which is explained as follows.

  • GRUB_DEFAULT=0” means that the first entity of the GRUB menu is selected by default. The index starts at zero, so it can be set to other digits like 1,2,3,4,5, etc.
  • GRUB_TIMEOUT_STYLE=hidden” is the style of the timeout. It is currently set to “hidden, “meaning the timeout will not be displayed. If set to “countdown,” the countdown will be displayed.
  • GRUB_TIMEOUT=0” is the timeout before the default entry is automatically selected. It is currently set to “0,” meaning the menu will not be displayed, and the default entry will be selected immediately. Change the value to the menu’s suitable time (in seconds) if the option is chosen immediately after turning the system on.
  • GRUB_DISTRIBUTOR=lsb_release -i -s 2> /dev/null || echo Debian`” is the name of the Linux distribution displayed in the GRUB menu.
  • GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash” is the default kernel option that is passed to the kernel at boot time. The “quiet” option prompts the kernel not to display messages during the boot process, while the “splash” option tells the kernel to display a splash screen during the boot process.
  • GRUB_CMDLINE_LINUX=”find_preseed=/preseed.cfg auto noprompt priority=critical l” are the additional kernel options that are passed to the kernel at boot time.
  • The “find_preseed” option instructs the kernel to search for a preseed file at a specific location.
  • The “auto” option automatically prompts the kernel to detect and configure hardware changes during the boot process.
  • The “noprompt” option makes the kernel not display any prompt during the boot process.
  • The “priority=critical” option prompts the kernel to prioritize critical processes.

Note: After changing each of the above values, the GRUB boot settings must be updated for the changes to take effect. The use of this command can do it.

$ sudo update-grub

The above command, when executed, will show all the settings currently being used in the GRUB menu.

Some users may want to use the GUI method (using software named GRUB Customizer), whose tutorial/details are found in this guide. Make sure to try it because sometimes, the GUI produces better results.

Conclusion

The GRUB menu’s primary use is when multiple operating systems are installed. It allows the users to modify their system’s boot settings, like prioritizing which OS to set as default. It is worth noting that before making changes to it, make sure to know about what you’re doing because if there isn’t, it’ll all be a mess. The errors like “Update-grub: command not found” may pop up, which can be fixed following this guide.