Thursday, November 11, 2010

WUBI and GRUB Issues

Edit Dec 16: If you're currently having problems with Wubi booting or get a grub rescue prompt when booting, see this post: Wubi Mega-help-thread

Since version 9.10, Ubuntu has used Grub2 as the default bootloader. (I'll refer to Grub2 as Grub, as the previous version is now referred to as grub-legacy. )

Grub stands for GRand Unified Bootloader. And it's so grand that everyone is talking about it. You shouldn't notice a good bootloader or need to know it's name, but once you've turned on your computer and seen the Grub prompt screen, or the optimistically named Grub rescue prompt (which means you're totally messed), it's hard not to take notice.

Let's look at some of the significant Grub problems with Wubi:

Karmic Koala 9.10
Problem: Select Ubuntu after running system updates and the result is a grub prompt.
Reason: The wubildr (Wubi bootloader) file can't address files that are 4GB or more from the start of the partition.
Fix: Users must manually download a new copy of wubildr.
Note: This bug is part of the release, so every new 9.10 install will be affected by this.

Lucid Lynx 10.04
Problem: Many users render their computer unbootable, destroy their Windows partition bootsectors. In some cases Windows can not be repaired and requires a reinstall. Some users inadvertently end up losing all their data through bad repair attempts.
Reason: Running the upgrade to 10.04 or even the standard grub updates asks you to select a device to install grub. It confusingly lists all drives and partitions in a user unfriendly way (/dev/sda, /dev/sda1, /dev/sda2 etc.) and then cautions to 'select all drives if uncertain'.
Fix: If you got the right help, reinstalling the windows bootloader and restoring the partition bootsector was all you needed to do. This worked for most people, but as I mentioned, some were not so fortunate.
Note: the developers didn't even respond to the bug report for about 2 months following the release, despite hundreds of affected users (documented cases, but probably thousands were affected). Even non-wubi dual boot installs were affected.

Lucid Lynx 10.04.1
Problem 1: Many users render their computer unbootable.
Reason 1: A fix for the 10.04 grub issue has been released. For 10.04.1 you cannot overwrite your drive bootloader with a grub update if you have a wubi install. Problem is, the means of identifying a wubi install is buggy - only those who installed to drive 'C:' (or their main windows partition) are safe.
Fix 1: Reinstall windows bootloader.
Note 1: The bug that prevents grub from identifying a wubi install is still present in release 10.10.

Problem 2: After selecting Ubuntu, you see errors listed and either hang, reboot, or end at a grub prompt.
Reason 2: Grub now has the ability to update the wubildr on the fly. Since grub is a rapidly evolving product, it needs to update the wubildr to be compatible with all the changes. Somewhere between updating the modules, the grub menu and the wubildr file things go bad. Exact cause unknown. Only affects installs capable of updating the wubildr (on the same partition as Windows)
Fix 2: Loop mounting the root.disk from a 'Live CD' and manually editing the /boot/grub/grub.cfg file (just leave the parts you need to boot i.e. anything on or after the first line starting with "menuentry". For some reason, after booting and running "sudo update-grub" the problem disappears. [Edit: a subsequent grub update in November, is not permanently fixed by running update-grub. Manual clean up of the /boot/grub directory is required - see later posts for info]

Maverick Meerkat 10.10
Problem: After upgrading from 10.04.1 to 10.10, your computer either hangs, reboots, or drops you at a grub prompt.
Reason: Same reason as for problem 2 on 10.04.1 - for installs to the same partition as Windows, the wubildr file is updated and corrupted.
Fix: Copying the backup wubildr from the c:\ubuntu\winboot directory over c:\wubildr seems to fix it. Or loop mounting the root.disk and manually editing the /boot/grub/grub.cfg file (just leave the parts you need to boot i.e. anything on or after the first  starting with "menuentry".
Note: There is no permanent known fix to this and the bug report has not been addressed by the developers since before the release. (Unlike for the 10.04 bugs, more proactive testing by community members identified the problems, early - but unfortunately once 10.10 was released the developers seem to have lost interest and moved on to Natty Narwhal 11.04).

So what can you do to avoid these problems?
Don't update grub-pc, grub-common or lupin-support packages. Don't play with grub unnecessarily. Don't upgrade to a new release without taking a full backup and having a repair CD handy.
The ultimate prevention is to migrate your Wubi install to a normal partition install.

No comments:

Post a Comment