web-dev-qa-db-ja.com

Windows 7、次にUbuntu 11.10をインストールしましたが、grub2を使用してWindowsを起動できません

多くの人がこれと同じような問題を抱えていることは知っていますが、これは重複しているとは思いません。私の状況は少し異なり、他の人のために働いている解決策のどれも私のために働いていません。

2つのハードドライブがあります。1つはプライマリパーティション(sdb)が1つだけで、もう1つは複数のパーティション(sda)があります。私のfdisk -lは次のようになります:

Disk /dev/sdb: 750.2 GB, 750156374016 bytes
16 heads, 63 sectors/track, 1453521 cylinders, total 1465149168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x316f8b1c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *          63  1465145135   732572536+   7  HPFS/NTFS/exFAT

Disk /dev/sda: 320.1 GB, 320072933376 bytes
210 heads, 6 sectors/track, 496144 cylinders, total 625142448 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeb0feb0f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           6   206847899   103423947    7  HPFS/NTFS/exFAT
/dev/sda2       206847998   625141759   209146881    5  Extended
/dev/sda5       206848000   616753151   204952576   83  Linux
/dev/sda6       616755200   625141759     4193280   82  Linux swap / Solaris

Ubuntu 11.10をsda5にインストールし、Windows 7をsdb1にインストールしています(プライマリパーティション/ dev/sda1に何があるのか​​わかりません-気にしない古いオペレーティングシステムです)。最初にWindowsをインストールし、次にUbuntuをインストールしました。ブートローダーとしてgrubを使用していて、Ubuntuを起動できます(そして今使用しています)が、最初はupdate-grub2にWindows7が表示されませんでした。オンラインで検索した後、これに対する一般的な解決策は、以下を含む/etc/grub.d/11_Windowsinitスクリプトを作成することでした。

#! /bin/sh -e
echo Adding Windows >&2
cat << EOF
menuentry "Windows 7″ {
    set root=(hd1,1)
    chainloader +1
}

ここでは、sdb1と一致するようにrootを(hd1,1)に設定します。これにより、grubメニューにWindows 7が追加されましたが、これを選択すると、空白の画面が表示されてハングします(Windows 7では起動しません)。私と同じような(しかし同一ではない)問題を抱えていて、何も機能しない人々に与えられた多くの解決策を試しました。

誰か助けてもらえますか?

Boot Info Script の出力は次のとおりです。

          Boot Info Script 0.60    from 17 May 2011


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

 => Grub2 (v1.99) is installed in the MBR of /dev/sda and looks at sector 
    535689840 of the same hard drive for core.img. core.img is at this 
    location and looks for ?? on this drive.
 => Windows is installed in the MBR of /dev/sdb.

sda1: __________________________________________________________________________

    File system:       
    Boot sector type:  Grub Legacy
    Boot sector info:   Grub Legacy (v) is installed in the boot sector of 
               sda1 and looks at sector 509109856 of the same hard 
               drive for the stage2 file, but no stage2 files can be 
               found at this location.
    Mounting failed:   mount: unknown filesystem type ''

sda2: __________________________________________________________________________

    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 /boot/grub/core.img

sda6: __________________________________________________________________________

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

sdb1: __________________________________________________________________________

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

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

Drive: sda _____________________________________________________________________

Disk /dev/sda: 320.1 GB, 320072933376 bytes
210 heads, 6 sectors/track, 496144 cylinders, total 625142448 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    *              6   206,847,899   206,847,894   7 NTFS / exFAT / HPFS
/dev/sda2         206,847,998   625,141,759   418,293,762   5 Extended
/dev/sda5         206,848,000   616,753,151   409,905,152  83 Linux
/dev/sda6         616,755,200   625,141,759     8,386,560  82 Linux swap / Solaris


Drive: sdb _____________________________________________________________________

Disk /dev/sdb: 750.2 GB, 750156374016 bytes
16 heads, 63 sectors/track, 1453521 cylinders, total 1465149168 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/sdb1    *             63 1,465,145,135 1,465,145,073   7 NTFS / exFAT / HPFS


"blkid" output: ________________________________________________________________

Device           UUID                                   TYPE       LABEL

/dev/sda5        20d584af-9217-4d71-a822-7663b9530da4   ext4       
/dev/sda6        ce8b7879-9234-4c89-b62f-a09737d1d1cf   swap       
/dev/sdb1        22A4F723A4F6F85D                       ntfs       windows7

================================ Mount points: =================================

Device           Mount_Point              Type       Options

