Windows 7 Not Booting after Grub installed to bootsector

Bug #1079482 reported by Michael
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

My computer came with Windows 7 installed on it. I wanted to try Ubuntu, so I installed it alongside Windows 7 and everything was fine. I needed more space on my Windows 7 partition, so I deleted the Ubuntu partition from the hard drive. When I went to restart I got a blank screen. I reinstalled Ubuntu allongside Windows 7 and was able to restart and boot Windows. The next day I got the same blank screen, so I reinstalled Ubuntu over Ubuntu, leaving the Windows 7 partition alone. After that, when I try to boot Windows 7 it keeps sending me back to the select an OS page. I get an error that says:

The NTFS partition is hibernated. Please resume and shutdown Windows
properly, or mount the volume read-only with the 'ro' mount option, or
mount the volume read-write with the 'remove_hiberfile' mount option.
For example type on the command line:

            mount -t ntfs-3g -o remove_hiberfile /dev/sda3 /media/OS

whenever I try to access the Windows OS portion of the hard drive.

When I try the command it does not work and I get a message saying that "only root can do that"

I can not resume Windows to shut it down properly though, because I must first unhibernate Windows.

I believe this may be a bug.

This is what the bootinfoscript reports, showing that Grub has overwritten the bootsector, which prevents Windows from booting:
sda2: __________________________________________________________________________

    File system: ntfs
    Boot sector type: Grub2 (v1.99)
    Boot sector info: Grub2 (v1.99) is installed in the boot sector of sda2
                       and looks at sector 1456312560 of the same hard drive
                       for core.img. core.img is at this location and looks
                       for (,msdos6)/boot/grub on this drive. No errors found
                       in the Boot Parameter Block.
    Operating System:
    Boot files: /bootmgr /Boot/BCD

Revision history for this message
Phillip Susi (psusi) wrote :

You seem to be conflating two unrelated errors. One involving mounting your windows partition from within Ubuntu, and one with booting windows. If you want to clear the hibernation file and mount the partition from Ubuntu, you need to prefix the command with sudo to get super user permissions. See http://wiki.ubuntu.com/RootSudo for more information.

When you try to boot windows, is there any error message from grub? Please run this script and add the results to this report:

http://sourceforge.net/projects/bootinfoscript/

Changed in grub2 (Ubuntu):
status: New → Incomplete
Revision history for this message
Michael (robohead456) wrote :

I didn't mean for the two errors to sound unrelated, but I believe that I can not boot Windows because it is in hibernation. That is the problem I am trying to fix, and what I believe the bug is. I came about this possibility because: 1) I left windows on overnight and it would have gone into hibernation, and 2) When trying to access the Windows partition I got the above error stating that Windows was in hibernation. The fact that I could not mount Windows was just an observation. There is no error message from grub. I will try the script now and get back to you.

Revision history for this message
Michael (robohead456) wrote :

I am not sure how to get the script to run. Is there a ceartain application that is required?

I was also wondering what mounting the disk does. Will I still be able to boot Windows if I mount the partition?

Revision history for this message
Phillip Susi (psusi) wrote :

Extract the script from the archive, and if you extracted it to your Downloads directory, then open a terminal and:

cd Downloads
sudo ./bootinfoscript

Mounting means opening the filesystem on the disk and attaching it somewhere within the Unix filesystem hierarchy so you can access the files. ntfs-3g normally refuses to mount an NTFS partition if it detects a windows hibernation file, since modifying the filesystem while windows is hibernated would cause corruption when windows resumes. The option you are trying to pass instructs ntfs-3g to go ahead and delete the hibernation file ( preventing windows from resuming ), and proceed.

Revision history for this message
Michael (robohead456) wrote :

Thank you. I will run the script now.

I came across another option to get back onto windows that re-installls the windows master boot record. Would that still allow me to access Ubuntu? Here is the link to the page I found it on:

http://www.howtogeek.com/howto/32523/how-to-manually-repair-windows-7-boot-loader-problems/

