Comment 0 for bug 226622

JP Vossen (jp-jpsdomain) wrote :

When using Ubuntu (Hardy) under wubi, if the NTFS dirty flag is set, the error message is missing or confusing.

This situation can and will occur when you restart and are not paying attention, so you miss the NT Boot loader prompt and start booting Windows, then hard-power-off to save time (can you guess how I know this?), or if/when Windows crashes. I bet this is going to be a really F.A.Q. with Wubi.

To reproduce:
1) Either shut Windows down ungracefully, or let it start half-way up, then hard-power-off to kill it
2) Reboot and attempt to go into Ubuntu

Case 1: default startup: You end up at a completely useless and scary BusyBox/(initramfs) prompt with no indication why you are there or what to do about it.
Case 2: recovery mode (verbose) startup: You still end up at a completely useless and scary BusyBox/(initramfs) prompt, but there are log lines on the screen as follows. But they are scary and confusing ("mount: ... failed: Success"? WTH?):

----- cut here (very top of my screen) -----
$LogFile indicates unclean shutdown (0, 0)
Failed to mount '/dev/sda2/: Operation not supported
Mount is denied because NTFS is marked to be in use. Choose one action:

Choice 1: If you have Windows then disconnect the external devices by
 clicking on the 'Safely Remove Hardware' icon in the Windows
 taskbar then shutdown Windows cleanly.

Choice 2: If you don't have Windows then you can use the 'force' option for
 your own responsibility. For example type on the command line:
     mount -t ntfs-3g /dev/sda2 /root -o force

    Or add the option to the relevant row in the /etc/fstab file:
     /dev/sdc1 /mnt/external/ ntfs-3g defaults,force 0 0

mount: Mounting /dev/disk/by_uuid/... on /root failed: Success
mount: Mounting /root on /host failed: invalid argument
ALERT! /host/ubuntu/disks/root.disk does not exist. Dropping to a shell!

BusyBox v1.1.3 ... (ash)
Enter 'help' ....

(initramfs)
----- cut here -----

While it kind of gives clues if you think about it and don't panic, it's not all that relevant. It's also not even there if you are booting in the default quiet/splash screen mode (I understand the reasons for that default, but I think it's a bad idea as it masks stuff like this).

Possible Solutions

1) Insert some kind of shim program at some earlier point in the boot process (if possible) that detects the NTFS dirty flag (see http://www.google.com/search?q=ntfs+%22dirty+flag%22) and bounce out the of the quiet/splash screen to provide a *useful and non-scary* error message.

2) Edit the text of the error already provided (shown above) to be more useful and less scary. This solution is less ideal because it still requires the user not to panic, to reboot, and to think of hitting ESC and choosing recovery mode before getting help. Solution 1 or something that Just Does The Right Thing is preferred.

Possible text for the error message:
----- cut here -----
Ubuntu can't boot because the Windows NTFS file-system's "dirty flag" is set. That usually means the Windows either crashed or failed to start completely. (You didn't turn Windows off in the middle of starting up or shutting down, did you?)

To fix this, simply reboot into Windows, let it fully start, log in, ideally run a "Check Disk" (see http://support.microsoft.com/kb/315265), then gracefully shut down. Once you restart, Ubuntu should be able to use the NTFS partition and boot normally.
----- cut here -----

See also:
 https://bugs.launchpad.net/ubuntu/+source/qtparted/+bug/57580