Grub removes Windows boot option when NTFS partition needs recovery

Bug #21175 reported by Matthew East
30
This bug affects 2 people
Affects Status Importance Assigned to Milestone
grub (Baltix)
New
Undecided
Unassigned
os-prober (Ubuntu)
Won't Fix
High
Unassigned
Nominated for Karmic by r12056
Nominated for Lucid by r12056

Bug Description

Just guessing at the package, please reassign if necessary!

After the latest Breezy upgrades, including a new kernel, I have found that my
Windows partition and Thinkpad Rescue Partition, both previously automatically
detected and inserted into the grub menu, have disappeared from my bootup
options. Although this is essentially a Good Thing, it's clearly a bug. See URL
for the hardware information.

Matt

Revision history for this message
Sivan Greenberg (sivan) wrote :

(In reply to comment #0)
> Just guessing at the package, please reassign if necessary!
>
> After the latest Breezy upgrades, including a new kernel, I have found that my
> Windows partition and Thinkpad Rescue Partition, both previously automatically
> detected and inserted into the grub menu, have disappeared from my bootup
> options. Although this is essentially a Good Thing, it's clearly a bug. See URL
> for the hardware information.
>
> Matt

I can confirm the same behavior over here, on my Dell laptop and intel desktop
as well.

Revision history for this message
Matthew East (mdke) wrote :

marking as confirmed, then

Revision history for this message
Ben Collins (ben-collins) wrote :

Does the kernel see the partitions and can you mount them yourself? Can you send
the output of /proc/partitions on hoary and breezy kernels.

I'm thinking this is a grub bug (or whatever does the partition checking).

Revision history for this message
Matthew East (mdke) wrote :

(In reply to comment #3)
> Does the kernel see the partitions and can you mount them yourself? Can you send
> the output of /proc/partitions on hoary and breezy kernels.

I only have Breezy installed. Here is the output:

matt@kalliope:~$ cat /proc/partitions
major minor #blocks name

   8 0 39070080 sda
   8 1 14651248 sda1
   8 2 4142880 sda2
   8 3 19406520 sda3
   8 4 1 sda4
   8 5 859446 sda5
 253 0 14651248 dm-0
 253 1 4142880 dm-1
 253 2 19406520 dm-2
 253 3 859446 dm-3

Here is my partition table:

matt@kalliope:~$ sudo fdisk -l /dev/sda

Disk /dev/sda: 40.0 GB, 40007761920 bytes
255 heads, 63 sectors/track, 4864 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/sda1 1 1824 14651248+ 7 HPFS/NTFS
/dev/sda2 * 4348 4864 4142880 2 XENIX root
Partition 2 does not end on cylinder boundary.
/dev/sda3 1825 4240 19406520 83 Linux
/dev/sda4 4241 4347 859477+ 5 Extended
/dev/sda5 4241 4347 859446 82 Linux swap / Solaris

Partition table entries are not in disk order

and here is what I get when I try to mount /dev/sda1:

matt@kalliope:~$ sudo mount -t ntfs /dev/sda1 /mnt/test
mount: wrong fs type, bad option, bad superblock on /dev/sda1,

[4296730.205000] NTFS driver 2.1.22 [Flags: R/O MODULE].
[4296730.245000] NTFS-fs error (device sda1): read_ntfs_boot_sector(): Primary
boot sector is invalid.
[4296730.245000] NTFS-fs error (device sda1): read_ntfs_boot_sector(): Mount
option errors=recover not used. Aborting without trying to recover.
[4296730.245000] NTFS-fs error (device sda1): ntfs_fill_super(): Not an NTFS volume.
[4296745.723000] NTFS-fs error (device sda2): read_ntfs_boot_sector(): Primary
boot sector is invalid.
[4296745.723000] NTFS-fs error (device sda2): read_ntfs_boot_sector(): Mount
option errors=recover not used. Aborting without trying to recover.
[4296745.723000] NTFS-fs error (device sda2): ntfs_fill_super(): Not an NTFS volume.
[4296749.694000] NTFS-fs error (device sda1): read_ntfs_boot_sector(): Primary
boot sector is invalid.
[4296749.694000] NTFS-fs error (device sda1): read_ntfs_boot_sector(): Mount
option errors=recover not used. Aborting without trying to recover.
[4296749.694000] NTFS-fs error (device sda1): ntfs_fill_super(): Not an NTFS volume.
[4296809.817000] NTFS-fs error (device sda1): read_ntfs_boot_sector(): Primary
boot sector is invalid.
[4296809.817000] NTFS-fs error (device sda1): read_ntfs_boot_sector(): Mount
option errors=recover not used. Aborting without trying to recover.
[4296809.817000] NTFS-fs error (device sda1): ntfs_fill_super(): Not an NTFS volume.

Dunno if this helps, but it is certainly weird. Windows was working fine since
my massive dist-upgrade yesterday.

Revision history for this message
Ben Collins (ben-collins) wrote :

Yeah, it looks like it's just a matter of the ntfs module being broken.

Revision history for this message
Matthew East (mdke) wrote :

so is there any way I can boot Windows? I'll do a system restore if there is no
change of this being fixed today.

Revision history for this message
Ben Collins (ben-collins) wrote :

Sure, add this in /boot/grub/menu.lst

title Microsoft Windows
root (hd0,0)
savedefault
makeactive
chainloader +1

Change hd0,0 to whatever is your actual windows partition. From the looks of
your partition table, it should be correct. You can probably just copy the entry
in /boot/grub/menu.lst~ if it's still there.

Revision history for this message
Ben Collins (ben-collins) wrote :

Can you try adding -o errors=recover with the mount command? If that works, then
try unmounting and remount without that option. I'm wondering if your NTFS
volume has errors, and it is just failing because the errors need to be
recovered (probably booting to Windows one time will resolve this too).

Revision history for this message
Ben Collins (ben-collins) wrote :

I think this bug is that the NTFS partition needs recovery. Which is not a bug
in itself, however grub should probably handle this a bit better. It should not
remove the boot option, which is probably the best way to handle the recovery.

Revision history for this message
Matthew East (mdke) wrote :

(In reply to comment #7)
> Sure, add this in /boot/grub/menu.lst
>
> title Microsoft Windows
> root (hd0,0)
> savedefault
> makeactive
> chainloader +1
>
> Change hd0,0 to whatever is your actual windows partition. From the looks of
> your partition table, it should be correct. You can probably just copy the entry
> in /boot/grub/menu.lst~ if it's still there.

This doesn't work :( I get the error "File System Type Unknown" or something
similar after the root line, and nothing happens.

I can mount the drive as you suggest with the option errors=recover, but after I
unmount it and try and mount it without that option, it fails again.

Windows appears to be unbootable right now. I haven't worked in Windows since it
was working and the only thing I've done on the computer is a dist-upgrade on my
Breezy installation.

Matt

Revision history for this message
Matthew East (mdke) wrote :

Help!?

Windows is still unbootable on my machine, and given that I'm not the only
person who has reported this bug I'm increasing the severity to major: it would
be terrible is this happens to others when Breezy is released.

Matt

Revision history for this message
Paul Sladen (sladen) wrote :

Hello Matthew,

Can you try:

  title Windows chainloader directly
  chainloader (hd0,0)+1

or if that doesn't work:

  title Windows rootnoverify
  rootnoverify (hd0,0)
  chainloader +1

FWIW, "makeactive" shouldn't be needed by anything modern, and causes the
on-disk partition table to be changed.

Revision history for this message
Matthew East (mdke) wrote :

(In reply to comment #12)
> Hello Matthew,

Hi Paul,

Neither work.

> Can you try:
>
> title Windows chainloader directly
> chainloader (hd0,0)+1

Error 13: Invalid or unsupported executable format

> or if that doesn't work:
>
> title Windows rootnoverify
> rootnoverify (hd0,0)
> chainloader +1

This is as before, except without the error message on the partition. It just
goes to a sort of cmd prompt, which looks like this:

GRUB _

But I can't type anything and have to restart the computer.

Hope this helps.

Revision history for this message
Szabolcs Szakacsits (szaka) wrote :

Bug 19000 explains what I think has happened here. And though it talks about
ntfs resizing, the partition start shifting issue is filesystem and even
resizing independent and fairly often happens with any distros using libparted
based partitioners since the end of 2003. The situation was improved last summer
significantly but still not fully fixed. This may be a libparted or a libparted
usage bug.

Revision history for this message
anonym (launch-mailinator) wrote :

Hey

I got the same problem but, I added this which I found above but changed the hd0,0 to hd0,1 because of the dell recovery partition which is under hd0,0. When Windows booted it checked for consistency and did whatever it thought it had to do and worked fine after wards

So editing the menu.lst file does work

title Microsoft Windows
root (hd0,1)
savedefault
makeactive
chainloader +1

Thanks

Colin Watson (cjwatson)
Changed in grub:
assignee: kamion → nobody
Changed in grub:
status: Unconfirmed → Confirmed
Revision history for this message
Daniel C. Axelrod (daxelrod) wrote :

While not a duplicate, the recovery partition accessibility problem is also discussed in Bug 19634.

Revision history for this message
Jimpu2 (grub-n0w) wrote :

you need to fix the ntfs bootsector, which solves this issue ( it did for me at least ). use "fixboot" from the win recovery console, and grub should boot win fine.

Revision history for this message
Alexandre Racine (alexandreracine) wrote : Grub removes boot options when changing kernel version

I don't think this is related to Windows partitions, since I updated the kernel lately to 2.6.22-14 with the update manager and my grub menu was clean fresh. Just like a new install. I did made some modifications to the menu. I moved the Vista option second, added a MEM=3000 to my Ubuntu boot options, but all gone after this update.

Oddly, my nvidia drivers installed with Envy are still working perfectly.

Revision history for this message
Steve Langasek (vorlon) wrote :

Hi Alexandre,

When you update your kernels, the part that runs is update-grub, which has no knowledge of Windows whatsoever. Instead, this is a script that manages the part of your /boot/grub/menu.lst file between the "### BEGIN AUTOMAGIC KERNELS LIST" and "### END DEBIAN AUTOMAGIC KERNELS LIST" markers. If you add a Windows boot entry between these markers, you're absolutely right that it will disappear on a kernel upgrade, and that this has nothing to do with Windows partitions - that's bug #21412 in grub, which has been fixed for Ubuntu 8.04.

Your symptom does not match what has been originally reported in this bug, however, so I have not presumed that this is a duplicate of bug #21412 - it appears to be a real problem with grub loading Windows at boot time, unrelated to problems with menu.lst being overwritten.

Revision history for this message
Alexandre Racine (alexandreracine) wrote :

Thanks Steve for this good explanation. In this case, I created a request in Bug #191738 .

Revision history for this message
millie (minerg-deactivatedaccount) wrote :

I think this may also happen if you abort an NTFS partition resize operation (during installation of Ubuntu), because then the NTFS filesystem becomes dirty and need checking.

Revision history for this message
gcb (gcb0) wrote :

happened to me on 9.10. It was alright until IT update program in windows installed safeboot.

then after the next kernel update in ubuntu, the grub script simply removed the windows entry.

os-prober returns nothing.

I strongly suggest to add a simple backup of the generated grub.conf since important information may be lost on those cases.

an easy patch:
--- grub-mkconfig
@@ -266,6 +266,8 @@
fi

if test "x${grub_cfg}" != "x" ; then
+ # backup previous one
+ cp ${grub_cfg} ${grub_cfg}.backup_`date +%Y%m%d_%s`
  # none of the children aborted with error, install the new grub.cfg
  mv -f ${grub_cfg}.new ${grub_cfg}
fi

Changed in grub (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Vish (vish) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.
Looks like the bug was accidentally marked incomplete by vingslagsvisvidare.

However, You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue for you. Can you try with the latest Ubuntu release? Thanks in advance.

Revision history for this message
Matthew East (mdke) wrote :

I don't have the relevant hardware any more so can't test further. Perhaps some other subscribers to the bug can help.

Revision history for this message
gcb (gcb0) wrote :

can't test either. grub install is not something you do regularly :)

Revision history for this message
Flávio Etrusco (etrusco) wrote :

This bug isn't about installing grub, but simply about starting system with a/the NTFS partition with "dirty" flag. E.g. while running Windows, cut down the AC power. Running ntfsresize also used to set the dirty flag so that the Windows chkdsk would kick in during (Windows) boot.

Revision history for this message
rusivi2 (rusivi2-deactivatedaccount) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in grub (Ubuntu):
status: Incomplete → Invalid
Changed in grub (Baltix):
status: New → Invalid
Revision history for this message
rusivi2 (rusivi2-deactivatedaccount) wrote :

Sorry, should not have marked invalid. It is considered incompletely closed.

Changed in grub (Ubuntu):
status: Invalid → Incomplete
Revision history for this message
rusivi2 (rusivi2-deactivatedaccount) wrote :

Should not have touched this, my apologies.

Changed in grub (Baltix):
status: Invalid → New
Revision history for this message
Thomas Hotz (thotz-deactivatedaccount) wrote :

--- grub-mkconfig
@@ -266,6 +266,8 @@
fi

if test "x${grub_cfg}" != "x" ; then
+ # backup previous one
+ cp ${grub_cfg} ${grub_cfg}.backup_`date +%Y%m%d_%s`
  # none of the children aborted with error, install the new grub.cfg
  mv -f ${grub_cfg}.new ${grub_cfg}
fi

description: updated
Changed in grub (Ubuntu):
status: Incomplete → Confirmed
Rayday (rmcgee775)
Changed in grub (Ubuntu):
assignee: nobody → Rayday (rmcgee775)
Phillip Susi (psusi)
Changed in grub (Ubuntu):
assignee: Rayday (rmcgee775) → nobody
Changed in grub (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Phillip Susi (psusi) wrote :

There isn't really anything that we can do about this. os-prober can't detect Windows if it can't mount the partition. It can't mount the partition if it needs recovery.

affects: grub (Ubuntu) → os-prober (Ubuntu)
Changed in os-prober (Ubuntu):
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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