Changing initrd contents and grub

Phil Meyer pmeyer at themeyerfarm.com
Mon Jun 23 16:39:35 UTC 2008


Richard Michael wrote:
> Hello list,
>
> I've changed my RAID and LVM configuration and need to modify the
> respective commands in the /init of my initrd.
>
> I made those changes by decompressing and extracting the cpio archive,
> editting the init script (add a couple lines for mdadm, changed the
> activated volume group name), rebuilt a cpio archive (using the correct
> "-c"/"-H newc" SVR4 format) and fed it back through gzip (max
> compression), then I just moved aside the old initrd, replacing it with
> my new one:
>
> mkdir /boot/tmp
> cd !$
> gzip -dc ../initrd-<version> | cpio -id
> vi init
> find . -depth -print | cpio -oc | gzip -9 > ../initrd-<version>.new 
> cd ..
> mv initrd-<version> initrd-<version>.orig
> mv initrd-<version>.new initrd-<version>
>
> The kernel now panics (paraphrase) "can't find /init".
>
> It does not do this if I restore the original initrd.
>
> I have not changed the name of the initrd, filenames match grub.conf and
> grub's boot menu, etc.  I have done this type of modification
> successfully in the past, but only changing a single character in /init.
>   

Just a thought here, since I have also tried this several times with 
limited success:

The whole point of mkinitrd is to avoid these 'by hand' operations.

After you make your changes, run mkinitrd to generate a new initrd.  It 
will pick up changes in /etc/modprobe.conf and /etc/fstab and try to do 
the right thing.  Besides that, mkinitrd will accept arguments that 
allow additional drivers to be loaded, with arguments if needed, as well 
as many other options.

I am pretty sure that a modern mkinitrd will make almost all need for 
manual edits of an initrd image unnecessary.

Good luck!




More information about the users mailing list