Gparted should return "1 Cancel" when its operation fails

Bug #46961 reported by Billy Charlton
10
Affects Status Importance Assigned to Milestone
gparted (Ubuntu)
Fix Released
Medium
Colin Watson

Bug Description

Gparted should return "1 Cancel" from the "apply" command when one of its operations fails.

Specifically, I have tried to resize an NTFS partition through ubiquity (which embeds gparted for manual partitioning), and when this operation fails, gparted does not emit a cancel/error code.

Full description (pasted from bug 45543) below:

-----------

Ok I'll try and explain exactly what I'm seeing. I think it boils down to this: if my NTFS partition is not "clean", the resize fails but the installer continues. If I run checkdisk from inside Windows, and then run the installer, the whole procedure works flawlessly. But I (and I'm sure others as well) frequently seem to have NTFS partitions that are not unmounted cleanly for whatever reason. In this case I think the installer should probably halt.

So here's what I did:

1) I choose manual partitioning, and it shows me the partition layout of my disk. I've attached resize-results.zip, which contains file "fdisk.original" which is the output of fdisk -l /dev/hda, which you can examine to see the makeup yourself -- a big hda1, a 3.5Gb hda2, then lots of freespace.

2) I right-click hda2 and choose resize. I shrink it to 1.5Gb using the slider. Then I select the freespace, choose "new" and create an ext3 partition that will become my root partition.

3) After I click "Next", it warns me that it's about to resize, I say OK, and it shows a dialog and goes through steps 1 and 2: resizing hda2 and then creating the new hda3 for root.

4) When the mount points screen appears, it still shows that hda2 is 3.5Gb. The resize of NTFS failed, but the installer continued to the next screen as if it had succeeded. I think at this point it should have halted and told me to go run checkdisk in Windows (or something), right? In resize-results.zip there is also a file "fdisk.after-resize" which shows that the hda2 partition has not in fact been resized at all.

The resize-results.zip also contains the installer log, which contains line "gparted replied: - FORMAT /dev/hda4 ext3" even though the previous resize operation failed. I don't see a line stating that the resize failed, btw. But it did. :-)

Revision history for this message
Billy Charlton (billy) wrote : syslog and resize results

zip file containing fdisk output before and after resize operation, and ubiquity installer log.

Revision history for this message
Billy Charlton (billy) wrote : Yikes.

Attachment "results-2.zip" includes fdisk before/after results along with the installer log.

This time I tested the case where the NTFS partition hda3 is not adjacent to any freespace and needs to be resized to make room for a root filesystem on hda4. In this case, when the NTFS partition resize fails, the partition hda4 does get newly created and is listed in the fdisk results -- as a zero-byte partition on cylinder 9730, even though the disk only has 9729 cylinders! Yikes. The user was expecting hda4 to hold the root fielsystem.

