-
create chroot with
xvoidstrap(see https://docs.voidlinux.org/config/containers-and-vms/chroot.html) -
enter chroot with
xchroot -
install steam and all extra 32-bit dependencies and drivers (see
/usr/share/doc/steam/README.voidlinuxinside chroot after installing steam) -
Since we're already in a separate namespace, bwrap cannot create another namespace, which causes it to fail, so we must make bwrap binary inside chroot setuid:
chmod u+s /bin/bwrap -
create new user in chroot:
useradd -m -G audio,video gamer -
exit chroot, e.g. with
Ctrl+D -
steam won't launch if we don't do 2 extra things:
- make chroot dir itself a mount point:
mount --bind $CHROOT $CHROOT - enter our chroot with unshare:
unshare -m chroot $CHROOT
Explanation: With bare chroot, the Steam client does not run, complaining "Steam now requires user namespaces to be enabled." For this Steam tests if bwrap --bind / / true succeeds. (This requires bwrap is set setuid.) Internally bwrap calls pivot_root (2), of which conditions with "/" are not met under systemd. With unshare the namespace gets separated, and things work.
So I've copied
xchrootscript from my system and changed 3 lines total (see comments): Save this script asxchroot-steamand use it in the next steps:#!/bin/sh -e # xchroot DIR [CMD...] - chroot into a Void (or other Linux) installation fail() { printf '%s\n' "$1" >&2 exit 1 } if [ "$(id -u)" -ne 0 ]; then fail 'xchroot needs to run as root' fi CHROOT=$1; shift [ -d "$CHROOT" ] || fail 'not a directory' [ -d "$CHROOT/dev" ] || fail 'no /dev in chroot' [ -d "$CHROOT/proc" ] || fail 'no /proc in chroot' [ -d "$CHROOT/sys" ] || fail 'no /sys in chroot' mount --bind "$CHROOT" "$CHROOT" # ADDED: mount chroot dir onto itself for _fs in dev proc sys; do mount --rbind "/$_fs" "$CHROOT/$_fs" mount --make-rslave "$CHROOT/$_fs" done touch "$CHROOT/etc/resolv.conf" mount --bind /etc/resolv.conf "$CHROOT/etc/resolv.conf" cleanup() { umount -R "$CHROOT/dev" "$CHROOT/proc" "$CHROOT/sys" "$CHROOT/etc/resolv.conf" umount -l $CHROOT # ADDED: unmount chroot dir } trap cleanup EXIT INT if [ -x "$CHROOT/$SHELL" ]; then INNER_SHELL="$SHELL" elif [ -x "$CHROOT/bin/bash" ]; then INNER_SHELL="/bin/bash" else INNER_SHELL="/bin/sh" fi printf "\033[1m=> Entering chroot $CHROOT\033[m\n" export PS1="[xchroot $CHROOT] $PS1" unshare -m chroot "$CHROOT" "${@:-$INNER_SHELL}" # CHANGED: use unshare for chroot STATUS=$? if [ $STATUS -ne 0 ]; then printf "\033[1m=> Exited chroot $CHROOT\033[m\n" else printf "\033[1m=> Exited chroot $CHROOT with status $STATUS\033[m\n" fi exit $STATUS - make chroot dir itself a mount point:
-
allow local connections to X server, by running this command in host system:
xhost +localhostThis is a potential security risk as any user could access the X server without authentication. To revoke access run
xhost -localhost -
launch steam with your new user:
sudo bash ./xchroot-steam <chroot_dir> su -c 'steam' gamer -
Repeat steps 8-9 to launch steam any time again.
Last active
January 1, 2026 07:02
-
-
Save janAkali/7152382e7b0cd581d9cebb72ed07438e to your computer and use it in GitHub Desktop.
Guide for installing Steam in chroot in Void Linux
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment