# Help exteracting initramfs

## l88

Hello, 

I need help, i'm trying to extract an initramfs file from gentoo but no joy till now. 

the initramfs file is 

/boot/initramfs-genkernel-x86-3.10.17-gentoo

and I tried zcat command, gunzip with | cpio -i and everytime i get this error message 

gzip: ../initramfs-genkernel-x86-3.10.17-gentoo: not in gzip format

cpio: premature end of archive

does anyone know how to extract the initramfs file i have here?? I need to get some part of the script in the init 

Thanks,

Badar

----------

## szatox

`file <path to initramfs image>` is your friend.

Genkernel uses xz compression

----------

## l88

 *szatox wrote:*   

> `file <path to initramfs image>` is your friend.
> 
> Genkernel uses xz compression

 

I tried that earlier 

but it's still not doing it for me -- am i doing something wrong

root~: /boot/initram# xz --decompress ../initramfs-genkernel-x86-3.10.17-gentoo 

xz: ../initramfs-genkernel-x86-3.10.17-gentoo: Filename has an unknown suffix, skipping

----------

## frostschutz

try piping

```

mkdir /tmp/initramfs

cd /tmp/initramfs

unxz < /path/to/initramfsfile | cpio -i -d -H newc --no-absolute-filenames

```

if it's not xz after all (verify with 'file initramfsfile') use gunzip, bunzip2, etc. etc. instead

----------

## kurisu

Try:

```
xzcat /path/to/initramfs/image > initramfs.cpio
```

Never had any issues this way.

----------

## l88

thanks all for your help 

I've managed to extract the initramfs content by doing the following

unxz < /path/initramfs-genkernel-x86-3.10.17-gentoo | cpio -i -d -H newc --no-absolute-filenames

----------

