Windows Linux dual system grub2 default startup entry changes __linux

Source: Internet
Author: User
Tags rewind
GRUB2 changes to the default startup item click Open Link


When a dual system is installed, there will always be a time when a system is started by default when it is powered on. After installing the Linux/windows dual system, the default is to start Linux, but what if you want Windows to be the default startup system?
In the early Linux system, the boot Manager is Grub, to modify the boot default boot system, as long as the modification of the/boot/grub/menu.lst on the line, but in the subsequent Linux used in a variety of Grub2, there is no menu.lst files.


GRUB2 is composed of three parts:/etc/default/grub file,/etc/grub.d folder and/boot/grub/grub.cfg file, when the computer boot up the menu interface with the Grub.cfg file. How to understand the relationship between these three parts. I think it's possible to think that after we execute the update-grub (Update boot menu) command, the system generates GRUB.CFG files in the/boot/grub/directory based on the contents of the/etc/default/grub file and/etc/grub.d folder. So when/etc/default/grub files and/ETC/GRUB.D folders are modified, the Update-grub,grub.cfg file content is changed, or it is updated.


/etc/default/grub file ———— The contents of the boot default startup entry and time to rewind
The/ETC/GRUB.D folder —————— contains the various startup items, as follows:
00_header 10_linux 30-os-prober README
05_debian_theme 20_memtest86+ 40_custom


Where 30-os-prober is the startup entry for the Windows system, 10_linux is, of course, the startup entry for the Linux system. Notice that there is a number in front of each file, in the Grub.cfg file generated after the execution of Update-grub, the smaller the number will be in the front, which is the row in the boot menu. Like the content above, the Linux system will be at the top of the boot menu.
—————————————————————


Here are some ways to modify it.



First, directly modify the Grub.cfg file


Sudo-i

Note: Here to enter the password, the password does not show Oh, just enter the
Gedit/boot/grub/grub.cfg




Inside
### begin/etc/grub.d/*** ###


Menuentry "..." {


......


}


### end/etc/grub.d/*** ###


Each startup item is represented, and the more the position, the more it will be on the boot menu.


The set default= "0" on line 12th (which may not be the same) represents the default selection, which is the initial selection of the cursor when the boot is turned on, noting that the subscript for the item starts at 0, for example, in Grub.cfg, Windows The location is the fifth startup item (the simple view is to see a few menuentry "..." in front of it), then change set default= "0" to set default= "4"


The set timeout=5 in line 54th (which may not be the same) represents the countdown time, and 5 represents 5 seconds.


After you modify it, save it, and then you can see the effect again. The disadvantage of this approach is that the update-grub is restored, and the system often executes the Update-grub command when the update is installed, so this modified method is not recommended.




Ii. Modification of/ETC/DEFAULT/GRUB.D






Sudo-i

Note: Here to enter the password, the password does not display Oh, direct input is the CD/ETC/GRUB.D

ls


When we can see the


00_header 10_linux 30-os- Prober README
05_debian_theme 20_memtest86+ 40_custom


(the display of each system above is different, but the following is the same)


MV 30 _os-prober 06_os-prober (30_os-prober renamed to 06_os-prober, preceded by a number smaller than your Linux number)


Update-grub



This When you open grub.cfg you will see that Windows is already in front of you. This method is simple, and it is recommended that no matter how many times update-grub,windows items are always ranked first in the future.




Three, modify/etc/default/grub






sudo-i


Gedit/etc/defau Lt/grub






Modify grub_default=0 (select the location where the cursor defaults, like this is the first place, if Windows is in the 5th bit of the menu item, modify to Grub_default =4)
Grub_timeout=5 (rewind time)


After modification, save, and Update-grub again. This method is not available because it modifies the initial position of the selection cursor directly, and when Windows items are preceded by several more items (like the kernel being updated). Therefore, the method is not recommended.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.