Saturday, September 19, 2009

GRUB Error 17

Almost exactly a year earlier, I had been wrestling with Error 17 in the GRUB bootloader in Ubuntu, and now it was back. (Back then, I had been running Ubuntu 8.04; now I was running 9.04.) One difference: back then, it seemed to have been accompanied by additional information, but this time I was only getting the bald "Error 17" report, with no other text. I didn't know why I was getting this error. I hadn't changed anything. All I could imagine (based on a HowToGeek article) was that possibly I had installed some Windows XP security updates since my previous reboot, and maybe one of them had messed up GRUB. Following the advice in that HowToGeek article, I rebooted with the Ubuntu 9.04 Live CD. In Terminal (i.e., Ubuntu's Applications > Accessories > Terminal), I typed "sudo grub" to get into the GRUB prompt. The instructions assumed that I had installed GRUB into the first partition on the first hard drive (i.e., hd0,0). I wasn't sure if that was correct, and I wasn't sure how to find out. The notes from my previous year's go-round (above) seemed to say that I could use "find /boot/grub/stage1" for this purpose. But it seemed likely that, from the Live CD, that would just tell me where GRUB's Stage 1 files were (or something like that) on the CD, not on the hard drive. It seemed that I would have to gain access to the Ubuntu boot partition in order for that command to work. So I started with Nautilus (i.e., Ubuntu's Places > Computer menu pick, which opens up the Nautilus program that Ubuntu calls File Browser). There, I saw icons for my various partitions, including one labeled "Mass Storage Drive." When I double-clicked on that, I got "Unable to mount location. Can't mount drive." Ah, so this suggested a different theory. Maybe GRUB wasn't damaged after all. Maybe the problem was that the boot drive was screwed up. To learn more about that, I went into GParted (i.e., System > Administration > Partition Editor) and looked at my partitions. And this was truly remarkable. In place of the Ubuntu and WinXP partitions that I had installed on my first hard drive, there was now . . . nothing! The Ubuntu and WinXP partitions were completely gone, wiped out. Instead, I just had a disk consisting of one big unallocated space. Well, that would certainly explain why there was no GRUB boot menu. How could that happen? I tried a Google search, but that didn't point out any obvious explanations. I tried to recall what had happened when I shut down the machine the previous day. But there didn't seem to have been anything remarkable. Nothing stood out in my mind particularly. I would usually shut down that computer at night, but maybe this time I had left it running, and some mysterious virus had done this overnight? I wasn't sure. So, OK, it was time to start over. Fortunately, I had made Acronis True Image 11 backups of the program partitions onto another drive, so I rebooted from the Acronis CD and restored those. But then - what's this? The WinXP backup was there, but it looked like I had not done an Ubuntu backup. This was possibly because the Ubuntu installation on that machine had given me endless problems; apparently I had intended to start over. So, OK, that's exactly what I did. Not at this point - for now, I had a hard drive with only Windows XP installed - but later. Unfortunately, this did not solve the problem. Even with the Ubuntu partition completely gone, I still got GRUB Error 17 when I rebooted. GParted on the Live CD was telling me that no, I actually had not succeeded in restoring WinXP to that empty drive just now, despite the opinion of Acronis to the contrary. I rebooted with the WinXP installation CD, and it concurred: there was no Windows installation. I tried again with Acronis, this time trying to restore only the program partition, not the MBR. Also, this time I indicated that the restored partition was a primary partition, not active, as I had done on the previous try. While I was still in Acronis, I checked, and sure enough, the drive did now definitely have a Windows XP partition as its only formatted partition. I rebooted, and this time XP ran normally. No more Ubuntu (until I got around to reinstalling it); no more GRUB Error 17.