Revision history for this message
Michael (robohead456) wrote :
Download full text (12.6 KiB)

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
    for (,msdos7)/boot/grub on this drive.

sda1: __________________________________________________________________________

    File system: vfat
    Boot sector type: Dell Utility: FAT16
    Boot sector info: No errors found in the Boot Parameter Block.
    Operating System:
    Boot files: /DELLBIO.BIN /DELLRMK.BIN /COMMAND.COM

sda2: __________________________________________________________________________

    File system: ntfs
    Boot sector type: Grub2 (v1.99)
    Boot sector info: Grub2 (v1.99) is installed in the boot sector of sda2
                       and looks at sector 1456312560 of the same hard drive
                       for core.img. core.img is at this location and looks
                       for (,msdos6)/boot/grub on this drive. No errors found
                       in the Boot Parameter Block.
    Operating System:
    Boot files: /bootmgr /Boot/BCD

sda3: __________________________________________________________________________

    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

sda4: __________________________________________________________________________

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

sda5: __________________________________________________________________________

    File system: ntfs
    Boot sector type: Windows Vista/7: NTFS
    Boot sector info: According to the info in the boot sector, sda5 starts
                       at sector 2. But according to the info from fdisk,
                       sda5 starts at sector 1086939136.
    Operating System:
    Boot files: /bootmgr

sda6: __________________________________________________________________________

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

sda7: __________________________________________________________________________

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

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

Drive: sda _____________________________________________________________________

Disk /dev/sda: 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 / 4096 bytes

Partition Boot Start Sector End Sector # of Sectors Id System

/dev/sda1 63 80,324 80,262 de Dell Utility
/dev/sda2 * 81,920 41,627,647 41,545,728 7 NTFS / exFAT / HPFS
/dev/sda3 41,627,648 1,086,938,758...

Revision history for this message
Phillip Susi (psusi) wrote :

You appear to have mistakenly installed grub to the boot sector of the NTFS partition. You will need to use the windows tools ( FIXBOOT command in the recovery console iirc ) to repair the boot sector, replacing grub with the windows boot loader.

