From the RPM Package Manager (RPM) tool, we retrieve the “cpio” archive. You may retrieve an RPM document using the following technique: The .rpm file is first converted into a “cpio” archive on conventional output using the rpm2cpio tool. An rpm flow is read from regular if the -option is provided.
Let’s begin by putting this article into practice using the Ubuntu 20.04 Linux distribution. But before that, you need to update your Linux system as soon as possible to avoid any inconvenience caused by missing tools or packages or some uninstalled updates. For this, you need to launch the system’s console application, usually named “terminal” for the Ubuntu 20.04 Linux operating system. You can try out Ubuntu’s shortcut to open the shell, i.e., “Ctrl+Alt+T.” Another way to open the terminal shell is the use of the “Activity” option held at the top of the Ubuntu desktop. Tap on that option and it will open the search bar for you. Write the name of an application to be searched, i.e., “terminal” and tap enter. The terminal application would pop up on your search screen.
After successfully opening the shell terminal application, you will see the purple query screen. We need to use the apt package to update our system. The update command has been shown in the below image with the use of sudo rights to avoid any problems in its processing. The system will be updated in a few seconds if there are not many packages held to be updated. The result as well as the required instructions are shown in the image below.
Before using the “rpm2cpio” instruction in the shell to extract any rpm file, you need to make sure that it is already configured at your end. If not, we will be showing you the way how to install and configure it on your system. Firstly, you need to add the “universe” repository to your Ubuntu 20.04 Linux operating system. For this, try our add-apt-repository command with sudo rights followed by the keyword “universe”. The execution of this instruction at our end shows the output, demonstrating that the “universe” component is already enabled here. The result as well as the required instructions are shown in the image below.
As mentioned before, the alien package must be utilized to transform the rpm packages to “.deb” archives. We must have alien installed and configured. Right now, our system lacks this utility. Thus, we need to install it using the installation command in the terminal shell of the Ubuntu 20.04 Linux operating system. The instructions for its installation would be very similar to those as we often use for other utility installations. Use the “apt” package within the installation command with sudo rights followed by the keyword “alien”. After pressing the Enter key to execute this command, it may ask for your user account passcode. Write your password, and press Enter to continue it. The processing for this instruction has been shown in the image below.
While processing, the system may ask you the question “Do you want to continue?” to verify that you need to install the “alien” package for some unseen reasons. You have to press “Y” to maintain this installation process as shown below.
The installation and configuration of universe and alien packages must have installed rpm on our system. You can try out the version instruction at the shell with the keyword “rpm” to see its installed version. You can see that our system has the 4.14.2.1 version of RPM installed successfully. The result as well as the required instructions are shown in the image below.
You must have some “rpm” file downloaded on your Ubuntu 20.04 system to retrieve its data, as we have “test.rpm” in the current working directory “home” of the Ubuntu 20.04 system.
It’s time to use the rpm2cpio instruction on the shell to extract this “test.rpm” file within the current working directory by converting it to the cpio archive. For this, we have been utilizing this instruction in two ways, i.e., with a simple file name and with “- <” characters followed by the filename. Unfortunately, both these ways don't work for us. The result as well as the required instructions are shown in the image below.
The correct method to extract is to create a cpio archive for the “test. rpm” file using the below instructions. The rpm2cpio instruction has been followed by the file name “|” character to separate the “cpio –idmv” from the rest. The shown output has listed the files and folders within this archive named “usr” within the current working directory “home”. The use of this command shows that it contains a total of 1401 blocks in it. The result as well as the required instructions are shown in the image below.
The utilization of the list “ls” instruction in the shell has been showing the “usr” cpio extracted folder in the “home” directory of our system. The result as well as the required instructions are shown in the image below.
Conclusion:
This article is all about the use of the rpm2cpio instruction to extract some rpm files on the Ubuntu 20.04 system. For this, we have discussed the installation of some required packages like universe and alien. After this, we have discussed the use of the cpio archive to extract the particular rpm file.