Modifying the Linux multi-system boot sequence

Source: Internet
Author: User
Tags rewind

Ubuntu and XP dual system grub2 default boot entry set to XP

Installed dual system, when the boot will always want a system to start the default when the general installation of Ubuntu and XP dual system, the default is to start the Ubuntu system, but when you want to let XP as a silent
What happens when you start a system?
In the early Ubuntu system, the boot manager is grub, to modify the boot default boot system, just modify the/boot/grub/under the Menu.lst on the line, but in the later
The Ubuntu system uses GRUB2, and GRUB2 has no menu.lst files. Www.2cto.com

GRUB2 is made up of three parts:/etc/default/grub file,/etc/grub.d folder, and/boot/grub/grub.cfg file, the Start menu interface of the computer boot is
Grub.cfg file. How do you understand the relationship between the three parts? I think it is possible to think that, after we execute the update-grub (Update boot menu) command, the system will be based on
The contents of the/etc/default/grub file and the/ETC/GRUB.D folder are generated in the/boot/grub/directory under the Grub.cfg file, so when the/etc/default/grub file and the/ETC/GRUB.D text
After the wallet is modified, the Update-grub is executed and the Grub.cfg file contents are changed or updated.


/etc/default/grub file-----the contents of the default startup item, rewind time
/ETC/GRUB.D folder-There are various startup items, as follows

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

Among them, 30-os-prober is the startup item of Windows system, of course 10_linux is the startup item of Linux system, notice that each file has a number in front of it, in executing update-grub
After the resulting grub.cfg file, the smaller the number will be in the front, that is, in the boot menu will be queued up. Like the above, in the boot menu, the Linux system will be ranked in the top
Surface.
Here are three ways to modify it.

First, directly modify the Grub.cfg file

[root~]# sudo gedit/boot/grub/grub.cfg

Inside
# # # begin/etc/grub.d/*** # #
Menuentry "..." {
......
}
# # # end/etc/grub.d/*** # #
Each represents each startup item, and the higher the position, the more it will be in the boot menu.

The set default= "0" on line 12th represents the default selection, which is the selection of the cursor's initial selection at power-on, and note that the subscript of the item starts at 0, for example, in Grub.cfg, where the XP system is located
is the fifth startup item (the simple way to see it is to see a few menuentry "..."), then change set default= "0" to set default= "4"

The 54th line (possibly different) of Set timeout=5 represents the countdown time, and 5 represents 5 seconds.

After the modification, save, you can see the effect after the Update-grub, the disadvantage is that the system will be restored when the update is installed, and the Update-grub command is often executed, so this modified party
method is not recommended.
Www.2cto.com
Ii. Modification of/ETC/DEFAULT/GRUB.D

[root~]# sudo cd/etc/grub.d
[root~]# ls

Then we can see
00_header 10_linux 30-os-prober README
05_debian_theme 20_memtest86+ 40_custom
(This is in my system, you may not be the same)

[root~]# MV 30_os-prober 06_os-prober (30_os-prober renamed to 06_os-prober)
[root~]# Update-grub

Then open grub.cfg will see XP system is already in the front, this method is simple, and no matter how many times UPDATE-GRUB,XP system items will always be ranked first, recommended to use.

Third, modify the/etc/default/grub

[root~]# sudo gedit/etc/default/grub

Modify Grub_default=0 (select the position where the cursor is by default, like this is the first bit, if the XP system is in the 5th bit of the menu item, it is modified to grub_default=4)
Grub_timeout=5 (Time to rewind)

After the modification, save, re-update-grub, this method because it is directly modify the initial position of the selection cursor, and when the XP item in front if a few more items (like after updating the kernel), it will not. This
method is not recommended.

How to change the wait time for a default item

[root~]# sudo gedit/boot/grub/grub.cfg

Set the timeout =? To the value you want to change.

Modifying the Linux multi-system boot sequence

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.