Grub boot order 바꾸기

Grub boot order 바꾸기

You can also change the grub default boot entry from the command line without having to install any additional tool. This won’t change the order in the list but it will allow a different OS to boot by default, which sounds like what you may want anyway.

First, make a backup copy of  /etc/default/grub. In case something goes wrong, you can easily revert to the known-good copy.

[/crayon]

Then edit the file using  vim or the text editor of your choice.

[/crayon]

Find the line that contains  GRUB_DEFAULT=0 and set it to  GRUB_DEFAULT=x where  x is the index of grub menu item to which you would like to boot to by default. Note that the menu items are zero-indexed. That means that the first item in the list is   and that the sixth item is actually  5. So to boot to the sixth item in the list, the line would read  GRUB_DEFAULT=5.

Additionally, if you want to use a kernel in the “Previous Linux Versions” menu, you’ll want to change GRUB_DEFAULT=0 to GRUB_DEFAULT=”2>x” (make sure to include the quotations), where x is the placement of the old kernel on the sub-list (assuming the “Previous Linux Versions” is third on the main list). Remember that the list always begins counting at 0.

Then build the updated grub menu.

[/crayon]
 

Using an index can be pretty messy – the list of OSes can change after an update. But you can have a look into /boot/grub/grub.cfg and search for the name of desired default OS. Then use the quoted name instead of an index. Example:  GRUB_DEFAULT="Microsoft Windows XP Professional (on /dev/sda1)" instead of  GRUB_DEFAULT=7

Reference

Leave a Reply