/dev/sda5        /                        ext4       (rw,errors=remount-ro,commit=0)
/dev/sdb1        /media/windows-7         fuseblk    (rw,noexec,nosuid,nodev,allow_other,blksize=4096,default_permissions)


=========================== sda5/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='(hd0,msdos5)'
search --no-floppy --fs-uuid --set=root 20d584af-9217-4d71-a822-7663b9530da4
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  insmod part_msdos
  insmod ext2
  set root='(hd0,msdos5)'
  search --no-floppy --fs-uuid --set=root 20d584af-9217-4d71-a822-7663b9530da4
  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 0,71,115; 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 3.0.0-14-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    set gfxpayload=$linux_gfx_mode
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set=root 20d584af-9217-4d71-a822-7663b9530da4
    linux   /boot/vmlinuz-3.0.0-14-generic root=UUID=20d584af-9217-4d71-a822-7663b9530da4 ro   quiet splash vt.handoff=7
    initrd  /boot/initrd.img-3.0.0-14-generic
}
menuentry 'Ubuntu, with Linux 3.0.0-14-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod gzio
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set=root 20d584af-9217-4d71-a822-7663b9530da4
    echo    'Loading Linux 3.0.0-14-generic ...'
    linux   /boot/vmlinuz-3.0.0-14-generic root=UUID=20d584af-9217-4d71-a822-7663b9530da4 ro recovery nomodeset 
    echo    'Loading initial ramdisk ...'
    initrd  /boot/initrd.img-3.0.0-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/11_Windows ###
menuentry âWindows 7â³ {
    set root=(hd1,1)
    chainloader +1
}
### END /etc/grub.d/11_Windows ###

### 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='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set=root 20d584af-9217-4d71-a822-7663b9530da4
    linux16 /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
    insmod part_msdos
    insmod ext2
    set root='(hd0,msdos5)'
    search --no-floppy --fs-uuid --set=root 20d584af-9217-4d71-a822-7663b9530da4
    linux16 /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### 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 ###
--------------------------------------------------------------------------------

=============================== sda5/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/sda5 during installation
UUID=20d584af-9217-4d71-a822-7663b9530da4 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda6 during installation
UUID=ce8b7879-9234-4c89-b62f-a09737d1d1cf none            swap    sw              0       0

/dev/sdb1       /media/windows-7       ntfs-3g      quiet,defaults,locale=en_US.utf8,umask=0,noexec     0 0

--------------------------------------------------------------------------------

=================== sda5: 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.0.0-14-generic               3
           =                boot/vmlinuz-3.0.0-14-generic                  1
           =                initrd.img                                     3
           =                vmlinuz                                        1

======================== Unknown MBRs/Boot Sectors/etc: ========================

Unknown BootLoader on sda2

