How can I repair a missing (or corrupted) initrd?

Somehow my initrd broke (read: disappeared) while installing some critical updates on my OESsp2 server. Not sure how, and I’m not sure I care, but it ticked me off. The system will not boot without an initrd! Arg!

Anyway, while researching, I found a great write up by Sander van Vugt, that I used for reference. For brevity, I’ve written an adaptation of the required steps below. This really applies to any Linux distro (as long as it uses an initrd), mine just happened to be an OESsp2 Linux server.

Boot the system using a “Live” Linux cd or something. Any distro will do, as long as you can mount the filesystems. For instance, you can’t use an old Suse 9.1 Live disk that you have lying around if you happen to have some Reiser filesystems (9.1 did not include Reiser).. believe me, I know… 😉 I ended up using the current (at the time of this writing) Opensuse 11 beta that worked great, since it boots “live”.

Once booted up, mount all the real disk partitions under a fake root. I’m using /media/disk as my fake root (you can use something different, just make sure to change it throughout all the references below). You may or may not have multiple partitions, just be careful to be accurate. Here’s my example of what I did:
mount /dev/cciss/c0d0p6 /media/disk
mount /dev/cciss/c0d0p1 /media/disk/boot
mount /dev/cciss/c0d0p5 /media/disk/var

Duplicate the proc and dev environments:
mount -t proc none /media/disk/proc
mount -o bind /dev /media/disk/dev

Set your root environment (because mkinitrd really prefers to run at its own root):
chroot /media/disk

Fnally, actually fix the initrd with the following command:

Now reboot. Done!


Leave a Comment

Your email address will not be published. Required fields are marked *