Thursday, September 3, 2015

GRUB2 boot loader

GRUB2 Configuration Basics

 

                      GRUB2 doesn’t use a menu.lst file. Instead, its main configuration file is the /boot/grub2/grub.cfg file. However, you shouldn’t edit this file by hand!

                    It’s automatically created by running the update-grub command as root — in other words, by running sudo update-grub on Ubuntu.

GRUB settings are stored in the /etc/default/grub file.
Scripts are stored in the /etc/grub.d/ directory

For example, on Ubuntu, there are scripts here that configure the default theme. There’s also an os-prober script that checks the system’s internal hard drives for other installed operating systems.

After editing the both files you need to run the below command to update.

[root@andromeda fabien]# grub2-mkconfig -o /boot/grub2/grub.cfg 


 When you run the command, GRUB automatically combines the settings from the /etc/default/grub file, the scripts from the /etc/grub.d/ directory, and everything else, creating a /boot/grub/grub.cfg file that’s read at boot.
 
 Changing GRUB2 settings


GRUB_DEFAULT

By default, GRUB_DEFAULT=0 uses the first entry as the default — change the number to 1 to use the second entry, 2 to use the third entry, or so on. 
You could also use GRUB_DEFAULT=saved and GRUB would automatically boot the last operating system you chose each time you boot. 

GRUB_TIMEOUT

GRUB will automatically bot the default operating system after a period of time, usually ten seconds. 
edit the GRUB_TIMEOUT=10 line and enter any number of seconds you like.

GRUB_HIDDEN_TIMEOUT

With only one operating system installed, Ubuntu defaults GRUB to automatically boot to the default OS with the GRUB_HIDDEN_TIMEOUT=0 option.  

Make Your Changes Take Effect

Ubuntu : sudo update-grub
Centos grub2-mkconfig -o /boot/grub2/grub.cfg

 
 


 

No comments:

Post a Comment