Results 1 to 10 of 13

Thread: Grub2 does not recognize Windows 7

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Beans
    8

    Grub2 does not recognize Windows 7

    I've been using Ubuntu for the past few years, and I have finally came across something that requires community help. Please see my plight and I thank you in advance for what help you may offer.

    I have 2 hard drives, first drive (hd0) is for data, second drive (hd1) is for the OS's. Windows 7 was installed on (hd1) a few months ago and wiped out GRUB. But today, I decided to go back to Ubuntu.

    I performed a fresh install of 9.10 x64 to (hd2), GRUB2 works and finds Ubuntu (both the newly installed x64, and the previous x86 versions), but it does not see Windows 7. The only goal I have right now, is to make Windows 7 bootable, once again.

    My "sudo fdisk -l" (typing manually, so skipping the Blocks)
    Device Boot Id System
    /dev/sdb1 83 Linux -- where x64 9.10 is
    /dev/sdb2 f W95 Ext'd (LBA)
    /dev/sdb5 83 Linux -- where x86 9.04 is
    /dev/sdb6 83 Linux -- /home
    /dev/sdb7 82 Linux Swap / Solaris
    /dev/sdb8 87 HPFS/NTFS -- Windows 7

    Things I've tried so far:
    1) Automagically finding Windows: sudo update-grub2
    2) Reinstalling grub via Live CD (9.10): sudo grub-install --root-directory=/media/(where sdb1 - x64 Ubuntu is) /dev/sdb
    3) Forgetting Ubuntu altogether and fixing boot using Windows 7 - bootrec.exe /fixmbr; bootrec.exe /rebuildbcd

    Now, number 3 is interesting, I found out that where Windows is installed, /dev/sdb8, is a logical partition, and cannot be made active (bootable). This led me to try number 4:

    4) Updating /etc/grub.d with custom 40_Win7 file, and making it bootable (the GRUB makeactive, GRUB2 parttool command):
    echo "Adding Win 7 to Bootloader" >&2
    cat << EOF
    menuentry "Windows 7" {
    insmod ntfs
    set root=(hd1,8 )
    parttool (hd1,8 ) boot+
    chainloader +1
    }
    EOF

    When I update grub.cfg after trying #4, it gives me the "not a primary partition" error. So now I am confused. Windows 7 was able to boot previously from this very partition, and I don't think installing 9.10 would change a partition type from primary to logical. So, why can't it boot?

    More importantly, what can I do to boot Windows 7? Tinkering is fun, but 8 hours of researching and trying and worn down my patience. Please help if you are able. Thank you.

  2. #2
    Join Date
    Apr 2008
    Beans
    3,317
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: Grub2 does not recognize Windows 7

    Did you deleted or reformat any partitions when you installed Ubutnu? You don't have any primary NTFS partition. So I would guess you are missing the Window 7 boot files. But before we jump to conclusions lets have a look at your setup. Follow these instructions to run the Boot Info Script and post the RESULTS.txt.
    Last edited by meierfra.; February 28th, 2010 at 06:23 AM.

  3. #3
    Join Date
    Feb 2010
    Beans
    4

    Re: Grub2 does not recognize Windows 7

    Boot up using your windows disc. Open up a command prompt and type this:
    bootrec /FixMbr
    Same thing as fdisk /mbrin older windows.
    Read about it at http://en.wikipedia.org/wiki/Master_boot_record. That's how I fixed my Windows partition after removing a bad ubuntu partition. You may have to reinstall grub but that should get your partition working fine.

  4. #4
    Join Date
    Apr 2008
    Beans
    3,317
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: Grub2 does not recognize Windows 7

    Deleted (did not contain any useful information)
    Last edited by meierfra.; February 28th, 2010 at 08:10 AM.

  5. #5
    Join Date
    Feb 2010
    Beans
    1

    Re: Grub2 does not recognize Windows 7

    Hi There,
    I'm not that professional but I have my experience in grub2 stuff ..
    I think editing the grub.cfg is a big mistake according to Ubuntu Wiki ..
    First make sure that windows 7 boots normally and forget about ubuntu for a sec.
    Then boot ur ubuntu 9.10 live CD and do exactly what this page says:
    https://wiki.ubuntu.com/Grub2#Recove...20via%20LiveCD

    note: when u type the command "update-grub" for the first time it won't detect Windows 7
    so reboot ur device, log in to ubuntu and type it again. Congrats !!
    sorry I wrote too much lol..
    if u have any question u r welcome

  6. #6
    Join Date
    Apr 2008
    Beans
    3,317
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: Grub2 does not recognize Windows 7

    Deleted (did not contain any useful information)
    Last edited by meierfra.; February 28th, 2010 at 08:10 AM.

  7. #7
    Join Date
    Jun 2007
    Beans
    8

    Re: Grub2 does not recognize Windows 7

    Thanks Meierfra, I'll run the script in the morning and post the results.

    And, I think you figured my problem perfectly. I had XP's NTFS on the Primary Partition that is now occupied by 9.10 x64, so I probably lost the boot files when I installed Ubuntu over the XP partition. To further support your premise, when I do try to boot the Win7 partition, it gives a NTLR missing error, so I'm more convinced by the minute that it's the missing boot files. Since that's most likely what the problem is, what can I do to recover the Windows7 boot files?

    I'll still post the results.txt, just in case.
    ---------------------------------------------------
    Also, thanks for your input Yz.MCR. I had already read up on GRUB2 documentation and knew to update "grub.cfg" via executable config files in "/etc/grub.d", and then running "sudo update-grub2", so no problems there .

  8. #8
    Join Date
    Apr 2008
    Beans
    3,317
    Distro
    Kubuntu 9.10 Karmic Koala

    Re: Grub2 does not recognize Windows 7

    The only goal I have right now, is to make Windows 7 bootable, once again.
    Getting Win 7 to boot will be a little bit of work,but should be possible.
    Are you currently able to boot into Ubuntu? If not I suggest to restore Grub first since some of the steps to fix Windows 7 will be easiest in Ubuntu.

    I probably lost the boot files when I installed Ubuntu over the XP partition.
    I agree.

    Since that's most likely what the problem is, what can I do to recover the Windows7 boot files?
    Usually you just have to run "startup" repair from the Window 7 DVD, but since you don't have a primary ntfs partition that will not work.

    But you can still use the Window7 DVD to recover the boot files. Just follow this howto:

    http://ubuntuforums.org/showthread.php?t=813628#4

    Step 3 is not always necessary, but RESULTS.txt will tell us if it is.
    Last edited by meierfra.; February 28th, 2010 at 08:17 AM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •