我已经在计算机上安装了 Windows 7,然后安装了 Ubuntu 11.10,但重启时没有出现 grub 菜单,而是直接进入 Windows。
然后我删除了 Ubuntu 创建的分区并尝试了 Fedora 16 - 它创建了略有不同的分区 - 成功了(显示了 grub 菜单)。因为不想保留 Fedora,我格式化了它的分区并在其上安装了 Ubuntu。Grub 仍可加载,但仍然带有 Fedora 选项(显然不起作用)。
当我尝试运行启动修复时,它会警告我:
“您的 PC 启动处于 EFI 模式,但未检测到 EFI 分区。您可能需要在创建 EFI 分区(FAT32、>200Mo、磁盘启动、EFI 标志)后重试”
如果我继续,我将无法运行推荐的修复程序,因为它一直要求我添加 grub2 的软件源,即使它们已经存在。
Boot Info Script 0.60-git [2 Jan 2012]
============================= Boot Info Summary: ===============================
=> Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 1 of
the same hard drive for core.img. core.img is at this location and looks
for (,msdos3)/grub2 on this drive.
=> Syslinux MBR (4.04 and higher) is installed in the MBR of /dev/sdb.
sda1: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System:
Boot files: /bootmgr /Boot/BCD
sda2: __________________________________________________________________________
File system: ntfs
Boot sector type: Windows Vista/7: NTFS
Boot sector info: No errors found in the Boot Parameter Block.
Operating System: Windows 7
Boot files: /Windows/System32/winload.exe
sda3: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System:
Boot files: /grub2/grub.cfg /grub2/core.img
sda4: __________________________________________________________________________
File system: Extended Partition
Boot sector type: Unknown
Boot sector info:
sda5: __________________________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 11.10
Boot files: /boot/grub/grub.cfg /etc/fstab
sda6: __________________________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
sdb1: __________________________________________________________________________
File system: vfat
Boot sector type: SYSLINUX 4.05 2011-12-09
Boot sector info: Syslinux looks at sector 2652248 of /dev/sdb1 for its
second stage. SYSLINUX is installed in the directory.
No errors found in the Boot Parameter Block.
Operating System:
Boot files: /boot/grub/grub.cfg /syslinux/syslinux.cfg
/efi/boot/bootx64.efi /ldlinux.sys
============================ Drive/Partition Info: =============================
Drive: sda _____________________________________________________________________
Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders, total 500118192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
Partition Boot Start Sector End Sector # of Sectors Id System
/dev/sda1 * 2,048 206,847 204,800 7 NTFS / exFAT / HPFS
/dev/sda2 206,848 153,602,047 153,395,200 7 NTFS / exFAT / HPFS
/dev/sda3 153,602,048 154,626,047 1,024,000 83 Linux
/dev/sda4 154,628,094 500,117,503 345,489,410 5 Extended
/dev/sda5 154,628,096 492,013,567 337,385,472 83 Linux
/dev/sda6 492,015,616 500,117,503 8,101,888 82 Linux swap / Solaris
我已经尝试了几天,但都没有成功!我想实现 Windows 7 和 Ubuntu 双启动。我不介意重新安装 Ubuntu 或重新创建分区,但我真的陷入困境。
答案1
最终成功了。我确信下面的操作涉及很多不必要的步骤,但它确实有效,也许有人可以指出哪些是不需要的?
sudo mount /dev/sda5 /mnt
sudo mount --bind /dev /mnt/dev
sudo chroot /mnt
sudo grub-install /dev/sda
sudo update-grub
此时,grub 正在加载但显示救援提示(错误:没有这样的分区)
sudo mkdir /media/sda5
sudo mount /dev/sda5 /media/sda5
sudo grub-install --root-directory=/media/sda5 /dev/sda
而且它有效!!
答案2
安装 Windows 后安装 Ubuntu。如果没有显示 grub 菜单,则使用 Ubuntu 可启动 U 盘,从 U 盘启动,然后
grub-install --root-directory=/dev/sda
即使无法启动也不要担心,你还没有丢失任何东西,如果仍然遇到问题,请尝试
grub-install --root-directory=/media/WIN_DIR
WIN_DIR 是安装 Windows 7 的目录。