Tuesday, September 28, 2010

Windows XP & Ubuntu RAID 0 Dual Boot: Error: No Such Device

I had set up a dual-boot system with Ubuntu 10.04 on a two-drive RAID 0 array and Windows XP SP3 running from a third hard drive.  I replaced the WinXP drive with a different one, copying the files over from the old drive's partitions to the new one, and rebooted.  When I selected the Windows XP option in the GRUB2 boot menu, I got an error message:

error: no such device: [apparently a UUID number]
error: invalid signature.
Press any key to continue...
As described in comment 90, within a long thread on this Ubuntu bug, with an alternate approach in another post, the solution to this problem was said to involve editing grub-mkconfig_lib.  Since I was able to get into Ubuntu (though not Windows), I took the approach described in comment 90.  In Ubuntu, in Terminal, I typed these commands:
sudo apt-get update
sudo apt-get install grub-common
The first command ended with errors along the lines of "could not connect to archive.getdeb.net."  This turned out to be an indication that the getdeb repository was down.  I repaired it by editing sources.list to refer to a mirror site instead.  Next, I typed this:
sudo gedit /usr/lib/grub/grub-mkconfig_lib
and changed gedit's Edit > Preferences to show line numbers.  I went down to line 174, ready to insert a # sign before whatever was on that line.  But it was just "fi" which, I thought, marke the end of an "if" statement.  What they wanted me to add did not look like it belonged there.  The long thread had not been visited for nearly four months; I suspected the file had been changed in a bid to fix the problem.

I got that error in the first place, as noted above, not because of an obvious malfunction in GRUB2, but because I had moved the partition containing the Windows XP program files.  I heard that just typing "sudo update-grub" would cause GRUB2 to search for operating systems.  And it did:  in the process of "Generating grub.cfg," it reported that it found Windows XP on /dev/sdc1.  I wondered if that would fix the problem by itself, so I rebooted and selected the Windows option again from the GRUB menu.  And that was it.  Problem solved!