Setting Default Entry in Grub2 and Grub
Linux booting is usually controlled by Grub or the new Grub2. Setting the default booting entry is a frequent operations. Here, we introduce how to set the default entry in Grub2 and Grub.
Setting the default booting entry in grub2
Fist, list all the entries in the grub.cfg by:
# grep menuentry /boot/grub2/grub.cfg | cut -d "'" -f2
Second the default entry by the entry’s name.
For example, the command to set the default entry to be ‘Fedora, with Xen hypervisor’ is as follows.
# grub2-set-default 'Fedora, with Xen hypervisor'
Last, verify the default entry what we just set.
# grub2-editenv list
This should print out what we set.
Bonus: we may also want to change the boot option which is stored in ‘/etc/sysconfig/grub’. After editing the file, we can generate the new configuration file for grub2 as follows.
# grub2-mkconfig -o /boot/grub2/grub.cfg
Setting the default booting entry in grub
In grub (before version 2, actually it is usually version 0.99), the default entry is stored in /boot/grub/grub.conf. The default entry to boot is specified by the ‘default’ variable such as
The ’2′ here is to set the default entry to be the 2nd (start from 0) one.