Hi community,
I am having trouble to access the host’s Xwayland from inside an unprivileged container.
What I did/found so far:
- lxc-create … --tempate download (ubuntu xenial) → done
- config bridge, ip on host and inside containe → done
- I can lxc-start my container and lxc-attach into it. Inside the container I do have internet connectivity.
- I mount /tmp/.X11-unix from the host into my container (see config below). I do see its contents from inside the container, I can create,read and write regular files in /tmp/.X11-unix/ inside my container and they show up on the host as expected.
When I try to run xclock or xeyes I get the error:
Error: Can’t open display: :1
- $DISPLAY inside container is set to same value as on host
- xhost + (on host) before lxc-start does not. xhost + insode container gives same error message.
- sudo’ing to a different user on host and running xeye works (with Xwayland)
starting plasma on X11 insted of on wayland with Xwayland makes xclock work from inside the container (with the steps mentioned here)
Only the combination of lxc container on a wayland session (with Xwayland) does not work. What am I missing here?
I went through several tutorials/posts/man pages:
- [Howto] Use the Host's Wayland and XWayland Servers inside containers
- [Overview] GUI inside Containers
- [Howto] Use the Host's Wayland and XWayland Servers inside containers
- LXC 1.0: GUI in containers [9/10] | Stéphane Graber's website
- …
What would be the best way to debug this issue? It shows up only on wayland with Xwayland. On a X11 session on the host these issues disappear.
My config:
# Template used to create this container: /usr/share/lxc/templates/lxc-download
# Parameters passed to the template:
# For additional config options, please look at lxc.container.conf(5)
# Uncomment the following line to support nesting containers:
#lxc.include = /usr/share/lxc/config/nesting.conf
# (Be aware this has security implications)
# Distribution configuration
lxc.include = /usr/share/lxc/config/common.conf
lxc.include = /usr/share/lxc/config/userns.conf
lxc.arch = linux64
# Container specific configuration
lxc.idmap = u 0 100000 65536
lxc.idmap = g 0 100000 65536
lxc.rootfs.path = dir:/home/k.nick/.local/share/lxc/xenial/rootfs
lxc.uts.name = xenial
# Network configuration
lxc.net.0.type = veth
lxc.net.0.link = lxcbr0
lxc.net.0.flags = up
lxc.net.0.hwaddr = 00:16:3e:bf:d3:70
lxc.net.0.ipv4.address = 10.10.10.23/24
lxc.net.0.ipv4.gateway = 10.10.10.1
lxc.mount.entry = /dev/dri dev/dri none bind,optional,create=dir
lxc.mount.entry = /dev/snd dev/snd none bind,optional,create=dir
lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir
lxc.mount.entry = /tmp/.X1-lock tmp/.X1-lock none bind,optional,create=file
lxc.mount.entry = /dev/video0 dev/video0 none bind,optional,create=file
lxc.mount.entry = /run/user/1000 mnt/wayland none bind,optional,create=dir
#lxc.mount.entry = /run/user/1000 run/user/1000 none bind,optional,create=dir
#lxc.mount.entry = /tmp/.X11-unix tmp/.X11-unix none bind,optional,create=dir