More on the GRUB bug (with mixed PATA and SATA drives)

Published: | by Julian Knight Reading time ~3 min.
📖 Posts | 📎 Hardware, Linux | 🔖 grub, hard drives, pata, sata

I’ve mentioned this one a couple of times so I’ll give a bit more detail because it is a nightmare to solve if you don’t know what is going on. If you have both a parallel ATA (PATA, this is the way most hard drives were connected on desktops and laptops until around 18 months ago) and a serial ATA (SATA) hard disk controller on your PC (as many do) and hard drives connected to both controllers, you are going to get hit by the GRUB PATA/SATA bug. When you boot from a CD/DVD drive (generally connected to the PATA controller) to install Linux, GRUB will see your hard drives in a specific order. It lists them as (hd0,0) etc. and this numbering is mapped onto the actual devices (e.g. /dev/hda for PATA or /dev/sda for SATA) using a mapping file in the grub folder. The problem is that when you re-boot from a hard drive rather than the removable drive, it is likely that the order of the drives will change and GRUB can’t currently handle this. You have a couple of choices now. You could install openSUSE 10.3 which treats all drives as though they were SCSI (e.g. /dev/sda etc.), no problems there. If you want to use another distro though (e.g. Ubuntu), try this: After installation from CD/DVD, reboot without the CD/DVD and see if GRUB works. If it fails to find the boot loader, you can edit the grub menu manually from within GRUB itself, see the documentation for details. Now you can play with the default drive (the “root (hd0,0)” bit) until you find the right one. Hint: you can type “(hd” and press tab to get a valid list of drives and partitions. Once you have found the correct drive to use you can now boot normally. Next, find the location of the grub install files (should be in /boot/grub). As root, edit the file and reset the device map to how the devices look when you are NOT booted from a CD – you should be able to work this out from your currently mounted devices. Alternatively, edit the GRUB menu.list file to correct the “root” statements to the correct drives. Yes, it’s a mess and has been that way for at least two years. I first noticed it when Knoppix (the first of the really good live distros) stopped working on my desktop PC though I didn’t know what the problem was then. Here are some links to more information: * * * While I’m at it, here are some quick instructions for rebuilding GRUB: 1. sudo -i (or su) 2. grub (runs grub shell) 3. find /boot/grub/stage1 (if it doesnt work, try without /boot) => should return installation drive, e.g. (hdx,y) 4. root (hdx,y) 5. setup (hd0) (for installation on MBR of disk 0. Alt: (hdx,y) to install on boot partition, etc.) 6. quit On Ubuntu, try update-grub to rebuild grub menu and reinstall

On all distros, grub-install /dev/hdx

comments powered by Disqus