When the failed resize partition step completes, ubiquity goes to the mount-point screen, with hda5 selected for the root partition and to be fully reformatted -- both of which are incorrect (and possibly dangerous since user wasn't expecting to touch hda5 at all).

This seems like more than just a confusion for the user.

Revision history for this message
Billy Charlton (billy) wrote : Results 2

Second attempt at resizing an NTFS partition, this time without adjacent freespace.

Revision history for this message
Billy Charlton (billy) wrote : Drat -- data loss.

Uh-oh, it looks like this actually hosed the NTFS partition... I can't boot it anymore. This was the same problem I had originally, documented with bug 45543.

These tests are all with the 6.06 RC cd -- I can try later this weekend with the daily live CD to see if latest updates to ubiquity fix this problem.

I also figured out how to consistently reproduce the resizing problem that eventually causes this problem. I am installing a clean Win2k each time into a new partition (from the Win2k install CD). After the Windows text-mode install process reboots the first time and starts the GUI installer, I hit the reboot button and pop the Ubuntu live CD in. This leaves the NTFS partition in an inconsistent state (since it didn't shut down cleanly). Then any attempt to resize it leads to this problem. I don't have the data loss problems when resizing a clean, checkdisk'ed NTFS partition.

Revision history for this message
Billy Charlton (billy) wrote : Still there on May 29th CD

Just tested with May 29th CD. Installer crashed, NTFS resize failed, Windows unbootable.

No change. :-(

This will be a release-holding bug, right?

Revision history for this message
Colin Watson (cjwatson) wrote :

Just out of interest, did gparted display an error that it failed to resize the NTFS filesystem? I can reproduce this problem here, but only with an error displayed by gparted (and yes, it does then go on to damage the NTFS filesystem).

Revision history for this message
Colin Watson (cjwatson) wrote :

I think this should fix it, but I'd appreciate confirmation. At least, it ought to fix it for anyone who actually gets an error from gparted when the resize fails. If gparted doesn't even notice at all that the resize fails, then there is a much deeper problem ...

gparted (0.1-0ubuntu9) dapper; urgency=low

  * debian/patches/safe-apply-operations.patch: If an operation fails to
    apply, cancel immediately rather than blundering on and potentially
    letting later actions in the operations list damage existing filesystems
    (closes: Malone #46961).

 -- Colin Watson <email address hidden> Tue, 30 May 2006 13:01:14 +0100

Revision history for this message
Billy Charlton (billy) wrote :

Cool, downloading the latest CD now, and will try it in the a.m. Thanks a ton for your diligence on trying to fix this before release... but, I don't think gparted has been emitting error codes in most of my tests so I don't know if the latest patch will help.

Not to be alarmist... ;-) but I'm sure you share my concern that this could be a data-destroying bug in the final release (even if infrequent) and I don't want 6.06 to have any bad press.

p.s. This bug is still marked "unconfirmed" and severity "normal", is that still your assessment? Seems confirmed and major show-stopper to me.

Revision history for this message
Colin Watson (cjwatson) wrote :

Well, the problem is that I cannot reproduce any situation where gparted doesn't resize properly and fails to show an error ...

Revision history for this message
Billy Charlton (billy) wrote : Got the error dialog!

I can finally report some good news. Now every time I try (using the latest CD), I get the attached error dialog. The dialog is blank and doesn't have any GUI buttons, but if I close it from the title bar, ubiquity takes me back to the manual partition screen *and* my hard disk isn't hosed. Hooray!

I suggest that a simple message and "Ok" button be put in the error dialog -- maybe something about "the operation failed, perhaps you need to run checkdisk on existing partitions before attempting manual partitioning".

But honestly, as long as it doesn't erase data I couldn't care less about the error dialog :-D

Thanks again for your diligence on this. I think I'm good now -- and I hope no one else can reproduce this error anymore either.

Cheers

Revision history for this message
Billy Charlton (billy) wrote : Re: [Bug 46961] Re: Gparted should return "1 Cancel" when its operation fails

I can finally report some good news. Now every time I try (using the
latest CD), I get the attached error dialog. The dialog is blank and
doesn't have any GUI buttons, but if I close it from the title bar,
ubiquity takes me back to the manual partition screen *and* my hard disk
isn't hosed. Hooray!

I suggest that a simple message and "Ok" button be put in the error
dialog -- maybe something about "the operation failed, perhaps you need
to run checkdisk on existing partitions before attempting manual
partitioning".

But honestly, as long as it doesn't erase data I couldn't care less
about the error dialog :-D

Thanks again for your diligence on this. I think I'm good now -- and I
hope no one else can reproduce this error anymore either.

Cheers

Colin Watson wrote:
> Well, the problem is that I cannot reproduce any situation where gparted
> doesn't resize properly and fails to show an error ...
>
>

Revision history for this message
Colin Watson (cjwatson) wrote :

Thanks for re-testing! This is very good news. I've filed bug 47876 about the empty error dialog.

Changed in gparted:
assignee: nobody → kamion
status: Unconfirmed → Fix Released
Revision history for this message
Colin Watson (cjwatson) wrote :

Also, I'm indebted to you for discovering this and hassling me until I managed to reproduce it locally. :-)

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.