Convert .deb packages to .rpm using an Ubuntu container environment on non-Ubuntu systems (like openSUSE, Fedora, or Arch).
alien is an invaluable tool for converting Linux package formats, particularly bridging the gap between Debian-based systems (like Ubuntu) and RPM-based systems. However, installing alien natively on non-Ubuntu distributions can sometimes be problematic due to conflicting dependencies or an overall lack of availability in default repositories.
This project solves that issue by containerizing the alien toolset. Using a rolling release of Ubuntu as the base image, it guarantees that alien and its underlying dependencies are consistently available regardless of your host operating system. All you need is a container runtime like Docker or Podman.
For more background on this setup, read the full article: Converting DEB Packages to RPM Using an Ubuntu Container.
Ensure you have a container runtime installed on your host system:
- Podman and Buildah (recommended)
- Docker
You can use the container image to convert a file by mapping your local directory to the container and passing the target filename as an environment variable.
To convert a package named package.deb located in your current working directory:
# Using Podman
podman run --rm -v $(pwd):/app/AlienConvert -e TARGET=package.deb ghcr.io/thejento/alienconvert:latest
# Using Docker
docker run --rm -v $(pwd):/app/AlienConvert -e TARGET=package.deb ghcr.io/thejento/alienconvert:latestThe resulting .rpm file will be generated in your current working directory.
To streamline this process, you can create a wrapper script.
- Create a script named
deb2rpmin a directory in your$PATH(e.g.,~/bin/deb2rpmor/usr/local/bin/deb2rpm):
#!/bin/bash
# Script to convert DEB to RPM using a container
if [ -z "$1" ]; then
echo "Usage: deb2rpm <deb-file>"
exit 1
fi
podman run --rm -v $(pwd):/app/AlienConvert -e TARGET="$1" ghcr.io/thejento/alienconvert:latest
# Replace podman with docker if you are using Docker- Make the script executable:
chmod +x ~/bin/deb2rpm- You can now easily convert packages like this:
deb2rpm package.debAs noted in the article, please be aware of the inherent risks when converting packages between distributions:
- Library & Dependency Mismatches: RPM and DEB systems often use different naming conventions for system libraries.
- Pre/Post-installation Scripts:
alienmight not cleanly translate setup scripts packaged within the DEB file. - Security Risks: The integrity and source of converted packages are harder to trace natively.
- Unsupported Features: Some advanced packaging features are specific to
.debor.rpmand do not translate.
It is highly recommended to avoid converting packages for mission-critical systems or applications that require frequent updates.
This repository is configured with a GitHub Action that automatically builds the container image and pushes it to GitHub Container Registry on a regular schedule (monthly) and whenever a new version tag is pushed.