The notes are messy. Take a note by yourself. (LinuxIDC) after upgrading to Ubuntu9.10, you have to contact grub2, which is a lot different from the previous version. Here is a basic tutorial. 1. grub2's startup configuration file grub. Worker grub2's startup configuration file grub. cfg is/boot/grub. cfg, not the previous memu. lst. If you have multiple systems, such as ubuntu and windows, use the following command:
The notes are messy. Take a note by yourself. (LinuxIDC)
After upgrading to Ubuntu 9.10, you have to contact grub2, which is a lot different from previous versions. Here is a basic tutorial.
1. grub2 STARTUP configuration file grub. cfg
Grub. cfg is the/boot/grub. cfg STARTUP configuration file of grub2, instead of the previous memu. lst.
If you have multiple systems, such as ubuntu and windows, run the following command to enable grub2.
Sudo update-grub
Actually, let the system generate the appropriate grub. cfg file.
The grub. cfg file is read-only. so if you want to modify it, you need the permission.
Sudo chmod + w/boot/grub. cfg
Then you can edit grub. cfg.
Sudo gedit/boot/grub. cfg
Ii. Default System and wait time
1. set default = 0
This is to start from the first item. Every start item starts with menuentry. "xxx" after menuentry is the name of the Start item, and {xxx} is the start code.
### BEGIN/etc/grub. d/10_linux ### menuentry "Ubuntu, Linux 2.6.31-14-generic" {recordfail = 1if [-n $ {have_grubenv}]; then save_env recordfail; fiset quiet = 1 insmod ext2set root = (hd0, 6) search-no-floppy-fs-uuid-set kernel/boot/vmlinuz-2.6.31-14-generic root = UUID = 040508ff-fec7-4c66-ba64-a09f8abe8059 ro quiet splashinitrd/boot/initrd. img-2.6.31-14-generic} menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {recordfail = 1if [-n $ {have_grubenv}]; then save_env recordfail; fiinsmod ext2set root = (hd0, 6) search-no-floppy-fs-uuid-set kernel/boot/vmlinuz-2.6.31-14-generic root = UUID = ro singleinitrd/boot/initrd. img-2.6.31-14-generic ### END/etc/grub. d/10_linux ###### BEGIN/etc/grub. d/20_memtest86 + ### menuentry "Memory test (memtest86 +)" {linux16/boot/memtest86 +. bin} menuentry "Memory test (memtest86 +, serial console 115200)" {linux16/boot/memtest86 +. bin console = ttyS0, 115200n8 }## END/etc/grub. d/20_memtest86 + ##### BEGIN/etc/grub. d/30_os-prober ### menuentry "Microsoft Windows XP Home Edition (on/dev/sda1)" {insmod ntfsset root = (hd0, 1) search-no-floppy-fs-uuid-set 5c1_a1c1089fd70drivemap-s (hd0) $ {root} chainloader + 1} if keystatus; thenif keystatus-shift; thenset timeout =-1 elseset timeout = 10 fielseif sleep $ verbose-interruptible 3; thenset timeout = 10 fifi ### END/etc/grub. d/30_os-prober ###### BEGIN/etc/grub. d/10_linux ###
Menuentry "Ubuntu, Linux 2.6.31-14-generic "{
Recordfail = 1
If [-n $ {have_grubenv}]; then save_env recordfail; fi
Set quiet = 1
Insmod ext2
Set root = (hd0, 6)
Search-no-floppy-fs-uuid-set 040508ff-fec7-4c66-ba64-a09f8abe8059
Linux/boot/vmlinuz-2.6.31-14-generic root = UUID = 040508ff-fec7-4c66-ba64-a09f8abe8059 ro quiet splash
Initrd/boot/initrd. img-2.6.31-14-generic
}
Menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode )"{
Recordfail = 1
If [-n $ {have_grubenv}]; then save_env recordfail; fi
Insmod ext2
Set root = (hd0, 6)
Search-no-floppy-fs-uuid-set 040508ff-fec7-4c66-ba64-a09f8abe8059
Linux/boot/vmlinuz-2.6.31-14-generic root = UUID = 040508ff-fec7-4c66-ba64-a09f8abe8059 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 + )"{
Linux16/boot/memtest86 +. bin
}
Menuentry "Memory test (memtest86 +, serial console 115200 )"{
Linux16/boot/memtest86 +. bin console = ttyS0, 115200n8
}
### END/etc/grub. d/20_memtest86 + ###
### BEGIN/etc/grub. d/30_os-prober ###
Menuentry "Microsoft Windows XP Home Edition (on/dev/sda1 )"{
Insmod ntfs
Set root = (hd0, 1)
Search-no-floppy-fs-uuid-set 5c1_a1c1089fd70
Drivemap-s (hd0) $ {root}
Chainloader + 1
}
If keystatus; then
If keystatus-shift; then
Set timeout =-1
Else
Set timeout = 10
Fi
Else
If sleep $ verbose-interruptible 3; then
Set timeout = 10
Fi
Fi
### END/etc/grub. d/30_os-prober ###
My fifth boot item is menuentry "Microsoft Windows XP Home Edition (on/dev/sda1)". I want it to start with xp by default, so change it to set default = "4 ″. (Hd0, 1) indicates the first partition of the first hard disk. My Linux is in (hd0, 6 ).
Of course, you can also put the system you need to start by default at the very beginning, then set default = 0
2. set timeout = 10
If [$ {recordfail} = 1]; then
Set timeout =-1
Else
Set timeout = 10
Fi
Here, the time on the grub selection system interface is 10 seconds, that is, set timeout = 10.
Sometimes I don't want to wait so long. I start xp directly. I need to press the Shift key to enter the grub selection system interface when ubuntu is required. You can add the following code:
If keystatus; then
If keystatus-shift; then
Set timeout =-1
Else
Set timeout = 10
Fi
Else
If sleep $ verbose-interruptible 3; then
Set timeout = 10
Fi
Fi