So there I was, installing Ubuntu 9.04 on a machine that already had Windows on it, and GRUB greeted me with Error 17 instead of a boot menu. If you hit the same wall, here is what is actually going on and how to get out of it — first with the original 2009 fix, then with what you should do on a modern system.
What Error 17 actually meant
GRUB legacy (0.9x) numbered its errors, and Error 17 was “Cannot mount selected partition”: the stage-2 loader asked the BIOS for a (hdX,Y) partition and the filesystem on it wasn’t one GRUB knew how to read — typically because the partition table shifted underneath it. In my case the culprit was a USB hard disk plugged in during installation: the installer wrote GRUB against (hd1) or a shifted device map, and on the next boot the stage-1 code pointed at a partition that no longer existed at that BIOS disk number. The one-line preventive fix is still valid: unplug every USB disk before installing a Linux distro.
The 2009 fix, kept for old machines
If you are genuinely maintaining a machine that still boots GRUB legacy (or you’re restoring one), the recovery recipe from the live CD works exactly as it did:
Boot the distro’s CD as a live CD and open a terminal, then enter the GRUB shell:
sudo grub
At the grub> prompt, locate where the stage files live:
find /boot/grub/stage1
This returns a location — say (hd0,1). Whatever it returns, use that exact value in the next command:
root (hd0,1)
Then install GRUB to the MBR of the disk (not the partition):
setup (hd0)
quit
And to chain-load Windows’ own boot manager instead (assuming Windows is on the first partition of the first disk):
grub> rootnoverify (hd0,0)
grub> makeactive
grub> chainloader +1
grub> boot
2026: you almost certainly have GRUB 2, not GRUB legacy
Every mainstream distro has shipped GRUB 2 for over a decade — Ubuntu since 9.10, the very release that followed the one I was installing here. GRUB 2 dropped the numbered errors, so there is no “Error 17” anymore; a broken install lands you at a grub rescue> prompt instead. The recovery procedure is different:
- Don’t chase the
sudo grubrecipe above on a GRUB 2 machine — the command doesn’t exist there. Reinstall the bootloader from the live environment withgrub-install(e.g.sudo grub-install /dev/sda && sudo update-grubafter chrooting in), or just let a repair tool do it. - Ubuntu’s own answer is the Boot-Repair utility: boot the live CD, install it, click “Recommended repair”. It handles the Windows dual-boot chainloading for you.
- The same prevention applies, more so than ever: USB disks still get enumerated before SATA on some boards, and a bootloader written against the wrong disk number is still the classic self-inflicted wound.
The lesson from 2009 hasn’t expired, only the error code did: know which disk your bootloader is being written to, and keep the extra disks out of the machine until the installer is done.