How do I rebuild the initrd?

Aaron Konstam akonstam at sbcglobal.net
Fri Jul 13 14:00:51 UTC 2007


On Fri, 2007-07-13 at 01:10 -0400, Tom Diehl wrote:
> On Wed, 11 Jul 2007, Aaron Konstam wrote:
> 
> > On Wed, 2007-07-11 at 01:16 -0400, Tom Diehl wrote:
> >> Hi,
> >>
> >> I need to know if anyone has the magic incantation to get mkinitrd to build a
> >> proper initrd from either rescue mode or the live cd. I need to put a drive
> >> into another box that has a different disk controller in it.
> >>
> >> If I boot into rescue mode and setup a chroot, when I run mkinitrd I get
> >> an error that says "error opening /sys/block: No such file or directory.
> > Do you have a /sys directory on your installation. It is one of those
> > pseudo directories like /proc. If not mkdir /sys might be worth doing.
> 
> Actually I tried mounting both /proc and /sys inside the chroot. They mounted
> OK and the errors went away but the mkinitrd still produced an initrd that
> would not boot. :-(
> 
> I finally ended up cheating. I fired up the Live cd and mounted all of the
> system partitions. Then, I setup a chroot and did an rpm -e kernel*
> 
> I then rebooted into Anaconda and told it to upgrade the system to F7. Since
> the machine was already an F7 box it simply reinstalled a kernel and updated
> the initrd. When I rebooted the machines came up normally. :-)))))
> 
> I realize this is kind of a convoluted way to get the machines going again but
> it worked.
> 
> I would still like to know how to rebuild the initrd but so far no one knows.
> It must be some super secret incantation. I suppose if I understood python I
> could read the anaconda src and see how they do it but alas I do not speak
> python. :-(
> 
> For the record, there were 2 machines involved in this, one was F7 and the
> other was Centos 5. I used the procedure above to recover both of them
> without reinstalling.
> 
> Hope this info helps someone else.
> 
At the risk of causing ire, running mkinitrd is rather straightforward
and is described adequately in the man page. I have done it many times.
Maybe if you posted the mkinitrd line you executed we could help
further.

-- 
Aaron Konstam <akonstam at sbcglobal.net>




More information about the fedora-list mailing list