Rpm2cpio why we use it vs dnf for RPMs?

I’ve notice a lot of solution regarding external RPMs is to use the rpm2cpio function rather than dnf.

So just curious what the function actually does, and what exactly is cpio. Is it the package for ClearLinux?

A quick pro/con list from my perspective:


  • pros: download & extract, simple.
  • cons: updates and removal are manual


  • pros: can do updates/removal
  • cons: have to setup rpmdb and initialize repos
  • cons: must ignore rpm dependencies on every install

You could elaborate on all these points in detail, but I think it’s good to show a short overview first.


RPM’s are containers like zip files with metadata/dependencies. The files are in a cpio container. the rpm2cpio container discards the metadata and extracts the cpio out of it.

I like rpm2cpio because I can inspect what are the files/directories modified by the package.

And sometimes it’s best to do so because packages built for other distros may install files to non-conventional directories. For example, instead of installing libraries to /usr/lib64 or /usr/lib, it might install them to /usr/lib/x86_64. This is not critical, but it’s not elegant.

Or I can even extract the cpio, move everything in ./usr to ./usr/local, then generate the cpio and install the package. In this way, I can have control on where it’s installed.