Windows 7 和 Ubuntu 的双启动问题

Windows 7 和 Ubuntu 的双启动问题

我发现自己处于一个相当独特的情况。我几乎读完了所有我能找到的关于此事的资料,虽然这些资料帮助我了解了一些背景知识,但我还没有找到解决办法。所以我在这里问。

我原本的电脑上只安装了 Windows 7 64 位操作系统。了解到在 64 位系统中无法使用 Apache、PHP 和 MySql 后,我做了一些研究,发现我可以使用 Ubuntu。我安装了最新版本:11.04。

我制作了一张 CD 来安装 Ubuntu,安装过程非常顺利。我将其与 Windows 7 并排安装。我可以通过双启动选项顺利启动 Ubuntu。

但是,当我重新启动以加载 Windows 时,Grub2 列表显示 Windows 7(加载器),当我选择此选项时,将加载 Windows 系统恢复而不是实际操作系统。我没有完成那里,因为我不知道该怎么做。我只是关闭了计算机并重新启动到 Ubuntu。在过去的一个半小时里,我一直在努力弄清楚如何启动 Windows 7 操作系统,但我一点头绪都没有。

虽然我对 Windows 7 比较熟悉,但对 Ubuntu 却完全陌生,所以如果您知道需要做什么,请尽量简单易懂,以便我能够理解。提前感谢您的帮助。

以下是使用启动信息脚本后的结果:启动信息脚本 0.55,发布日期:2010 年 2 月 15 日

============================= Boot Info Summary: ==============================

=> Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in 
partition #5 for cbh.
=> Windows is installed in the MBR of /dev/sdb
=> Grub 2 is installed in the MBR of /dev/mapper/pdc_bdadcfbdif and looks on 
the same drive in partition #5 for cbh.

sda1: _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Mounting failed:
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy

sda2: _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Mounting failed:
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy

sda3: _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Mounting failed:
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy

sdb1: _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files/dirs:   /bootmgr /Boot/BCD

sdb2: _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files/dirs:   

sdb3: _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files/dirs:   /bootmgr /boot/BCD

sdb4: _________________________________________________________________________

File system:       Extended Partition
Boot sector type:  -
Boot sector info:  

sdb5: _________________________________________________________________________

File system:       ext4
Boot sector type:  -
Boot sector info:  
Operating System:  Ubuntu 11.04
Boot files/dirs:   /boot/grub/grub.cfg /etc/fstab /boot/grub/core.img

sdb6: _________________________________________________________________________

File system:       swap
Boot sector type:  -
Boot sector info:  

pdc_bdadcfbdif1:    _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  
Boot files/dirs:   /bootmgr /Boot/BCD

pdc_bdadcfbdif2:     _________________________________________________________________________

File system:       ntfs
Boot sector type:  Windows Vista/7
Boot sector info:  No errors found in the Boot Parameter Block.
Operating System:  Windows 7
Boot files/dirs:   /bootmgr /Boot/BCD /Windows/System32/winload.exe

pdc_bdadcfbdif3: _________________________________________________________________________

File system:       
Boot sector type:  Unknown
Boot sector info:  
Mounting failed:
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
fuse: mount failed: Device or resource busy
mount: unknown filesystem type ''

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot         Start           End          Size  Id System

/dev/sda1    *          2,048       206,847       204,800   7 HPFS/NTFS
/dev/sda2             206,911 1,440,372,735 1,440,165,825   7 HPFS/NTFS
/dev/sda3       1,440,372,736 1,464,856,575    24,483,840   7 HPFS/NTFS


Drive: sdb ___________________ _____________________________________________________

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot         Start           End          Size  Id System

/dev/sdb1    *          2,048       206,847       204,800   7 HPFS/NTFS
/dev/sdb2             206,911 1,342,554,688 1,342,347,778   7 HPFS/NTFS
/dev/sdb3       1,930,344,448 1,953,521,663    23,177,216   7 HPFS/NTFS
/dev/sdb4       1,342,556,158 1,930,344,447   587,788,290   5 Extended
/dev/sdb5       1,342,556,160 1,896,806,399   554,250,240  83 Linux
/dev/sdb6       1,896,808,448 1,930,344,447    33,536,000  82 Linux swap / Solaris


Drive: pdc_bdadcfbdif ___________________     _____________________________________________________

Disk /dev/mapper/pdc_bdadcfbdif: 750.0 GB, 749999947776 bytes
255 heads, 63 sectors/track, 91182 cylinders, total 1464843648 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot         Start           End          Size  Id System

