Notes on converting from RPM to DPKG

Some notes on making the transition from RPM (RedHat Package Manager, e.g. SuSE) to DPKG (Debian PacKaGe, e.g. Ubuntu).

Package status

rpm -q package_name
dpkg -l package_name

List files in package

rpm -ql package_name
rpm -qlf filename
dpkg -L package_name
dpkg -c filename
apt-file list package_name [even if package not installed, may need "apt-file update" first]

Info on package

rpm -qi package_name
rpm -qip package_file_name
rpm -qif filename
rpm -qf --changelog filename
apt-cache show package_name  [even if package not installed]
dpkg-query -l package_name
dpkg-query -s package_name
dpkg -s package_name

There is no single command for extracting a changelog from a Debian package.

Package owning file

rpm -qf filename
dpkg -S filename
apt-file search filename [even if package not installed / file not present. May need "apt-file update" first]

List all installed packages

rpm -qa
dpkg -l
apt list --installed

Install package

rpm -i package_file_name
dpkg -i package_file_name       [no dependency checking]
apt-get install package_name    [will download package and dependencies]

Remove package

rpm -e package_name
apt-get purge package_name
dpkg --remove package_name

Basic extraction

A Debian package is an ar archive whose components are compressed, most probably with xz or gz. Extraction of the main files can be achieved with

ar p package.deb data.tar.xz | tar --xz -xf -

(replace xz with gz for older archives)

A rpm package contains a cpio archive in a wrapper, and the use of a tool such as rpm2cpio (perl, and packaged for many distributions) or rpm2dir (C) is necessary to extract this. If rpm2cpio is available, then

rpm2cpio package.rpm | cpio -id

should work. Note that the cpio archive is stored compressed, and that rpm2cpio knows how to decompress it. However, old versions of rpm2cpio might not work with modern rpms. Also there are many programs called rpm2cpio, some written in languages other than perl.

Mirroring repositories and architectures

One cannot successfully point apt at a repository which does not contain all the architectures which one claims to be using. So, for a machine which is natively amd64, and which has suffered

dpkg --add-architecture i386

attempts to point apt at a mirror containing amd64 only are unlikely to work.