First, x11 clients need to talk to the x11 server via a socket file, usually
/tmp/.X11-unix/X0
# mount -o bind /tmp/ /srv/stable/tmp/
Second, xauth
I mean, xhost
which I keep confusing together.
either A, (Recomended) the uid of the process inside the chroot must
match the uid of the user who owns the xauthority on the host, for
example we can clone the username/groupname userid/groupid of the host
user to the chroot (usually uid/gid 1000/1000)
# chroot /srv/stable groupadd -g $(id -g) $(id -gn)
# chroot /srv/stable useradd -u $(id -u) -g $(id -g) $(id -un)
.
or B, the uid of the process in the chroot must otherwise be
authorized, in the xauthority file, for example; chroot will run as
uid 0 inside the chroot, so we can authorize uid 0 outside the chroot
like so:
# xhost +si:localhost:root
localhost:root being added to access control list
our graphical programs should have connectivity and authority to use the x11 display now:
# chroot /srv/stable sudo -u $(id -un) xeyes
# chroot /srv/stable xeyes