Ubuntu 11.10 + win7 dual-system startup Item Management and configuration method

Source: Internet
Author: User

Ubuntu 10.10 has been installed recently. Because Windows 7 and other systems have been installed before, the Startup menu is displayed after Ubuntu is installed. By default, Ubuntu is started. I have found many ways to modify the startup options on the Internet, and there are different opinions. The summary is as follows:
 
1. the best method to access the Internet: Install startupmanager-graph startup Item Manager
 
Open the terminal and enter sudo apt-get install startupmanager.
 
Install the startup Manager
 
System-system management-start manager, select the default boot operating system.
 
Ii. Most convenient method: Adjust the default startup sequence of Windows (grub. cfg does not need to be modified)
 
The file names of script files in the/etc/grub. d directory start with numbers, which determines the order in which each file content is executed when update-grub is executed.
 
1. Run the sudo nautilus command to open the file browser with the root permission. Find the file 30_os-prober and change the number 30 of the file name 30_os-prober to a number ranging from 05 to 10 (not many options are 06, 07, 08, AND 09). For example, change it to 08_os-prober, the created grub. the menu items in cfg are automatically sorted before ubuntu;
 
2. Run the sudo update-grub command. As you can see, Windows 7 has ranked first.
 
Iii. Methods most described on the Internet (modify grub. cfg)
 
Run the sudo gedit/boot/grub. cfg command to open the grub. cfg file,
 
One way is to change the value 0 in the set default = "0" file to the sequence number of the operating system to be started by default (starting from 0 ). Save the settings;
 
Another method is to cut the start instruction section corresponding to Windows to the beginning of the Start instruction section;
 
Windows can be started by default in both methods, but grub can be modified. note: When you use the update-grub command or system upgrade or grub upgrade, grub. the cfg file will be restored. You need to modify it again.
 
If you are lazy to modify the grub. cfg file after each update-grub operation, you can perform the following operations:
 
Use sudo gedit/etc/grub. b/00_header command to open the file 00_header and find the ser default = "$ {GRUB_DEFAULT}" line, replace $ {GRUB_DEFAULT} with the serial number of the operating system to be started by default (starting from 0), save the settings, and then update-grub. In this way, the grub. cfg generated after each update-grub is automatically changed to what we want.
 
4. If you have installed different systems on the hard disk at the same time, or multiple startup items are generated due to Ubuntu update/installation software, in order to avoid the trouble of selecting each boot, you can comment out some of the earlier versions or unnecessary startup items so that the startup looks less messy.
 
Practice: sudo gedit/boot/grub. cfg
 
Find menuentry... and check the system startup item to be removed. Add "#" to the word menuentry and save it. Note: You must keep at least one option. We recommend that you keep the two options for ubuntu with two different types in the highest version. Then, check whether the two types are the same: one is normal ("recovery mode" or "recovery" is not specified), and the other is recovery mode ("recovery mode" or "recovery "). In addition, you cannot add "#" to comments for items that contain windows. Otherwise, you will not be able to find the relevant system entry. There is also a Memory test (menuentry "Memory test ..... ") if you want to use this function to leave one item, I personally think that the entry with more options represents more functions, but the memory testing speed will take a longer time.
 
The following is the configuration of my machine startup Item. windows is the last item and XP is installed.
 
Bytes ---------------------------------------------------------------------------------------
 
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# From/etc/grub. d and settings from/etc/default/grub
#
 
### BEGIN/etc/grub. d/00_header ###
If [-s $ prefix/grubenv]; then
Set have_grubenv = true
Load_env
Fi
Set default = "2"
If ["$ {prev_saved_entry}"]; then
Set saved_entry = "$ {prev_saved_entry }"
Save_env saved_entry
Set prev_saved_entry =
Save_env prev_saved_entry
Set boot_once = true
Fi
 
Function savedefault {
If [-z "$ {boot_once}"]; then
Saved_entry = "$ {chosen }"
Save_env saved_entry
Fi
}
 