/dev/mapper/pdc_bdadcfbdif1   *          2,048       206,847       204,800   7     HPFS/NTFS
/dev/mapper/pdc_bdadcfbdif2            206,911 1,440,372,735 1,440,165,825   7 HPFS/NTFS
/dev/mapper/pdc_bdadcfbdif3      1,440,372,736 1,464,856,575    24,483,840   7 HPFS/NTFS

/dev/mapper/pdc_bdadcfbdif3 ends after the last sector of /dev/mapper/pdc_bdadcfbdif

blkid -c /dev/null: ____________________________________________________________

Device           UUID                                   TYPE           LABEL                         

/dev/mapper/pdc_bdadcfbdif1 888E54CC8E54B482                       ntfs        SYSTEM                        
/dev/mapper/pdc_bdadcfbdif2 C2766BF6766BEA1D                       ntfs       OS                            
/dev/mapper/pdc_bdadcfbdif: PTTYPE="dos" 
/dev/sda1        888E54CC8E54B482                       ntfs       SYSTEM                        
/dev/sda2        C2766BF6766BEA1D                       ntfs       OS                            
/dev/sda3        BE6CA31D6CA2CF87                       ntfs       HP_RECOVERY                   
/dev/sda                                                   promise_fasttrack_raid_member                               
/dev/sdb1        20B65685B6565B7C                       ntfs       SYSTEM                        
/dev/sdb2        B4467A314679F508                       ntfs       HP                            
/dev/sdb3        6E10B7A410B77227                       ntfs        FACTORY_IMAGE                 
/dev/sdb4: PTTYPE="dos" 
/dev/sdb5        266f9801-cf4f-4acc-affa-2092be035f0c     ext4                                     
/dev/sdb6        1df35749-a887-45ff-a3de-edd52239847d    swap                                     
/dev/sdb: PTTYPE="dos" 
error: /dev/mapper/pdc_bdadcfbdif3: No such file or directory
error: /dev/sdc: No medium found
error: /dev/sdd: No medium found
error: /dev/sde: No medium found
error: /dev/sdf: No medium found
error: /dev/sdg: No medium found

============================ "mount | grep ^/dev  output: ===========================

Device           Mount_Point              Type       Options

/dev/sdb5        /                        ext4       (rw,errors=remount-ro,commit=0)


