Fixing my PC with initrd

Fucking hell.

So as people might know (hell, I’ve complained about it enough), my main workstation broke down. Removed all of the components from the board and no difference. So it was either the CPU or the motherboard itself. I put all of the parts into another machine and it ran fine.

Well I have work to do and I need Windows for some of it and I don’t have a spare machine good enough to play some of my games, which meant I needed a new motherboard and/or CPU. After some faffing I spotted a tiny burnt out component on the board so I took pot luck and bought a new Socket A motherboard that fitted the bill as closely as I could find at short notice. Seems most people aren’t stocking many Socket A boards these days as everyone is moving on to bigger and better things, but being skint as usual I decided it was better to just buy a replacement board than a replacement machine while I wait for 64 bit support, PCIE and ATI graphics etc to be known to work well together. Not much point in buying a 32 bit machine now when I would have upgraded to 64 bit next year anyway.

So I bought a board with SATA as I need the extra disk channels. I have 3 PATA disks, one for Windows which needs to go on hda, my Linux system disk which needs to go on the SATA controller as my other disk, my enormous Linux /home doesn’t work with the SATA converter I have and so needs to go on hdb. I also have 2 optical drives which of course need to go on the other PATA channel.

So, I install Windows and I boot from a live CD to alter the grub and /etc/fstab settings accordingly. All works fine. Nice boot menu, Windows boots fine. Try to boot Linux. Umm. No. pivot_root error and can’t find initrd. Shit. But it works fine on hda. Try all possible permutations of disks and controllers, but one always fails.

So I post to Wolves LUG mailing list about whether I will be attending the meeting and say I won’t as I’ve been fixing my PC and I need to get it up and running but the SATA controller is being an arse and Linux can’t boot from it. Dave Goodwin pops up and offers some advice. I follow through and explain what I have done so far and he says do this:

You should just need to do the following to “fix” your problem :

Edit /etc/mkinitrd/modules and add in the sata modules necessary for your card, as well as probably scsi_mod and sd_mod. (Just list the modules, one per line).

Then, try running :

mkinitrd -o /boot/mkinitrd.img.custom `uname -r`

(Where the output of `uname -r` looks pretty like 2.6.10-5-K7.

Edit /boot/grub/menu.lst (or edit it at bootup) and get it to use your new custom image, and cross your fingers 🙂

And it worked. Gawd bless him. I’m so grateful to him for picking this up. I was expecting to spend the rest of my days swapping disks over to do any work. It took me a week of testing and diagnosing to get this far and probably 3 weeks before that of working out where the problem lay and getting a spare machine to work on.

Life can now continue, but what a ball ache.