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
}
答案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
答案2
您必须知道您的 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
就是这样..