Function recordfail {
Set recordfail = 1
If [-n "$ {have_grubenv}"]; then if [-z "$ {boot_once}"]; then save_env recordfail; fi
}
 
Function load_video {
Insmod vbe
Insmod vga
}
 
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
If loadfont/usr/share/grub/unicode. pf2; then
Set gfxmode = 1280x1024
Load_video
Insmod gfxterm
Fi
Terminal_output gfxterm
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Set locale_dir = ($ root)/boot/grub/locale
Set lang = zh
Insmod gettext
If ["$ {recordfail}" = 1]; then
Set timeout =-1
Else
Set timeout = 3
Fi
### END/etc/grub. d/00_header ###
 
### BEGIN/etc/grub. d/05_debian_theme ###
Set menu_color_normal = white/black
Set menu_color_highlight = black/light-gray
### END/etc/grub. d/05_debian_theme ###
 
### BEGIN/etc/grub. d/10_linux ###
# Menuentry 'ubuntu, with Linux 2.6.35-22-generic '-- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Linux/boot/vmlinuz-2.6.35-22-generic root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro vga = 775 quiet splash
Initrd/boot/initrd. img-2.6.35-22-generic
}
# Menuentry 'ubuntu, with Linux 2.6.35-22-generic (recovery mode) '-- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Echo 'loading Linux 2.6.35-22-generic ...'
Linux/boot/vmlinuz-2.6.35-22-generic root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro single vga = 775
Echo 'loading initial ramdisk ...'
Initrd/boot/initrd. img-2.6.35-22-generic
}
Menuentry 'ubuntu, with Linux 2.6.32-25-Server' -- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Linux/boot/vmlinuz-2.6.32-25-server root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro vga = 775 quiet splash
Initrd/boot/initrd. img-2.6.32-25-server
}
Menuentry 'ubuntu, with Linux 2.6.32-25-server (recovery mode) '-- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Echo 'loading Linux 2.6.32-25-server ...'
Linux/boot/vmlinuz-2.6.32-25-server root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro single vga = 775
Echo 'loading initial ramdisk ...'
Initrd/boot/initrd. img-2.6.32-25-server
}
# Menuentry 'ubuntu, with Linux 2.6.32-25-generic '-- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Linux/boot/vmlinuz-2.6.32-25-generic root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro vga = 775 quiet splash
Initrd/boot/initrd. img-2.6.32-25-generic
}
# Menuentry 'ubuntu, with Linux 2.6.32-25-generic (recovery mode) '-- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Echo 'loading Linux 2.6.32-25-generic ...'
Linux/boot/vmlinuz-2.6.32-25-generic root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro single vga = 775
Echo 'loading initial ramdisk ...'
Initrd/boot/initrd. img-2.6.32-25-generic
}
# Menuentry 'ubuntu, with Linux 2.6.32-25-preempt' -- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Linux/boot/vmlinuz-2.6.32-25-preempt root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro vga = 775 quiet splash
Initrd/boot/initrd. img-2.6.32-25-preempt
}
# Menuentry 'ubuntu, with Linux 2.6.32-25-preempt (recovery mode) '-- class Ubuntu -- class gnu-linux -- class gnu -- class OS {
Recordfail
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Echo 'loading Linux 2.6.32-25-preempt ...'
Linux/boot/vmlinuz-2.6.32-25-preempt root = UUID = c825786c-e42c-4fed-8cc2-fd2a610a183b ro single vga = 775
Echo 'loading initial ramdisk ...'
Initrd/boot/initrd. img-2.6.32-25-preempt
}
### END/etc/grub. d/10_linux ###
 
### BEGIN/etc/grub. d/20_linux_xen ###
### END/etc/grub. d/20_linux_xen ###
 
### BEGIN/etc/grub. d/20_memtest86 + ###
# Menuentry "Memory test (memtest86 + )"{
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Linux16/boot/memtest86 +. bin
}
Menuentry "Memory test (memtest86 +, serial console 115200 )"{
Insmod part_msdos
Insmod ext2
Set root = '(hd1, msdos8 )'
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Linux16/boot/memtest86 +. bin console = ttyS0, 115200n8
}
### END/etc/grub. d/20_memtest86 + ###
 