Changed in grub2 (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Michael (robohead456) wrote : Re: [Bug 1079482] Re: Windows 7 Not Booting

I tried that and now there is no Linux grub or windows boot page. Do I need to specify a location for the windows boot page?

Sent from my iPod

On Nov 22, 2012, at 8:35 PM, Phillip Susi <email address hidden> wrote:

> You appear to have mistakenly installed grub to the boot sector of the
> NTFS partition. You will need to use the windows tools ( FIXBOOT
> command in the recovery console iirc ) to repair the boot sector,
> replacing grub with the windows boot loader.
>
>
> ** Changed in: grub2 (Ubuntu)
> Status: Incomplete => Invalid
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1079482
>
> Title:
> Windows 7 Not Booting
>
> Status in “grub2” package in Ubuntu:
> Invalid
>
> Bug description:
> My computer came with Windows 7 installed on it. I wanted to try
> Ubuntu, so I installed it alongside Windows 7 and everything was fine.
> I needed more space on my Windows 7 partition, so I deleted the Ubuntu
> partition from the hard drive. When I went to restart I got a blank
> screen. I reinstalled Ubuntu allongside Windows 7 and was able to
> restart and boot Windows. The next day I got the same blank screen, so
> I reinstalled Ubuntu over Ubuntu, leaving the Windows 7 partition
> alone. After that, when I try to boot Windows 7 it keeps sending me
> back to the select an OS page. I get an error that says:
>
> The NTFS partition is hibernated. Please resume and shutdown Windows
> properly, or mount the volume read-only with the 'ro' mount option, or
> mount the volume read-write with the 'remove_hiberfile' mount option.
> For example type on the command line:
>
> mount -t ntfs-3g -o remove_hiberfile /dev/sda3 /media/OS
>
> whenever I try to access the Windows OS portion of the hard drive.
>
> When I try the command it does not work and I get a message saying
> that "only root can do that"
>
> I can not resume Windows to shut it down properly though, because I
> must first unhibernate Windows.
>
> I believe this mat be a bug.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1079482/+subscriptions

Revision history for this message
Michael (robohead456) wrote : Re: Windows 7 Not Booting

Now there is no linux grub or windows boot page
Just a flashing underscore in the top left corner

Michael (robohead456)
Changed in grub2 (Ubuntu):
status: Invalid → Incomplete
Revision history for this message
Michael (robohead456) wrote :

I have just re-installed ubuntu over itself to replace the grub. I am back to where I started, I can boot ubuntu but not windows.

description: updated
Revision history for this message
Phillip Susi (psusi) wrote :

You need to use the FIXBOOT command iirc, not FIXMBR, to repair the windows boot sector.

Changed in grub2 (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Michael (robohead456) wrote : Re: [Bug 1079482] Re: Windows 7 Not Booting

I tried both of them ( separately and together) All I got then was a flashing underscore.

Sent from my iPod

On Nov 25, 2012, at 8:09 PM, Phillip Susi <email address hidden> wrote:

> You need to use the FIXBOOT command iirc, not FIXMBR, to repair the
> windows boot sector.
>
>
> ** Changed in: grub2 (Ubuntu)
> Status: Incomplete => Invalid
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1079482
>
> Title:
> Windows 7 Not Booting
>
> Status in “grub2” package in Ubuntu:
> Invalid
>
> Bug description:
> My computer came with Windows 7 installed on it. I wanted to try
> Ubuntu, so I installed it alongside Windows 7 and everything was fine.
> I needed more space on my Windows 7 partition, so I deleted the Ubuntu
> partition from the hard drive. When I went to restart I got a blank
> screen. I reinstalled Ubuntu allongside Windows 7 and was able to
> restart and boot Windows. The next day I got the same blank screen, so
> I reinstalled Ubuntu over Ubuntu, leaving the Windows 7 partition
> alone. After that, when I try to boot Windows 7 it keeps sending me
> back to the select an OS page. I get an error that says:
>
> The NTFS partition is hibernated. Please resume and shutdown Windows
> properly, or mount the volume read-only with the 'ro' mount option, or
> mount the volume read-write with the 'remove_hiberfile' mount option.
> For example type on the command line:
>
> mount -t ntfs-3g -o remove_hiberfile /dev/sda3 /media/OS
>
> whenever I try to access the Windows OS portion of the hard drive.
>
> When I try the command it does not work and I get a message saying
> that "only root can do that"
>
> I can not resume Windows to shut it down properly though, because I
> must first unhibernate Windows.
>
> I believe this may be a bug.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1079482/+subscriptions

Revision history for this message
bcbc (bcbc) wrote : Re: Windows 7 Not Booting

Grub2 was fixed to prevent offering to install on any windows partition. This seems to be a regression if it's offering Windows partitions now. I've noticed a couple of similar cases on askubuntu.com:
http://askubuntu.com/questions/230775/problem-with-dual-boot-windows-xp-ubuntu-12-04
http://askubuntu.com/questions/227670/unable-to-boot-windows-7-after-grub-overwrote-the-windows-bootsector

Revision history for this message
bcbc (bcbc) wrote :

Here's the bug I was referring to: bug 576724

This is a comment from that bug:

This bug was fixed in the package grub2 - 1.98+20100614-2ubuntu4

---------------
grub2 (1.98+20100614-2ubuntu4) maverick; urgency=low

  * Rearrange postinst install_devices logic so that preparatory code is run
    only once and the while loop only encloses actual asking of questions,
    and so that the question being asked is always marked for redisplay when
    going round the while loop again (LP: #580408).
  * Only offer partitions containing /, /boot, or /boot/grub for
    grub-install; installing to other partitions may have harmful effects
    such as making Windows unbootable, and installing GRUB to every single
    partition is likely to result in confusion anyway (LP: #576724).
 -- Colin Watson <email address hidden> Thu, 01 Jul 2010 18:26:37 +0100

summary: - Windows 7 Not Booting
+ Windows 7 Not Booting after Grub installed to bootsector
description: updated
Revision history for this message
Michael (robohead456) wrote :

Grub2 may have been fixed to prevent installing on any windows partition, but it is still installed on my windows partition. I didn't select to install grub on the windows partition, I chose to install Ubuntu alongside windows. It did not specify where it would install the grub, and there was no option to chose where it installed. I have tried using the fixboot command from my windows recovery disc, but there was nothing then (as stated in an above post).Would the instructions from https://help.ubuntu.com/community/BootSectorFix , using the TestDisk steps be able to fix my windows boot problem?

Revision history for this message
Phillip Susi (psusi) wrote :

That is completely unrelated to this issue bcbc. Grub is installed to the MBR by default, and if you want to put the windows MBR back, you need to use the FIXMBR command.

Revision history for this message
Michael (robohead456) wrote :

I have tried using the FIXMBR command in the windows recovery disc but, as described in an above post, it did not work. Could you point me to a source that can instruct on how to properly use this command instead of arguing about how a post was unrelated? I did happen to find one of the links helpful for suggesting another way to fix the MBR. A month has gone by and I am still no closer to fixing the problem. I am grateful for any help I can get.

Is the problem that the ubuntu grub can't boot windows from hibernation mode? Would replacing the origional windows mbr work, or would simply moving the grub to a different partition solve the problem? Could we decide on what would be the best solution to my problem, and could you give me more in-depth instructions on how to fix the problem. Thanks for the help.

Revision history for this message
Phillip Susi (psusi) wrote : Re: [Bug 1079482] Re: Windows 7 Not Booting after Grub installed to bootsector

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The FIXMBR command in the windows recovery console will *REMOVE* grub,
and restore the Windows boot loader. Since you deleted Ubuntu I
assume your goal is to not have it any longer, and return to a pure
Windows system. If you are still having trouble booting Windows after
doing that you will need to contact Microsoft for technical support.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJQ03xQAAoJEJrBOlT6nu75AhYH/iQJR2+jEctMgtGSg6qYdayE
+KG8L8XCQJWfjY4Ujh4RKOlfoaF5+d2m+/H8bSwhsKEzBbMrJKMrm6KU6ukQ6ytZ
vvpfKX6ZwEMq7mX0YSUPOTryt1u/8paRwbuJZ1N0aOxHPD6NZQ/uH+nicYWexEF8
vDS3gXrhlLNc5iKQPzTXOCBPQjBr9Sy2TmHzr8uvtVglqA08VwYy4f2JbjYwAJP3
TBeEyVv4rK2CJ+J396Dq2D/SAFd7zGUohdPqCVTVt1CydioGrgmye6cjQU1Ake9T
MMv4MZIK7sarP+ZmVBzBJfTBWrPbQgaqwzPHSqsSZWMUHal5nDGe+EF1wO25wEo=
=jHCY
-----END PGP SIGNATURE-----

Revision history for this message
bcbc (bcbc) wrote :

Phillip Susi,

There seem to many a number of issues here, but the fact is that Grub installed itself over the windows boot sector, not the MBR. Wiping out the partition boot sector prevents Windows from booting, whereas replacing the bootloader in the MBR is normal (obviously). The bug I reported was supposed to *PREVENT* grub from ever installing to the Windows partition (this used to be offered in the drop down box as the target for Grub2 while installing - in Ubiquity) but should not be offered now. But if it's not offered, then the question is how does Grub get installed to the Windows partition? The only way I know is to manually do it with grub-install /dev/sda1 --force but clearly new users are not doing this. Therefore my point about the possible regression.

Running FIXMBR won't do a thing in this case. Until the bootsector is repaired Windows cannot boot.

Revision history for this message
bcbc (bcbc) wrote :
Revision history for this message
bcbc (bcbc) wrote :
bcbc (bcbc)
Changed in grub2 (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
Phillip Susi (psusi) wrote :

bcbc, since the reporter is no longer using Ubuntu, and there's a lot of noise and little signal here, there's no point in keeping this bug open. If you think there has been a regression in bug #576724, then follow up there.

Changed in grub2 (Ubuntu):
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.