• Fri. Jun 24th, 2022

How to Convert Linux Installer Packages to Other Formats

ByLinda W. Smith

Feb 28, 2022
fatmawati achmad zaenuri/Shutterstock.com

the alien program converts installation packages from one Linux distribution for use on another. But don’t Snap and Flatpak make that redundant now? Sort of, but it’s not that simple.

Linux packaging systems

In order to allow their users to install software, Linux distributions need a software packaging system. If the distro is a fork of another established distro, it will usually stick with the old distro’s packaging system.

This is why Fedora uses RPM packages (which used to mean RedHat Package Manager) and Ubuntu and its many children use DEB packages. DEB is simply short for “Debian”. Other distributions choose to write their own package management system. Installation files packaged for one package manager are not interchangeable with other package managers.

Traditionally, app developers had to either package their app in whatever formats they chose to support, or work with the maintainers of the various Linux distributions and hand them the packaging steps. The latter introduces delays in delivering new releases to users, the former gives developers a lot of extra work.

The Snap and Flatpak projects attempt to provide the holy grail of package distribution: package your app once and install it on any Linux distribution. Of course, there may or may not be a Snap or Flatpak for the app you’re looking for.

You can completely remove packaging systems from the equation, as long as you are comfortable with cloning a Git repository and building an application from source code. But not everyone is. And not all apps, even on Linux, are open source, so you can’t build everything from source anyway.

Maintainers of some distros are good at getting packages for other platforms and repackaging them for their own package management system, including closed-source applications. But there will always be cases where an application offers a DEB or an RPM – the two major formats – and everyone has to figure it out for themselves.

Programs like alien exist to solve the problem of converting a package file from another distro to the version you need on your Linux machine. That’s fine in theory, but how successful are they?

The extraterrestrial experience

The proof of the pudding is in the food.

We took three different RPMs and used alien to convert them to DEB. We then tried to install the freshly created DEBs on Ubuntu.

In all of our test cases, there was also a DEB available for download, so what we were doing was actually redundant. But we thought the test apps (Microsoft Edge browser, Atom editor, and Slack) would be a good test of alienso we ignored the standard DEBs.

Installation of an alien

Installing alien was straightforward on Ubuntu, Fedora, and Manjaro.

On Ubuntu, you can use this command:

sudo apt install alien

install alien on ubuntu

On Fedora, you would type:

sudo dnf install alien

Install alien on Fedora

On Manjaro, the alien package is in the Arch User Repository. This means pacman won’t be able to see it, so we have to use an AUR helper like yay. The package name is also slightly different.

yay -S alien_package_converter

Install alien on Manjaro

Use an alien

Use alien you specify the file you want to convert and the format you want to convert to. It creates a file with the same filename – usually – and with the extension of the format you requested.

Using alien creating a package causes alien to increment the package version number. If the package number is in the file name, the file name will also be changed.

These are the formats alien can convert from and to.

  • -D: Convert to a DEB file, for Debian, Ubuntu and all derivatives.
  • -r: Convert to an RPM file, for RedHat, CentOS and Fedora.
  • -t: Convert to a TAR.GZ archive file, for Arch and Arch based systems like EndeavourOS and Manjaro.
  • -I: Convert to an LSB file, a Linux Standard Base file. This was another initiative to develop a cross-distribution package format.
  • -p: Convert to a PKG file, a format used among others by Solaris.
  • –to-slp: convert to SLP package, a format used by the discontinued Stampede Linux distribution.

The format option we are going to use is -d (DEB) as we are converting to a DEB file. We will also use the -c (scripts) to convert all scripts contained in the package.

Microsoft Edge

We downloaded an RPM for Microsoft’s Edge browser and ran the following command:

sudo alien -d -c microsoft-edge-beta-97.0.1072.54-1.x86_64.rpm

Convert Edge RPM to DEB file

Without the -c (scripts) it did not create the DEB file, it reported an error. With the -c option, it created the DEB.

The original RPM file and the newly created DEB file

Note that the DEB filename contains 54-2, not 54-1.

The script conversion is unlikely to complete successfully. They may very well be written for a particular situation or configuration unique to the authentic target platform of the original package file. For this reason, we did not have high hopes. Nevertheless, we tried to install the DEB with the dpkg program and the -i (to install).

sudo dpkg -i microsoft-edge-beta_97.0.1072.54-2_amd64.deb

Installation failed with newly created DEB file

It did not work.

We also tried double-clicking the DEB file and using the Ubuntu Software app to install the DEB. Interestingly, the software application knew that the DEB was created by alien.

Using the Ubuntu software application to install the newly created DEB file

That didn’t work either. Just to make sure that the Edge browser would actually install on Ubuntu, we installed the official Microsoft Edge DEB file.

sudo dpkg -i microsoft-edge-beta_97.0.1072.54-1_amd64.deb

Official Microsoft Edge DEB file installation command

It worked without a problem. You can see Microsoft Edge running on Ubuntu below.

Microsoft Edge running on Ubuntu

The Atom Editor

We have downloaded the RPM installer package for the popular Atom editor. We used the same alien command to convert it to DEB.

sudo alien -d -c atom.x86_64.rpm

Convert Atom RPM file to DEB file

This created a DEB file without any warnings or errors. We installed it using the dpkg order with the -i (to install).

sudo dpkg -i atom_1.58.0-1.1_amd64.deb

Installing Atom from the newly created DEB file

It worked perfectly.

Atom running on Ubuntu

Slack Business messaging app

Finally, we tried to convert the Slack RPM to DEB.

sudo alien -d -c slack-4.23.0-0.1.fc21.x86_64.rpm

Convert Slack RPM file to DEB file

Again, this created a DEB with no warnings or errors. We used this install command:

sudo dpkg -i slack_4.23.0-1.1_amd64.deb

Installing Slack from the newly created DEB file

The installation worked without a problem. Slack was up and running without any issues.

Slack running on Ubuntu

Mixed results

A utility such as alien inevitably leads an uphill battle. Chances are it could work in all cases, and that was confirmed by our small amount of testing. That said, when it worked, it was great.

If you are in a situation where there is nothing else to do, give alien A try. But if there is another method available to you (Snap, Flatpak, or build from source), try those first. Even the authors of alien know your limits, and put this warning in the man page:

alien should not be used to replace important system packages, such as init, libc, or other items essential to the operation of your system. Many of these packages are configured differently by different distributions, and packages from different distributions cannot be used interchangeably. In general, if you can’t remove a package without breaking your system, don’t try to replace it with a foreign version.

While it might get you out of a hole, make sure you’ve exhausted all other avenues before turning to alien.

But, when there is nothing else, alien might just surprise you.

RELATED: How to Use the Linux Man Command: Hidden Secrets and Basics


Source link