=========================== sdb5/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/sdb,msdos5)'
search --no-floppy --fs-uuid --set=root 266f9801-cf4f-4acc-affa-2092be035f0c
if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=auto
load_video
insmod gfxterm
fi
terminal_output gfxterm
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos5)'
search --no-floppy --fs-uuid --set=root 266f9801-cf4f-4acc-affa-2092be035f0c
set locale_dir=($root)/boot/grub/locale
set lang=en_US
insmod gettext
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 ###
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 2.6.38-8-generic-pae' --class ubuntu --class gnu-linux     --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos5)'
search --no-floppy --fs-uuid --set=root 266f9801-cf4f-4acc-affa-2092be035f0c
linux   /boot/vmlinuz-2.6.38-8-generic-pae root=UUID=266f9801-cf4f-4acc-  affa-2092be035f0c ro   quiet splash vt.handoff=7
initrd  /boot/initrd.img-2.6.38-8-generic-pae
}
menuentry 'Ubuntu, with Linux 2.6.38-8-generic-pae (recovery mode)' --class ubuntu     --class gnu-linux --class gnu --class os {
recordfail
set gfxpayload=$linux_gfx_mode
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos5)'
search --no-floppy --fs-uuid --set=root 266f9801-cf4f-4acc-affa-2092be035f0c
echo    'Loading Linux 2.6.38-8-generic-pae ...'
linux   /boot/vmlinuz-2.6.38-8-generic-pae root=UUID=266f9801-cf4f-4acc-affa-2092be035f0c ro single 
echo    'Loading initial ramdisk ...'
initrd  /boot/initrd.img-2.6.38-8-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/sdb,msdos5)'
search --no-floppy --fs-uuid --set=root 266f9801-cf4f-4acc-affa-2092be035f0c
linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
insmod part_msdos
insmod ext2
set root='(/dev/sdb,msdos5)'
search --no-floppy --fs-uuid --set=root 266f9801-cf4f-4acc-affa-2092be035f0c
linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sdb1)" --class windows --class os {
insmod part_msdos
insmod ntfs
set root='(/dev/sdb,msdos1)'
search --no-floppy --fs-uuid --set=root 20B65685B6565B7C
chainloader +1
}
menuentry "Windows Recovery Environment (loader) (on /dev/sdb3)" --class windows  --class os {
insmod part_msdos
insmod ntfs
set root='(/dev/sdb,msdos3)'
search --no-floppy --fs-uuid --set=root 6E10B7A410B77227
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 ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

=============================== sdb5/etc/fstab: ===============================

# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' 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
# / was on /dev/sdb5 during installation
UUID=266f9801-cf4f-4acc-affa-2092be035f0c /               ext4    errors=remount-ro  0       1
# swap was on /dev/sdb6 during installation
UUID=1df35749-a887-45ff-a3de-edd52239847d none            swap    sw               0       0

=================== sdb5: Location of files loaded by Grub: ===================


 900.1GB: boot/grub/core.img
 825.0GB: boot/grub/grub.cfg
 688.7GB: boot/initrd.img-2.6.38-8-generic-pae
 688.0GB: boot/vmlinuz-2.6.38-8-generic-pae
 688.7GB: initrd.img
 688.0GB: vmlinuz
=========================== Unknown MBRs/Boot Sectors/etc =======================

Unknown BootLoader  on pdc_bdadcfbdif3



=======Devices which don't seem to have a corresponding hard drive==============

sdc sdd sde sdf sdg 
=============================== StdErr Messages: ===============================

ERROR: dos: partition address past end of RAID device
hexdump: /dev/mapper/pdc_bdadcfbdif3: No such file or directory
hexdump: /dev/mapper/pdc_bdadcfbdif3: No such file or directory
ERROR: dos: partition address past end of RAID device

答案1

Ubuntu 安装程序可能自动检测到恢复分区并设置 GRUB(引导加载程序)以启动该分区而不是正确的 Windows 分区。

首先尝试这样做sudo os-prober; sudo update-grub,看看这是否没有在 GRUB 中为您放入正确的条目。如果没有,您需要编辑 GRUB 配置以指向正确的分区。

首先我们要弄清楚 Windows 安装在哪个分区上。执行此操作sudo fdisk -l(不用担心,这是一个安全的操作;它只会列出您的磁盘和分区),然后您应该会看到一个分区条目列表,格式如下:

/dev/sda3 * 1 6374 51199123+ 7 HPFS/NTFS

注意所有分区的设备路径,这些分区的类型为“HPFS/NTFS”或“MS-DOS”或类似的。大概您将看到磁盘起始处有一个较小的 NTFS 分区,其他地方有一个较大的 NTFS 分区。较小的分区是您的恢复分区,较大的分区是您的 Windows 实例本身。记下较大的分区的设备路径。

现在我们需要知道文件系统的 UUID,我们将把它提供给 GRUB 以帮助它找到它。说出sudo blkid并找到与您上面记下的分区相对应的条目。注意后面引号中的值UUID=

现在使用您选择的编辑器打开/etc/grub.d/40_custom.sudo nano -w /etc/grub.d/40_custom就可以了。在此文件的末尾添加以下内容:

   menuentry "Windows 7" {
     insmod part_msdos
     insmod ntfs
     set root='(hd0,msdos1)'
     search --no-floppy --fs-uuid --set UUID-GOES-HERE
     chainloader +1
  }

这里有两点需要替换。我写的地方用UUID-GOES-HERE你上面记下的 UUID 替换(没有引号)。我写的地方用msdos1你之前记下的分区号替换 1(sda6将是msdos6等)。

保存此文件并执行sudo update-grub,然后重新启动。尝试新的菜单项。应该可以工作。

答案2

我也遇到了同样的问题。我的笔记本电脑上安装了 Windows 7,我决定也试试 Ubuntu。所以我新建了一个分区,将 15 GB 的硬盘空间分配给它,并在新分区上安装了 Ubuntu。一切顺利,安装向导重新启动了系统,GRUB 在其菜单上加载了 Ubuntu 和 Windows 7。

我可以加载 Windows 7,但当我选择 Ubuntu 时,我得到的只是一个黑屏。我搜索了网络并尝试了几乎所有我能找到的方法,但问题仍然存在。所以我决定格式化 Ubuntu 分区并重新安装 Ubuntu。在寻找解决方案的过程中,我注意到在哪里安装 GRUB 很重要。

最初我选择将 GRUB 安装在 Ubuntu 的同一分区上(我的情况是 sda8),这就是问题所在。安装 GRUB 时,指定要安装 GRUB 的硬盘(而不是分区)非常重要。指定分区可能会导致麻烦。

所以这次我选择在 'sda' 上安装 GRUB,并在 'sda8' 上安装 Ubuntu,就这样。问题解决了,现在我的笔记本电脑上的 Windows 7 和 Ubuntu 12.04 都可以顺利运行。

相关内容