All for Joomla All for Webmasters

Extract A File From RPM | Step by Step Guide


Extract A File From RPM

RPM is a powerful Package Manager, which can be used to build, install, query, verify, update, and erase individual software packages. A package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.

Sometimes we need a particular file from rpm. To get it, we have to install that rpm. But using this Article, you might not install rpm to get particular file.

By mistake I have deleted /sbin/poweroff file from system. Now we need to find out which rpm contains /sbin/poweroff

# yum whatprovides /sbin/poweroff

systemd-sysvinit-10-2.fc14.1.i686 contains /sbin/poweroff in Fedora 14.

Now, if you try to install that package using yum, we will get “Package systemd-sysvinit-10-2.fc14.1.i686 already installed and latest version”.

To restore /sbin/poweroff, all we need is systemd-sysvinit-10-2.fc14.1.i686.rpm and rpm2cpio, this is bundled with rpm-x.x.x…i386.rpm.

# rpm -ql rpm | grep rpm2cpio

/usr/bin/rpm2cpio

/usr/lib/rpm/rpm2cpio.sh

/usr/share/man/ja/man8/rpm2cpio.8.gz

/usr/share/man/ko/man8/rpm2cpio.8.gz

/usr/share/man/man8/rpm2cpio.8.gz

/usr/share/man/pl/man8/rpm2cpio.8.gz

/usr/share/man/ru/man8/rpm2cpio.8.gz

# rpm2cpio systemd-sysvinit-10-2.fc14.1.i686.rpm | cpio -idmv

# cp sbin/poweroff /sbin/

Note: There is another way to install systemd-sysvinit-10-2.fc14.1.i686.rpm by forcefully installing it.

# rpm -ivh systemd-sysvinit-10-2.fc14.1.i686.rpm –force

Extract A File From RPM | Step by Step Guide

log in

Become a part of our community!

reset password

Back to
log in
Choose A Format
Personality quiz
Trivia quiz
Poll
Story
List
Meme
Video
Audio
Image