There are two main statements about how to modify grub to change the Linux default boot system online:/boot/grub. conf or/boot/grub/menu. the lst also says it is the corresponding file under the/etc directory. Here is my attempt.
Under the Ubuntu-9.10, the specific file is like this:
/Boot/grub. cfg
As for the changed set default = "x", let's take my machine as an example:
- [eg].> ls -l grub.cfg-r--r--r-- grub.cfg
- > sudo chmod 244 grub.cfg> ls -l grub.cfg--w-r--r-- grub.cfg
- > sudo vim grub.cfg
After modification, do not forget:> sudo chmod 444 grub. cfg // you must remember to change it back.
I'm dizzy. After a while, there are so many things, so I will highlight the key with color. Skip other content automatically. As shown in the blue section, grub has three parts. As shown in the red section, menuentry items are arranged from 0 in sequence, change x in set default = "x" to the entry number. For example, if my computer wants to use windows by default, although this is useless), the other x is 8. the default time mark is displayed on the windows portal when the system is started.
For windows systems, not only should they be set as the default boot system for Linux, but they should be placed at the top of all system entries. Just guess from this file: is it okay to cut the windows menuentry of this file to the beginning? So that the entry number is 0... this speculation is not clear yet.
- ------------------------------------ Grub. cfg, start ---------------------------------#
- # DO NOT EDIT THIS FILE
- #
- # It is automatically generated by/usr/sbin/grub-mkconfig using templates
- # From/etc/grub. d and settings from/etc/default/grub
- #
- ### BEGIN/etc/grub. d/00_header ###
- If [-s/boot/grub/grubenv]; then
- Have_grubenv=True
- Load_env
- Fi
- SetDefault="0"
- If [$ {prev_saved_entry}]; then
- Saved_entry=$ {Prev_saved_entry}
- Save_env saved_entry
- Prev_saved_entry=
- Save_envPrev_saved_entry
- Fi
- Insmod ext2
- SetRoot= (Hd0, 8)
- Search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912
- If loadfont/usr/share/grub/unicode. pf2; then
- SetGfxmode=640x480
- Insmod gfxterm
- Insmod vbe if terminal_output gfxterm; then true; else # For backward compatibility with versions of terminal. mod that don't # understand terminal_output terminal gfxterm policiif [$ {recordfail} = 1]; then setTimeout=-1 else setTimeout=10fi### END/etc/grub. d/00_header ###
- ### BEGIN/etc/grub. d/05_debian_theme ### setMenu_color_normal=White/BlacksetMenu_color_highlight=Black/White ### END/etc/grub. d/05_debian_theme ###
- ### BEGIN/etc/grub. d/10_linux ### menuentry "Ubuntu, Linux 2.6.31-18-generic" {// 0Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi setQuiet=1Insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-18-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro quiet splash initrd/boot/initrd. img-2.6.31-18-generic} menuentry "Ubuntu, Linux 2.6.31-18-generic (recovery mode)" {// 1Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-18-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro single initrd/boot/initrd. img-2.6.31-18-generic} menuentry "Ubuntu, Linux 2.6.31-17-generic" {// 2Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi setQuiet=1Insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-17-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro quiet splash initrd/boot/initrd. img-2.6.31-17-generic} menuentry "Ubuntu, Linux 2.6.31-17-generic (recovery mode)" {// 3Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-17-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro single initrd/boot/initrd. img-2.6.31-17-generic} menuentry "Ubuntu, Linux 2.6.31-14-generic" {// 4Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi setQuiet=1Insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-14-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro quiet splash initrd/boot/initrd. img-2.6.31-14-generic} menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {/5Recordfail=1If [-n $ {have_grubenv}]; then save_env recordfail; fi insmod ext2 setRoot= (Hd0, 8) search -- no-floppy -- fs-uuid -- set ab1eac76-a5d7-4656-8918-ffb406010912 linux/boot/vmlinuz-2.6.31-14-genericRoot=UUID= Ab1eac76-a5d7-4656-8918-ffb406010912 ro single initrd/boot/initrd. img-2.6.31-14-generic} ### END/etc/grub. d/10_linux ###
- ### BEGIN/etc/grub. d/20_memtest86 + ### menuentry "Memory test (memtest86 +)" {// 6 linux16/boot/memtest86 +. bin} menuentry "Memory test (memtest86 +, serial console 115200)" {// 7 linux16/boot/memtest86 +. binConsole=TtyS0, 115200n8 }### END/etc/grub. d/20_memtest86 + ##### BEGIN/etc/grub. d/30_os-prober ### menuentry "Microsoft Windows XP Professional (on/dev/sda1)" {// 8 insmod ntfs setRoot= (Hd0, 1) search -- no-floppy -- fs-uuid -- set 6044685444682f4a 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 the # 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 ###
- ------------------------------- Grub. cfg, end ---------------------------------------------
The above is an attempt to use grub to modify the default Linux Startup system.
- Parsing Linux Process status T, Z, and X
- Analysis of Linux Process status: R, S, and D
- Brief Introduction to Linux Process Operation commands
- In-depth discussion on Linux partition Solutions
- Six advantages of Linux