Thursday, May 30, 2013

[solved] Extracting initramfs / initrd img fails with message "gzip: /boot/initramfs-*.img: not in gzip format"

when trying to extract initramfs using the old method (gzip) in fedora 19 (f19), fails with the following error message.

# cd `mktemp -d` && gzip -dc /boot/initramfs-fedup.img | cpio -ivd

gzip: /boot/initramfs-fedup.img: not in gzip format
cpio: premature end of archive

This is because in f19, initramfs format has been changed from gz to xz.

# file /boot/initramfs-fedup.img
/boot/initramfs-fedup.img: XZ compressed data
The solution:

cd `mktemp -d` && xz -dc /boot/initramfs-fedup.img | cpio -ivd

Change gz to xz .. :)