00000000  0d d6 82 9e f4 dd 3d 74  1c cd c2 f8 71 11 73 56  |......=t....q.sV|
00000010  e8 03 9d f7 fc 86 9b 37  8d 79 4e 66 ca ac 9a 96  |.......7.yNf....|
00000020  e9 77 46 3f 3b 8c 7e f6  63 f0 d1 4e e3 fc 4a e3  |.wF?;.~.c..N..J.|
00000030  ff 04 79 9c ce 2b 4e 6d  4e 9a 86 d5 f4 c5 2f 9c  |..y..+NmN...../.|
00000040  d6 b5 90 8e 91 29 94 d6  66 0c b8 40 1a 2f 82 6f  |.....)..f..@./.o|
00000050  18 03 f2 ea b8 73 4d e9  2b e8 1a 05 aa 1b 75 b2  |.....sM.+.....u.|
00000060  9e e6 f9 f7 8c 09 bb 97  fd 93 df e7 33 26 da d7  |............3&..|
00000070  20 e4 f1 ad 5d e4 89 31  87 38 cb bc b5 15 e5 dc  | ...]..1.8......|
00000080  fa 80 c3 b7 cb 9a b6 26  a4 29 33 e3 de f7 a4 eb  |.......&.)3.....|
00000090  3c f9 fc 25 79 5f 43 da  0c 65 b8 57 f6 b3 c8 b7  |<..%y_C..e.W....|
000000a0  d2 c6 79 e0 68 cc 43 75  ff ea 87 95 cc 11 f6 da  |..y.h.Cu........|
000000b0  6c 43 76 27 0e fb 3c 71  9e 41 7e 0a 9c 06 e7 74  |lCv'..<q.A~....t|
000000c0  2f bc 3d 7a 74 00 ed 74  3e f4 26 63 73 c4 61 fa  |/.=zt..t>.&cs.a.|
000000d0  04 90 02 d4 c3 5c 77 9d  31 9f 66 ae 70 46 e7 0a  |.....\w.1.f.pF..|
000000e0  03 98 2b 9e c6 5c e5 24  e3 83 7c f3 ac 73 b8 ad  |..+..\.$..|..s..|
000000f0  cc 0f 9a 91 86 2c a4 a1  05 b4 39 a8 4f 79 15 21  |.....,....9.Oy.!|
00000100  3d 45 49 4f 4d d9 cb 40  e7 32 e4 cd 55 ec 6a 69  |[email protected]|
00000110  5e d5 46 5e 16 d9 7e d2  78 83 74 8c 73 d8 fb 9e  |^.F^..~.x.t.s...|
00000120  41 bb a8 83 9b f2 b8 19  8f ff 09 a0 1c 7c 05 50  |A............|.P|
00000130  57 c3 98 88 ec 67 fc 7e  c2 b8 7b 0b fa 93 9c 01  |W....g.~..{.....|
00000140  e8 1e ea 55 d2 fd a5 a6  fb 0a fc 65 9d 8f bc 78  |...U.......e...x|
00000150  d8 d8 17 d5 f9 f2 20 dd  bf 3b 4c ba aa 93 be 6a  |...... ..;L....j|
00000160  f6 ef bb 4f 27 d6 a9 a8  31 f7 a8 27 fb 33 f4 01  |...O'...1..'.3..|
00000170  3f 50 bf 2a a2 d3 24 9d  f7 8f 70 28 8b db e8 34  |?P.*..$...p(...4|
00000180  1c fd ee ac 4c 5a 6f be  34 d6 7b 5f 1d 77 52 af  |....LZo.4.{_.wR.|
00000190  4e 1a e3 0b 73 b2 9b e0  27 f0 b3 cc cf b4 2d ed  |N...s...'.....-.|
000001a0  90 6f a2 68 3b db 40 36  ca a0 e1 f9 c4 61 7c 44  |.o.h;[email protected]|D|
000001b0  19 0c 95 f6 6b b4 8d ad  7a 6e d0 88 f2 9e 00 d1  |....k...zn......|
000001c0  c6 ff 83 d1 c6 ff 02 00  00 00 00 a8 6e 18 00 d1  |............n...|
000001d0  c6 ff 05 d1 c6 ff c2 ae  6e 18 40 f9 7f 00 00 00  |........n.@.....|
000001e0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
000001f0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 55 aa  |..............U.|
00000200


=============================== StdErr Messages: ===============================

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
3
Ben Lee

(hd1,1)が正しいことを確認しますか? 「、1」は確かに、GRUB2がGRUB(レガシー)の時点で0ではなく1からパーティションとハードディスクの番号付けを開始するためです。

[〜#〜] edit [〜#〜]:私も間違っていますGRUB2は1からパーティションの番号付けを開始しますが、ハードディスクは0から上にカウントされます。これを指摘してくれた@ WalterMaier-Murdnelchに感謝します。

試してみてください

#! /bin/sh -e
echo Adding Windows >&2
cat << EOF
menuentry "Windows 7″ {
    set root='(hd1,mdsos1)'
    chainloader +1
}

それは簡単なバージョンです。 GRUB2構成ファイルに一重引用符( ')を含めてください。

それ以外の場合/さらに、Debianおよびその派生ディストリビューションに固有の「osprober」のようなものを使用しようとする場合があります。基本的に、ウィンドウは自動的に検出されます。実行してみてください

Sudo os-prober

シェルから。

それ以外の場合は、自分のコードに一致するようにコードを調整してみてください

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Windows 7 (loader) (on /dev/sde1)" --class windows --class os {
        insmod part_msdos
        insmod ntfs
        set root='(hd4,msdos1)'
        search --no-floppy --fs-uuid --set=root <UUID>
        chainloader +1
}

(insmod命令以外に)「search ...」行(シェルでblkidと入力するとパーティションUUIDを見つけることができます)では、パーティションテーブルのタイプ( "、1"ではなく "、msdos1")を指定する必要があると思います。 )。

1
user51166

ubuntuの実行で:

Sudo update-grub2

次に、Windows 7インストールDVDから起動すると、起動に問題があると表示されて修正されます。先に進まず、DVDを取り外して、HDDからWindowsを起動します。最終的に、ブートローダーが表示されず、ブートが選択せずにWindowsに直接移動する場合は、UbuntuライブディスクからのみGrubを再インストールする必要があります。

0
jet