Using Distrobox on Ubuntu: Experience Arch and Fedora Instantly Without Reinstalling

Ubuntu tutorial - IT technology blog
Ubuntu tutorial - IT technology blog

Why I choose Distrobox instead of reinstalling my OS

Having used Ubuntu as my primary operating system for half a year, I really appreciate its stability. However, life isn’t always perfect. Ubuntu’s apt repository can sometimes be too outdated for practical needs. There are times when I crave the latest packages from Arch’s AUR or need a library only available on Fedora that Ubuntu LTS doesn’t support.

Previously, I used to set up Virtual Machines (VMs). However, an Arch VM usually consumes at least 2-4GB of RAM and boots very slowly. Docker was the second choice, but it’s too isolated from the file system and difficult to run graphical applications (GUI). Distrobox emerged as a lifesaver. It allows me to run any Linux distribution right inside the Ubuntu terminal. Everything shares the Home directory, the network, and it’s so lightweight that you barely notice any performance drop.

Quick Start: Get Arch Linux on Ubuntu in 5 minutes

If you want to try it right away, here is the shortcut process to bring an Arch Linux environment into your Ubuntu setup.

Step 1: Install Podman and Distrobox

Distrobox needs an “engine” to run containers. I recommend using Podman instead of Docker. Podman operates in rootless mode, which is more secure and avoids file permission errors in your personal directory.

sudo apt update
sudo apt install podman distrobox -y

Step 2: Initialize a new container

Let’s create an Arch Linux environment and name it my-arch:

distrobox create -n my-arch -i archlinux:latest

The system will ask if you want to download the image. Press Y to continue (the download size is usually only about 150-200MB).

Step 3: Enter the new environment

distrobox enter my-arch

The command prompt will change immediately. Welcome to Arch Linux! Now you can freely use pacman -S to install the latest tools.

How does Distrobox work?

Many people mistake Distrobox for something complex, but it’s actually a clever script wrapper around Docker or Podman. The difference lies in its deep integration:

  • Mount Home directory: Files in ~/Documents on Ubuntu appear exactly the same inside Distrobox.
  • GUI Integration: You can open a GUI app (like the latest GIMP from Fedora) directly on your Ubuntu desktop.
  • Shared Network: No need for complex port forwarding like in traditional Docker.

I often use this method to test scripts across various environments. It keeps my Ubuntu Server clean and free from “clutter” caused by extra libraries.

Essential management commands

Create containers from other distros

You’re not limited to Arch. Any image on Docker Hub or Quay.io can be used:

# Create the latest Fedora container
distrobox create -n fedora-box -i fedora:latest

# Create an Alpine container (ultra-lightweight, only takes about 5MB disk space)
distrobox create -n alpine-box -i alpine:latest

List containers

distrobox list

Delete a container

distrobox rm my-arch

Pro Tip: Export apps from Distrobox to the Ubuntu Application Menu

This is my favorite feature. Suppose you install vlc in the fedora-box container but want to open it quickly from the Ubuntu dock. Use distrobox-export.

First, enter that container:

distrobox enter fedora-box

Then run the export command:

distrobox-export --app vlc

The VLC icon will appear in the Ubuntu Application Menu immediately. When you click it, Ubuntu automatically starts the container and opens the app. The experience is as seamless as a native app installed via apt.

Real-world experience after six months of use

After tinkering with Distrobox on both laptops and servers, I’ve gathered a few important notes:

  1. Choose Podman: Podman runs rootless, so files created in the container will belong to your user. Using Docker can sometimes cause frustrating Permission Denied errors when you edit files with external apps.
  2. Monitor storage: Although lightweight, each container still takes up hundreds of MBs to several GBs of disk space. Don’t create too many redundant containers if you don’t want to fill up your drive.
  3. Be careful with Dotfiles: Since the Home directory is shared, files like .bashrc or .zshrc will affect each other. Check carefully if you have deep shell customizations.
  4. Isolate Dev environments: I usually create a separate container for each project. Project A uses Node.js 14, Project B uses Node.js 20. This keeps the system extremely organized and easy to manage.

Conclusion

Distrobox is a fantastic tool for those who love to explore but still need stability for work. It breaks down the barriers between Linux distributions. Now, you can enjoy the power of Arch Linux on the solid foundation of Ubuntu.

If you encounter errors related to subuid or subgid when using Podman, just double-check your user configuration in /etc/subuid. Happy exploring!

Share: