Monday, April 9, 2012

Extract File from RPM

I failed to extract /etc/hue/ from hue-common- because cpio prints out garbage data with something like this
[bewang@pmaster tmp]$ rpm2cpio hue-common- | cpio -idvm ./etc/hue/
cpio: warning: skipped 10263 bytes of junk
cpio: warning: archive header has reverse byte-order
cpio: premature end of file
It turns out that rpm2cpio outputs compressed data after googling this issue. I have to do like this:
rpm2cpio hue-common- | xz -d | cpio -idvm ./etc/hue/


  1. Thanks for this.

    For those that don't have xz installed on their system, there is a java implementation and other downloadable files here:

  2. Where does the file is extracted?

    Im running it this way but not sure where the extrated file will stay:

    rpm2cpio kernel-uek-debuginfo-3.8.13-98.el6uek.x86_64.rpm |xz -d| cpio -idvm /usr/lib/debug/lib/modules/3.8.13-98.el6uek.x86_64/vmlinux