将Windows 7添加到启动菜单

Device Boot Start End Blocks Id System /dev/sda1 * 1 13 102400 7 HPFS/NTFS - system restore /dev/sda2 13 4674 37436416 7 HPFS/NTFS - Windows 7 /dev/sda3 4674 58843 435116032 7 HPFS/NTFS - data storage /dev/sda4 58843 60802 15728640 83 Linux - Ubuntu 10.10 

最初我安装了StartUpManager。 这(我认为)在我的启动菜单列表中添加了另外4个Linux + memtest实例。 但是,我没有看到GRUB启动菜单。 几秒钟后计算机启动进入Ubuntu。

我试图添加Windows 7,但我没有成功。

这是我的menu.lst文件的一部分。

 title Ubuntu 10.10, kernel 2.6.35-24-generic uuid 1c9748e2-2f11-4a6c-91c0-7310d48c4a7a kernel /boot/vmlinuz-2.6.35-24-generic root=UUID=1c9748e2-2f11-4a6c-91c0-7310d48c4a7a ro quiet splash initrd /boot/initrd.img-2.6.35-24-generic title Chainload into GRUB 2 root 1c9748e2-2f11-4a6c-91c0-7310d48c4a7a kernel /boot/grub/core.img title Ubuntu 10.10, memtest86+ uuid 1c9748e2-2f11-4a6c-91c0-7310d48c4a7a kernel /boot/memtest86+.bin menuentry “Windows 7″ { set root=(hd0,2) chainloader +1 } 

这是在upgrade-grub

 Searching for GRUB installation directory ... found: /boot/grub Searching for default file ... found: /boot/grub/default Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst Searching for splash image ... none found, skipping ... Found kernel: /boot/vmlinuz-2.6.35-24-generic Found kernel: /boot/vmlinuz-2.6.35-22-generic Found GRUB 2: /boot/grub/core.img Found kernel: /boot/memtest86+.bin Updating /boot/grub/menu.lst ... done 

后来编辑:

我已将以下内容添加到/etc/grub.d/40_custom ,我已从menu.lst中取消注释隐藏的菜单行,但我仍然无法看到任何启动菜单。 我也试过按ESC和SHIFT。

 menuentry "Windows 7 (loader) (on /dev/sda1)" { insmod part_msdos insmod ntfs set root='(hd0,msdos1)' chainloader +1 } menuentry "Windows 7 (loader) (on /dev/sda1)" { insmod part_msdos insmod ntfs set root='(hd0,msdos0)' chainloader +1 } menuentry "Windows 7 (loader) (on /dev/sda1)" { set root= hd(0,0) chainloader +1 } menuentry "!Windows 7 (loader) (on /dev/sda1)" { set root= hd(0,1) chainloader +1 } menuentry "!!Windows 7 (loader) (on /dev/sda1)" { set root= hd(0,2) chainloader +1 } 

这是我的Windows 7加载程序:

 menuentry "Windows 7 (loader) (on /dev/sda1)" { insmod part_msdos insmod ntfs set root='(hd0,msdos1)' chainloader +1 } 

这应该工作如果您复制并粘贴它,但我不认为你应该把它放在menu.lst文件中。 它应该放在/etc/grub.d/40_custom中

哟必须知道你的Windows 7分区。 (对我来说“hd0,msdos2”)..你可以使用;

 menuentry 'Windows 7 (loader) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-9A4600EC4600CB49' { insmod part_msdos insmod ntfs set root='hd0,msdos2' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 9A4600EC4600CB49 else search --no-floppy --fs-uuid --set=root 9A4600EC4600CB49 fi ntldr ($root)/bootmgr # <--- change this } 

或者你可以使用;

 menuentry 'Windows 7 (loader1) (on /dev/sda2)' --class windows --class os $menuentry_id_option 'osprober-chain-9A4600EC4600CB49' { insmod part_msdos insmod ntfs set root='hd0,msdos2' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2 9A4600EC4600CB49 else search --no-floppy --fs-uuid --set=root 9A4600EC4600CB49 fi ntldr /bootmgr # <--- change this } 

或者你必须打开bash ..

 sudo update-grub2 vi grub.cfg 

**在你的grub.cfg中更改我标有**#<---更改此**的行。 然后..

 sudo grub-install /dev/sda 

而已..