我有一台 PC,在 RAID0 上安装了 2 个硬盘(每个 1Tb)。我使用 Windows 7 64 位系统运行了几个月。
当我安装 Windows 时,我留下了一个 100GB 的空分区,以便将来某一天安装 Ubuntu。
我之前在 Virtualbox 中使用 Linux,但本周我尝试在这个 100GB 分区中安装 Ubuntu 12.04。
我使用了 Ubuntu 备用 CD,因为“普通”CD 给我带来了 RAID0 问题。GRUB 安装总是报告错误。经过大量工作,我发现我需要在分区上安装 grub /dev/mapper/isw_chjbfeec_DougRaid1
(请参阅下面的 Bootinfo)。
Windows 安装创建了一个 100Mb 的启动分区,因此我需要在此分区中安装 grub。
现在我的 Ubuntu 运行 100% 正常。
问题是,Windows 无法启动!grub 菜单上有 Windows 选项,但是当我选择 Windows 选项时,屏幕变黑,之后 grub 菜单又出现了。
启动信息:
Boot Info Script 0.61 [1 April 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
in partition 1 for /boot/grub.
=> Grub2 (v1.99) is installed in the MBR of /dev/mapper/isw_chjbfeec_DougRaid
and looks at sector 1 of the same hard drive for core.img. core.img is at
this location and looks in partition 1 for /boot/grub.
sda1: __________________________________________________________________________
File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed: mount: unknown filesystem type ''
sda2: __________________________________________________________________________
File system:
Boot sector type: Unknown
Boot sector info:
Mounting failed: mount: unknown filesystem type ''
mount: unknown filesystem type ''
sda3: __________________________________________________________________________
File system: Extended Partition
Boot sector type: Unknown
Boot sector info:
isw_chjbfeec_DougRaid1: ________________________________________________________
File system: ntfs
Boot sector type: Grub2 (v1.99)
Boot sector info: Grub2 (v1.99) is installed in the boot sector of
isw_chjbfeec_DougRaid1 and looks at sector 3841862992
of the same hard drive for core.img. core.img is at
this location and looks for (,msdos5)/boot/grub on
this drive. No errors found in the Boot Parameter
Block.
Operating System:
Boot files: /grldr /bootmgr /Boot/BCD /grldr
isw_chjbfeec_DougRaid2: ________________________________________________________
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
isw_chjbfeec_DougRaid3: ________________________________________________________
File system: Extended Partition
Boot sector type: -
Boot sector info:
isw_chjbfeec_DougRaid5: ________________________________________________________
File system: ext4
Boot sector type: -
Boot sector info:
Operating System: Ubuntu 12.04 LTS
Boot files: /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img
isw_chjbfeec_DougRaid6: ________________________________________________________
File system: swap
Boot sector type: -
Boot sector info:
============================ Drive/Partition Info: =============================
Drive: sda _____________________________________________________________________
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 3,686,402,047 3,686,195,200 7 NTFS / exFAT / HPFS
/dev/sda3 3,686,402,558 3,907,039,743 220,637,186 5 Extended
Invalid MBR Signature found.
EBR refers to a location outside the hard drive.
/dev/sda2 ends after the last sector of /dev/sda
/dev/sda3 ends after the last sector of /dev/sda
Drive: isw_chjbfeec_DougRaid _____________________________________________________________________
Disk /dev/mapper/isw_chjbfeec_DougRaid: 2000.4 GB, 2000404348928 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907039744 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/mapper/isw_chjbfeec_DougRaid1 * 2,048 206,847 204,800 7 NTFS / exFAT / HPFS
/dev/mapper/isw_chjbfeec_DougRaid2 206,848 3,686,402,047 3,686,195,200 7 NTFS / exFAT / HPFS
/dev/mapper/isw_chjbfeec_DougRaid3 3,686,402,558 3,907,039,743 220,637,186 5 Extended
/dev/mapper/isw_chjbfeec_DougRaid5 3,686,402,560 3,881,876,479 195,473,920 83 Linux
/dev/mapper/isw_chjbfeec_DougRaid6 3,881,876,992 3,907,039,743 25,162,752 82 Linux swap / Solaris
"blkid" output: ________________________________________________________________
Device UUID TYPE LABEL
/dev/mapper/isw_chjbfeec_DougRaid1 C89C73D19C73B910 ntfs Reservado pelo Sistema
/dev/mapper/isw_chjbfeec_DougRaid2 6830883A3088116C ntfs
/dev/mapper/isw_chjbfeec_DougRaid5 bbab868a-ea53-4be3-ba7d-2737fe6cb24c ext4
/dev/mapper/isw_chjbfeec_DougRaid6 7a830a3c-88fb-4cba-80dc-f32e08abfd5b swap
/dev/sda isw_raid_member
/dev/sdb isw_raid_member
/dev/sr0 iso9660 Windows7x86x64SK
========================= "ls -R /dev/mapper/" output: =========================
/dev/mapper:
control
isw_chjbfeec_DougRaid
isw_chjbfeec_DougRaid1
isw_chjbfeec_DougRaid2
isw_chjbfeec_DougRaid3
isw_chjbfeec_DougRaid5
isw_chjbfeec_DougRaid6
================================ Mount points: =================================
Device Mount_Point Type Options
/dev/mapper/isw_chjbfeec_DougRaid5 / ext4 (rw,errors=remount-ro)
/dev/sr0 /media/Windows7x86x64SK iso9660 (ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks)
================= isw_chjbfeec_DougRaid1/grldr embedded menu: ==================
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
================== isw_chjbfeec_DougRaid5/boot/grub/grub.cfg: ==================
--------------------------------------------------------------------------------
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
set have_grubenv=true
load_env
fi
set default="0"
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function recordfail {
set recordfail=1
if [ -n "${have_grubenv}" ]; then if [ -z "${boot_once}" ]; then save_env recordfail; fi; fi
}
function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
fi
terminal_output gfxterm
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/light-gray
if background_color 44,0,30; then
clear
fi
### END /etc/grub.d/05_debian_theme ###
### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
set gfxpayload="$1"
if [ "$1" = "keep" ]; then
set vt_handoff=vt.handoff=7
else
set vt_handoff=
fi
}
if [ ${recordfail} != 1 ]; then
if [ -e ${prefix}/gfxblacklist.txt ]; then
if hwmatch ${prefix}/gfxblacklist.txt 3; then
if [ ${match} = 0 ]; then
set linux_gfx_mode=keep
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=text
fi
else
set linux_gfx_mode=keep
fi
else
set linux_gfx_mode=text
fi
export linux_gfx_mode
if [ "$linux_gfx_mode" != "text" ]; then load_video; fi
menuentry 'Ubuntu, with Linux 3.2.0-24-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
linux /boot/vmlinuz-3.2.0-24-generic-pae root=UUID=bbab868a-ea53-4be3-ba7d-2737fe6cb24c ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.2.0-24-generic-pae
}
menuentry 'Ubuntu, with Linux 3.2.0-24-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
echo 'Loading Linux 3.2.0-24-generic-pae ...'
linux /boot/vmlinuz-3.2.0-24-generic-pae root=UUID=bbab868a-ea53-4be3-ba7d-2737fe6cb24c ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-24-generic-pae
}
submenu "Previous Linux versions" {
menuentry 'Ubuntu, with Linux 3.2.0-23-generic-pae' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
gfxmode $linux_gfx_mode
insmod gzio
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
linux /boot/vmlinuz-3.2.0-23-generic-pae root=UUID=bbab868a-ea53-4be3-ba7d-2737fe6cb24c ro quiet splash $vt_handoff
initrd /boot/initrd.img-3.2.0-23-generic-pae
}
menuentry 'Ubuntu, with Linux 3.2.0-23-generic-pae (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
echo 'Loading Linux 3.2.0-23-generic-pae ...'
linux /boot/vmlinuz-3.2.0-23-generic-pae root=UUID=bbab868a-ea53-4be3-ba7d-2737fe6cb24c ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-3.2.0-23-generic-pae
}
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(/dev/mapper/isw_chjbfeec_DougRaid3,msdos1)'
search --no-floppy --fs-uuid --set=root bbab868a-ea53-4be3-ba7d-2737fe6cb24c
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober_proxy ###
menuentry "Windows 7 (loader) (on /dev/mapper/isw_chjbfeec_DougRaid1)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(sda,msdos1)'
search --no-floppy --fs-uuid --set=root C89C73D19C73B910
chainloader +1
}
### END /etc/grub.d/30_os-prober_proxy ###
### 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 ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
--------------------------------------------------------------------------------
====================== isw_chjbfeec_DougRaid5/etc/fstab: =======================
--------------------------------------------------------------------------------
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
/dev/mapper/isw_chjbfeec_DougRaid5 / ext4 errors=remount-ro 0 1
/dev/mapper/isw_chjbfeec_DougRaid6 none swap sw 0 0
--------------------------------------------------------------------------------
========== isw_chjbfeec_DougRaid5: Location of files loaded by Grub: ===========
GiB - GB File Fragment(s)
= boot/grub/core.img 1
= boot/grub/grub.cfg 1
= boot/initrd.img-3.2.0-23-generic-pae 2
= boot/initrd.img-3.2.0-24-generic-pae 2
= boot/vmlinuz-3.2.0-23-generic-pae 1
= boot/vmlinuz-3.2.0-24-generic-pae 1
= initrd.img 2
= initrd.img.old 2
= vmlinuz 1
= vmlinuz.old 1
======================== Unknown MBRs/Boot Sectors/etc: ========================
Unknown BootLoader on sda1
Unknown BootLoader on sda2
Unknown BootLoader on sda3
=============================== StdErr Messages: ===============================
xz: (stdin): Compressed data is corrupt
xz: (stdin): Compressed data is corrupt
hexdump: /dev/sda1: No such file or directory
hexdump: /dev/sda1: No such file or directory
hexdump: /dev/sda2: No such file or directory
hexdump: /dev/sda2: No such file or directory
hexdump: /dev/sda3: No such file or directory
hexdump: /dev/sda3: No such file or directory
xz: (stdin): Compressed data is corrupt
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
awk: cmd. line:36: Math support is not compiled in
我们可以在 grub 上看到 Windows 部分的方法如下:
menuentry "Windows 7 (loader) (on /dev/mapper/isw_chjbfeec_DougRaid1)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(sda,msdos1)'
search --no-floppy --fs-uuid --set=root C89C73D19C73B910
chainloader +1
}
我尝试了很多组合:
set root='(sda,msdos1)'
但没有成功
我尝试将UUID改为/dev/mapper/isw_chjbfeec_DougRaid2
UUID,但是GRUB报错。
我应该怎么办?
答案1
您的机器存在问题,GRUB 安装在 MBR 中,取代了 Windows 默认安装。如果您只想启动 Windows 操作系统,那么您可以修复 MBR。您可以使用 Windows 磁盘进入恢复模式,然后按照以下步骤修复 MBR 并启动。
STEP1: Goto windows recovery mode and open up the command prompt there
STEP2: write the following code to accomplish your target:
x:\sources>bootrec /fixmbr
x:\sources>bootrec /fixboot
STEP3: Just restart the computer after that and you will loose the GRUB loader and will directly be booted into windows.
现在您需要重新安装 grub 才能让您的 ubuntu 再次工作。如果您对重新安装 grub 有疑问,请在评论中告诉我。我会编辑答案并添加详细信息。
答案2
使用 Windows 系统分区进行双重启动对我来说从来都不起作用,而且我习惯于用不同的方法,但是当基于 UEFI 的系统继续取代基于 BIOS 的系统时,让我们尝试解决这个问题。
维基百科上有修复基于 UEFI 的系统的双重启动问题在 Ubuntu 社区文档中。但是您可能没有 bootmgfw.efi,因为您使用的是 MS DOS 分区表,所以这不起作用。根据维基百科Windows 首先要加载的bootmgr
是位于 Windows 系统分区的根目录。
因此在 Ubuntu 中挂载分区并执行以下操作:
grub-probe --target=fs_uuid /path/to/windows_system_patition/bootmgr
这应该返回 Windows 系统分区的 UUID。现在像这样修改 Windows 的 Grub 2 菜单项:
menuentry "Windows 7 (loader) (on /dev/mapper/isw_chjbfeec_DougRaid1)" --class windows --class os {
insmod part_msdos
insmod fat
insmod ntfs
set root='(sda,msdos1)'
search --no-floppy --fs-uuid --set=root UUID_of_Windows_System_Partition
chainloader (${root})/bootmgr
}
将 UUID_of_Windows_System_Partition 替换为您从上一个命令中获得的 UUID。请注意,我添加了insmod fat
,因为此分区曾经是 FAT 分区,而 chainloader 的目标是 Windows Boot Manager。我还可以在 Windows 7 VM 中看到旁边的w7ldr
,bootmgr
它应该是 Windows 7 Bootloader。复制上面的菜单项并替换引导管理器和w7ldrsudo update-grub
也尝试一下。编辑后别忘了运行,不过你可能知道这一点。:-)
希望这有效,祝你好运。