NOTE: this issue is specific to using xwayland-satellite v0.5. My configuration has had no issues in the past with any other applications using the wayland socket passed in this way. I posted this because, in addition to the (probable) xwayland-satellite bug, I thought something might be wrong with incus too.
I tried to run xwayland-satellite in an incus container (LXD) that has a pass-through set up for the wayland display socket.
Not only does xwayland-satellite fail to run (the message “Connected to Xwayland on {}” doesn’t show up yet), no other wayland applications can run afterward until I restart the container.
xwayland-satellite works as expected when running on the host Sway compositor (with xwayland disable config). And Sway running on the host seems to be unaffected by all this.
In this same container setup, I can run other wayland graphical applications (e.g. foot), and other wayland compositors running nested (e.g. cage, gamescope) with Xwayland support, without issue.
it’s very weird that you mount /run/user/1000/wayland-1 in container, because you are using arch which XDG_RUNTIME_DIR is managed by systemd. every time you login, systemd creates XDG_RUNTIME_DIR for you and destroy it when you logout. it’s even weird that you can run foot after login, I don’t think host wayland socket still exists in container XDG_RUNTIME_DIR.
your container doesn’t have a desktop environment, so where DISPLAY=:0 comes from? how is possible you can test xwayland in container? I think you need to mount host DISPLAY.
your profile looks very like the one in my tutorial. so i will correct it in here, the right way to use gpu in container should be:
xwayland-satellite is only running in the container, not on the host. There is no X11 socket to pass to the container. I have xwayland disable set for Sway on the host. Also, some wayland compositors (e.g. Niri, which I also use) do not support xwayland.
As for where to put the sockets in the container, I picked /run/user/1000 to mirror the path on the host, assuming that is where most applications will look to find them. XDG_RUNTIME_DIR is also set there in the container – so unless I change XDG_RUNTIME_DIR, that is where they need to end up. As shown in the setup section of my post, I use a tmpfiles.d config to make sure /run/user/1000 exists. It does not get created by default on boot or login of the container. This has worked just fine in the past.
As I said in my post, many other wayland and X11 apps work just fine with this config – though I suppose it would be good to try your config out, just to see if anything changes.
I believe this is directly related to the xwayland-satellite bug I reported. Xwayland-satellite is doing something weird – and I filed an issue with them to correct it. The reason I posted this discussion, is because I thought it could be more than just a problem with xwayland-satellite, considering how the socket in the container is broken even after xwayland-satellite exits – but the host socket remains unaffected.
I found the issue. This isn’t an incus bug or config problem. Xwayland-satellite is overwriting the socket at /run/user/1000/wayland-1. That’s why it is broken afterward. Why it doesn’t, like when running on the host, correctly make a new wayland-2 socket and instead overwrites the existing one, is the next question.
Trying a disk mount + symbolic link helped me find the issue, since it made it easier to see it was getting overwritten.