红联Linux门户
Linux帮助
当前位置: 红联Linux门户 > Ubuntu

双系统启动问题

发布时间:2010-05-10 08:29:48来源:红联作者:cky000
本人是新手,在原先win的基础上新装了ubuntu9.10,之后直接进linux,启动项没有win选项。网上看了解答后,用sudo update-grub2,启动项出来了,但有重复的内核,以下是小弟的grub.cfg,请高手将不要的内核删掉,并把设置过程写出来。谢谢各位大侠了!!!
#
# 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
set default="0"
if [ ${prev_saved_entry} ]; then
saved_entry=${prev_saved_entry}
save_env saved_entry
prev_saved_entry=
save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,6)
search --no-floppy --fs-uuid --set 457fb1e8-19bc-4129-b73d-56a905ea94f2
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=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
fi
fi
if [ ${recordfail} = 1 ]; then
set timeout=-1
else
set timeout=10
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/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-21-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-21-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
initrd /boot/initrd.img-2.6.31-21-generic
}
menuentry "Ubuntu, Linux 2.6.31-21-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-21-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
initrd /boot/initrd.img-2.6.31-21-generic
}
menuentry "Ubuntu, Linux 2.6.31-20-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-20-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
initrd /boot/initrd.img-2.6.31-20-generic
}
menuentry "Ubuntu, Linux 2.6.31-20-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-20-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
initrd /boot/initrd.img-2.6.31-20-generic
}
menuentry "Ubuntu, Linux 2.6.31-19-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-19-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
initrd /boot/initrd.img-2.6.31-19-generic
}
menuentry "Ubuntu, Linux 2.6.31-19-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-19-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
initrd /boot/initrd.img-2.6.31-19-generic
}
menuentry "Ubuntu, Linux 2.6.31-17-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-17-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
initrd /boot/initrd.img-2.6.31-17-generic
}
menuentry "Ubuntu, Linux 2.6.31-17-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-17-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
initrd /boot/initrd.img-2.6.31-17-generic
}
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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 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 457fb1e8-19bc-4129-b73d-56a905ea94f2
linux /boot/vmlinuz-2.6.31-14-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 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 Professional (on /dev/sda1)" {
insmod ntfs
set root=(hd0,1)
search --no-floppy --fs-uuid --set 762c386d2c382a8f
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 ###
文章评论

