Drown in RHEL, Debootstrap to Rescue
A Debian userland alongside Red Hat Enterprise Linux
This article is written in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by applicable law. The entire risk is with you. In no event unless required by applicable law will the author be liable.
Copyright (C) 2026 The Author (see footer). Some rights reserved.
Permission is granted to make digital or hard copies of this work for personal or classroom use, provided that copies are not made or distributed for profit, commercial, operational, or administrative advantage. Permission is explicitly denied for any use, inclusion, redistribution, or integration of this article—in whole or in part—by professional support services, help desks, or managed service desks. All other redistribution, reproduction, or commercial use requires prior written permission from the copyright holder and proper attribution.
No part of this article is authored or supported by iSolutions, the University of Southampton IT service.
Preamble
This article introduces how to set up debootstrap to run a Debian userland on Red Hat Enterprise Linux.
Are you in the wrong place?
If you are looking for a container solution, please refer to containers such as:
- Docker, https://www.docker.com/
- podman, https://podman.io/
If you just need to install a missing package:
- Have you tried other package managers (e.g., pipx, flatpak)?
- Have you tried building it from scratch?
- Have you asked other RHEL users (me)? They (I) probably need it too and might have figured it out.
If you don't know what you are reading/doing, please stop.
Are you familiar with GNU/Linux? (Are you aware and familiar with the GNU system, and are you familiar with Linux?) Don't break your system.
Are you familiar with Debian, too? Don't break Debian.
Are you going to install this system on another partition? Are you using LVM? Is the disk encrypted?
Are you going to install this system to your bootloader? Then, are you familiar with GRUB and do you know how to rescue your system if GRUB fails? Can you boot into/chain load the old system/a live USB? Where is your kernel? How do you install a kernel? How do you build an initial ramdisk? How is your UEFI protected?
Do you have a backup? Is it copy-on-write?
Are you root? In order to use chroot in a secure way, one needs to
be effective root/wheel (specifically, one needs CAP_SYS_CHROOT to
use the chroot syscall); refer to Capabilities(7). Running an
alternative chroot program which does not require root poses
security risks (for example, see setuid).
RPM and RHEL
Two failure classes recur on a stock RHEL image using RPM: packages that are simply absent or available only from a third-party repo, and packages that are present but break on update. Both are routine.
This is real trouble.
Absent packages such as Feh, Openbox, ccls, xapian, wxWidgets and XScreenSaver can be compiled by hand from scratch, although it is (non)trivial and sometimes (often) the dependencies and dependencies of dependencies (and …) need to be compiled as well.
Other packages such as xeyes (xorg-x11-apps) are relocated and easy to miss on RHEL 9. Other than compiling from scratch, RPM packages can be downloaded online from random websites, although this is a very bad practice.
An unacceptable problem is ABI mismatch after update. A working system breaks. All programs linked to the package break. The author encountered major problems with: Autotools (in many packages), CMake, FFmpeg (codecs broken so that almost no videos could be played; don't know how to fix non-free codecs yet as of this writing), GTK (glib, gio; so that many GUI programs could not be run, and I had to recompile frequently-used programs such as Emacs with lucid; so that many GUI programs could not connect to the network, including programs for authentication), ImageMagick (libMagick*; so that many programs related to image broke), SASL2 (libsasl; so that I could not log in).
If you think it is not real trouble and you can live with this, how would you deal with this without a container?
/usr/local/bin/foo: /lib64/libc.so.6: version `GLIBC_2.36' not found (required by /usr/local/bin/foo)
/usr/local/bin/foo: /lib64/libc.so.6: version `GLIBC_2.38' not found (required by /usr/local/bin/foo)
1. Install debootstrap
https://deb.debian.org/debian/pool/main/d/debootstrap
Replace the filename with the latest version found at the link above.
wget https://deb.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.145.tar.gz
tar -zxvf debootstrap_1.0.145.tar.gz
cd debootstrap/
sudo make install
Similarly, get the latest keyring from http://deb.debian.org/debian/pool/main/d/debian-archive-keyring/.
curl -LO http://deb.debian.org/debian/pool/main/d/debian-archive-keyring/debian-archive-keyring_2025.1_all.deb
ar x debian-archive-keyring_2025.1_all.deb
tar xf data.tar.xz ./usr/share/keyrings/debian-archive-keyring.gpg
2. Debootstrap
For example, install Debian into /debian.
sudo mkdir /debian
Get a few minimal things, such as sudo, locales, git, compilers and
a text editor (such as zile/vim/nano).
sudo debootstrap \
--include=sudo,locales,git,build-essential,zile \
--arch=amd64 \
--keyring=/tmp/usr/share/keyrings/debian-archive-keyring.gpg \
stable /debian http://deb.debian.org/debian/
3. Set up Debian
id -a # note your uid/gid
sudo chroot /debian /bin/bash
In Debian:
# (root@debian)
groupadd -g <your gid> <your group without space>
useradd -m -u <your uid> -g <your gid> -s /bin/bash <your username>
usermod -aG sudo,<other groups such as dialout> <your username>
passwd <your username>
dpkg-reconfigure locales
apt update
exit
4. Mount Filesystems
You should also mount filesystems for Debian, for example (may be incomplete):
/dev/sys/run/tmp/proc/home?/usr/local, to … ?/etc/resolv.conf
You can --make-rprivate root.
You can mount some of the above with --bind to /debian/*, and
then mount them with --make-slave under /debian.
For example, you can:
R=/debian
cleanup() {
umount $R/rhel
umount $R/dev/pts
umount $R/dev/shm
umount $R/dev
umount $R/sys
umount $R/run
umount $R/proc
umount $R/tmp
umount $R/home
umount $R/opt/local-rhel
umount $R/etc/resolv.conf
}
trap cleanup EXIT
mount --make-rprivate /
mount --bind /dev $R/dev && mount --make-slave $R/dev \
&& mount --bind /dev/pts $R/dev/pts && mount --bind /dev/shm $R/dev/shm
mount --bind /sys $R/sys && mount --make-slave $R/sys
mount --bind /run $R/run && mount --make-slave $R/run
mount --bind / $R/rhel && mount --make-slave $R/rhel
mount -t proc proc $R/proc
mount --bind /tmp $R/tmp
mount --bind /home $R/home
mount --bind /usr/local $R/opt/local-rhel
mount --bind /etc/resolv.conf $R/etc/resolv.conf
Check whether those mount-points are umount'ed after use by running
mount. You won't notice them then until you have \(\mathcal{O}(2^n)\)
mount-points.
5. Chroot
You should also set up a chroot script (options may be incomplete), to mount the filesystems and run chroot:
#!/bin/bash
# TODO: trap cleanup-filesystem EXIT here
# TODO: mount filesystem here
exec chroot --userspec=$SUDO_UID:$SUDO_GID --chdir=/home/$SUDO_USER \
/debian /usr/bin/env -i \
HOME=/home/$SUDO_USER \
USER=$SUDO_USER \
TERM=$TERM \
DISPLAY=$DISPLAY \
XDG_RUNTIME_DIR=/run/user/$SUDO_UID \
/bin/bash -l "$@"