Ubuntu – How to restore an accidentally deleted initrd image

kernel

I accidentally deleted the initrd image on my system. How do I restore it?

Best Answer

This is the answer to the original question, how to extract the initrd.lz from the live CD, typically used if you are making a custom live CD.

copy the initrd.lz to a working directory ( ~)

cp /media/cdrom/initrd.lz ~

Make a directory to extract the contents to, I will use initrd, cd into the directory

mkdir ~/initrd
cd ~/initrd

Extract

lzma -dc -S .lz ../initrd.lz | cpio -imvd --no-absolute-filenames

Make any changes you might need, re-package

cd ~/initrd
find . | cpio --quiet --dereference -o -H newc | lzma -7 > ../cusotm.initrd.lz

Your new initrd will be in your home directory and called cusotm.initrd.lz

Related Question