升级至grub2

3081阅读 0评论2009-10-08 blue_stone
分类:LINUX

Debian sid默认的引导程序已经从grub 升级到grub2. 目前grub2的版本号为1.97~beta4-1.

我之前曾经测试过grub2, 当时遇到了一个问题, grub2每次引导Windows后, 总是无法引导Linux, 需要使用引导光盘引导系统并重新安装grub2才能解决. 十一长假期间, 我再次测试了grub2, 发现配置起来相当简单, 使用

wajig update grub
wajig install os-prober

升级grub, 并安装os-prober后. 运行update-grub, 所有的内核都会被添加到启动菜单中, 连Windows也增加到了启动菜单中,省去了手工配置windows的麻烦. 并且还带来了图形化的grub界面. 

自动生成的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 ###
set default=0                     
insmod lvm                        
insmod ext2                       
set root=(vg00-root)              
search --no-floppy --fs-uuid --set d48e2c91-e7b8-40fe-b79f-bc3fb82edf20
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                                                                      
set timeout=5                                                           
### END /etc/grub.d/00_header ###                                       

### BEGIN /etc/grub.d/05_debian_theme ###
insmod ext2                             
set root=(hd0,2)                        
search --no-floppy --fs-uuid --set 8b725ae3-b750-4dfa-a4b5-c06efff0b1ff
insmod png                                                            
if background_image /grub/moreblue-orbit-grub.png ; then              
  set color_normal=black/black                                        
  set color_highlight=magenta/black                                   
else                                                                  
  set menu_color_normal=cyan/blue                                     
  set menu_color_highlight=white/blue                                 
fi                                                                    
### END /etc/grub.d/05_debian_theme ###                               

### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, Linux 2.6.31-trunk-amd64" {
        insmod ext2                                    
        set root=(hd0,2)                               
        search --no-floppy --fs-uuid --set 8b725ae3-b750-4dfa-a4b5-c06efff0b1ff
        linux   /vmlinuz-2.6.31-trunk-amd64 root=/dev/mapper/vg00-root ro  quiet
        initrd  /initrd.img-2.6.31-trunk-amd64                                 
}                                                                              
menuentry "Debian GNU/Linux, Linux 2.6.31-trunk-amd64 (recovery mode)" {       
        insmod ext2                                                            
        set root=(hd0,2)                                                       
        search --no-floppy --fs-uuid --set 8b725ae3-b750-4dfa-a4b5-c06efff0b1ff
        linux   /vmlinuz-2.6.31-trunk-amd64 root=/dev/mapper/vg00-root ro single
        initrd  /initrd.img-2.6.31-trunk-amd64
}
menuentry "Debian GNU/Linux, Linux 2.6.30-2-amd64" {
        insmod ext2
        set root=(hd0,2)
        search --no-floppy --fs-uuid --set 8b725ae3-b750-4dfa-a4b5-c06efff0b1ff
        linux   /vmlinuz-2.6.30-2-amd64 root=/dev/mapper/vg00-root ro  quiet
        initrd  /initrd.img-2.6.30-2-amd64
}
menuentry "Debian GNU/Linux, Linux 2.6.30-2-amd64 (recovery mode)" {
        insmod ext2
        set root=(hd0,2)
        search --no-floppy --fs-uuid --set 8b725ae3-b750-4dfa-a4b5-c06efff0b1ff
        linux   /vmlinuz-2.6.30-2-amd64 root=/dev/mapper/vg00-root ro single
        initrd  /initrd.img-2.6.30-2-amd64
}
menuentry "Debian GNU/Linux, Linux 2.6.30-1-amd64" {
        insmod ext2
        set root=(hd0,2)
        search --no-floppy --fs-uuid --set 8b725ae3-b750-4dfa-a4b5-c06efff0b1ff
        linux   /vmlinuz-2.6.30-1-amd64 root=/dev/mapper/vg00-root ro  quiet
        initrd  /initrd.img-2.6.30-1-amd64
}
menuentry "Debian GNU/Linux, Linux 2.6.30-1-amd64 (recovery mode)" {
        insmod ext2
        set root=(hd0,2)
        search --no-floppy --fs-uuid --set 8b725ae3-b750-4dfa-a4b5-c06efff0b1ff
        linux   /vmlinuz-2.6.30-1-amd64 root=/dev/mapper/vg00-root ro single
        initrd  /initrd.img-2.6.30-1-amd64
}
### 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 8ca8b599a8b5826e
        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 ###

上一篇:Debian下root分区的迁移
下一篇:nohup: 让程序连续运行