after installing a chroot, I found trouble when connecting to x11, I would think this was a normal use case but coudln't find anything specific about this use case

# debootstrap stable /srv/stable/
# chroot /srv/stable/ xeyes
No protocol specified
Error: Can't open display: :0

1 Answer 1


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
  • 1
    X Error of failed request: BadValue (integer parameter out of range for operation) Major opcode of failed request: 109 (X_ChangeHosts)
    – exebook
    Mar 3, 2020 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.