### BEGIN/etc/grub. d/30_os-prober ###
Menuentry "Microsoft Windows XP Professional (on/dev/sda1 )"{
Insmod part_msdos
Insmod ntfs
Set root = '(hd1, msdos1 )'
Search -- no-floppy -- fs-uuid -- set 22a89599a8956bd3
Drivemap-s (hd0) $ {root}
Chainloader + 1
}
### END/etc/grub. d/30_os-prober ###
 
### BEGIN/etc/grub. d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type
# Menu entries you want to add after this comment. Be careful not to change
# The 'exec tail' line above.
### END/etc/grub. d/40_custom ###
 
### BEGIN/etc/grub. d/41_custom ###
If [-f $ prefix/custom. cfg]; then
Source $ prefix/custom. cfg;
Fi
### END/etc/grub. d/41_custom ###
 
 
 
------------------------------------------------------------------
 
Brief description of Configuration modification of the above startup items:
 
In front of the red statement, "#" is the startup item that is no longer displayed. If you need to enable it again later, you only need to edit/boot/grub. cfg file, remove the "#" number. A Green Project is a retained startup item, which is displayed when the system is started. If you are difficult to distinguish the red and green colors, You can count them and start the Code with 7 red statements and 3 green statements.
 
 
 
5. Set the default wait time when the system starts:
 
By default, Ubuntu displays the first displayed startup Item after 10 seconds. You can modify the startup wait time in the/boot/grub. cfg file. Find the following code snippet:
 
---------------------------------------------------------------
 
Search -- no-floppy -- fs-uuid -- set c825786c-e42c-4fed-8cc2-fd2a610a183b
Set locale_dir = ($ root)/boot/grub/locale
Set lang = zh
Insmod gettext
If ["$ {recordfail}" = 1]; then
Set timeout =-1
Else
Set timeout = 3
Fi
 
--------------------------------------------------------------
 
Modify the "timeout" value after the else statement. For example, 3 indicates that the system will automatically enter after three seconds. Change to another value, for example, 5, and wait for 5 seconds.
 
If you are not familiar with the meaning of the code or are afraid of correction, we recommend that you install a startup manager for visual settings. This is safer.
 
 
 
6. Delete unnecessary kernels from the boot menu
 
Many users generally choose Windows + Ubuntu dual-system. After a long time, the boot menu will become increasingly bloated as the Ubuntu kernel continues to upgrade. The following describes how to delete unnecessary kernels (earlier versions) from the boot menu and how to adjust the startup sequence of different operating systems.
 
Ubuntu is started with grub boot. After Ubuntu is upgraded to a new version, grub automatically adjusts the boot menu order, puts the new kernel at the start of the boot menu, and does not delete the long kernel version. In this way, the Startup menu will become very bloated when Ubuntu is upgraded more frequently. In addition, earlier versions of the kernel will not be used, so it is better to delete them. The solution is as follows:
 
1. Find the kernel version installed in the system, and enter the following command in the terminal:
 
Dpkg -- get-selections | grep linux-image
 
The installed kernel is displayed, for example:
 
Install linux-image-2.6.35-22-generic
Install linux-image-2.6.38-10-generic
Install linux-image-2.6.38-11-generic
Install linux-image-2.6.38-8-generic
Install linux-image-3.0.0-12-generic
Linux-image-generic install
 
2. Uninstall the old kernel version and enter the following command in the terminal:
 
Sudo apt-get remove linux-image-2.6.35-22-generic linux-image-2.6.38-8-generic linux-image-2.6.38-10-generic linux-image-2.6.38-11-generic
 
The preceding commands and meanings are as follows:
 
Dpkg -- get-selections [<expression>...] prints the list of selected software packages to the standard output;
 
Grep linux-image matching search;
 
Uname-a: view the installed Linux kernel.
 
In this way, the old kernel version is deleted.
 

By Giraffe

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.