共有 16 条评论

  1. 烧焦的土豆 于 2010-05-13 02:52:59发表:

    是中国人就看完...

  2. 滨崎翔舞 于 2010-05-12 22:08:28发表:

    我潜水多年,忍不住注册个账号上来

  3. glxin1982 于 2010-05-11 21:13:31发表:

    :0w5ty(1

  4. 86360767 于 2010-05-11 21:13:20发表:

    观望中???

  5. ylinuxs 于 2010-05-11 21:07:08发表:

    其实如果是装了windows的系统,而没有在引导界面里显示出来,我个人觉得最简单的方法还是,只要在最后面加一句就可以了.
    title windows
    hide (hd0,0)
    rootnoverify(hd0,0) '假设windows安装在第一个硬盘的第一个扇区,其他情况类推
    chainloader +

  6. 王中云 于 2010-05-11 08:33:52发表:

    系统里有[电脑清洁工]可用,注意要保留新核

  7. axbyc123 于 2010-05-10 18:44:08发表:

    直接注释掉不要的。{:3_107:}

  8. d_doo 于 2010-05-10 16:59:21发表:

    LZ客气客气,同样是学linux的,有机会的话一起探讨。{:3_118:}

  9. cky000 于 2010-05-10 16:43:11发表:

    小弟我看过相关启动项的文章,知道可以删除多余的内核,但我是新手,不知道哪些该删哪些不该删,所以不敢贸然下手,还有可以在ubuntu tweak里面删,效果是一样的。非常感谢楼上朋友,从上午到下午都是你在帮忙解答。什么时候你来惠州,请你吃饭。呵呵~~~~

  10. d_doo 于 2010-05-10 15:16:25发表:

    正确方法应该是从grub.cfg文件里删除多余的行
    #
    # 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
    set default="0"
    if [ ${prev_saved_entry} ]; then
    saved_entry=${prev_saved_entry}
    save_env saved_entry
    prev_saved_entry=
    save_env prev_saved_entry
    fi
    insmod ext2
    set root=(hd0,6)
    search --no-floppy --fs-uuid --set 457fb1e8-19bc-4129-b73d-56a905ea94f2
    if loadfont /usr/share/grub/unicode.pf2 ; then
    set gfxmode=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
    fi
    fi
    if [ ${recordfail} = 1 ]; then
    set timeout=-1
    else
    set timeout=10
    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/white
    ### END /etc/grub.d/05_debian_theme ###

    ### BEGIN /etc/grub.d/10_linux ###
    menuentry "Ubuntu, Linux 2.6.31-21-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-21-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
    initrd /boot/initrd.img-2.6.31-21-generic
    }
    menuentry "Ubuntu, Linux 2.6.31-21-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-21-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
    initrd /boot/initrd.img-2.6.31-21-generic
    }
    menuentry "Ubuntu, Linux 2.6.31-20-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-20-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
    initrd /boot/initrd.img-2.6.31-20-generic
    }
    menuentry "Ubuntu, Linux 2.6.31-20-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-20-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
    initrd /boot/initrd.img-2.6.31-20-generic
    }
    menuentry "Ubuntu, Linux 2.6.31-19-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-19-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
    initrd /boot/initrd.img-2.6.31-19-generic
    }
    menuentry "Ubuntu, Linux 2.6.31-19-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-19-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
    initrd /boot/initrd.img-2.6.31-19-generic
    }
    menuentry "Ubuntu, Linux 2.6.31-17-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-17-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
    initrd /boot/initrd.img-2.6.31-17-generic
    }
    menuentry "Ubuntu, Linux 2.6.31-17-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-17-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro single
    initrd /boot/initrd.img-2.6.31-17-generic
    }
    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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-14-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-14-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 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 Professional (on /dev/sda1)" {
    insmod ntfs
    set root=(hd0,1)
    search --no-floppy --fs-uuid --set 762c386d2c382a8f
    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 ###
    删除红色部分内容

  11. d_doo 于 2010-05-10 15:07:46发表:

    杯具。:0lopw(1 贴上来可能格式变了,Sorry。。。
    输入以下命令:
    grub> set root=(hd0,6)
    grub> linux /boot/vmlinuz-2.6.31-21-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
    grub>initrd /boot//boot/initrd.img-2.6.31-21-generic
    (其中内核vmlinuz和initrd.img的版本号可用按Tab键自动查看)
    然后按下Ctrl+X启动。进入系统后终端执行 sudo update-grub 看看grub.cfg内容有没有恢复。
    一般修改后的文件都有备份的,也可以用光盘进入试用模式显示隐藏文件,将备份文件内容再覆盖回来。

  12. cky000 于 2010-05-10 14:05:41发表:

    按照二楼兄弟的方法,将整个内容覆盖到/boot/grub/grub.cfg,然后重启,就出现如下的界面,请楼下兄弟继续解答

  13. cky000 于 2010-05-10 11:40:20发表:

    谢谢楼上的热心解答
    我试试看先

  14. d_doo 于 2010-05-10 11:11:02发表:

    不用的,想进recover mode的话在启动菜单上按e,加个single就可以

  15. cky000 于 2010-05-10 10:56:11发表:

    那个recovery mode是不是要留一个,总共留三个启动项呢???

  16. d_doo 于 2010-05-10 09:39:25发表:

    改了下,就留两个启动项,最新内核和XP

    #
    # 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
    set default="1"
    if [ ${prev_saved_entry} ]; then
    saved_entry=${prev_saved_entry}
    save_env saved_entry
    prev_saved_entry=
    save_env prev_saved_entry
    fi
    insmod ext2
    set root=(hd0,6)
    search --no-floppy --fs-uuid --set 457fb1e8-19bc-4129-b73d-56a905ea94f2
    if loadfont /usr/share/grub/unicode.pf2 ; then
    set gfxmode=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
    fi
    fi
    if [ ${recordfail} = 1 ]; then
    set timeout=-1
    else
    set timeout=10
    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/white
    ### END /etc/grub.d/05_debian_theme ###

    ### BEGIN /etc/grub.d/10_linux ###
    menuentry "Ubuntu, Linux 2.6.31-21-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 457fb1e8-19bc-4129-b73d-56a905ea94f2
    linux /boot/vmlinuz-2.6.31-21-generic root=UUID=457fb1e8-19bc-4129-b73d-56a905ea94f2 ro quiet splash
    initrd /boot/initrd.img-2.6.31-21-generic
    }

    ### END /etc/grub.d/10_linux ###


    ### BEGIN /etc/grub.d/30_os-prober ###
    menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
    insmod ntfs
    set root=(hd0,1)
    search --no-floppy --fs-uuid --set 762c386d2c382a8f
    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 ###