Running X11 applications in LXD containers on Void?


#1

Hello,

I want to keep this short for once.
I’ve followed this tutorial to allow X11 passthrough from container to host: https://blog.simos.info/how-to-run-graphics-accelerated-gui-apps-in-lxd-containers-on-your-ubuntu-desktop/
It does work on my Ubuntu system at work; on my Void system at home, I got the container imported and running, no problem there.
However, no matter what I try, I cannot get the X11 forwarding part to work.
I’m using lxd 3.2 here, because that’s supposed to fix this seemingly Void-specific bug: https://github.com/lxc/lxd/issues/4591
I just updated and recompiled the package myself (and I should probably create a PR for that update).
Now everything is set up like it sould be.
The content of the relevant files:

/etc/subuid and /etc/subgid:
root:1000:1
root:1000000:65536

The devices in lxc config show look like this:

devices:
  X0:
    path: /tmp/.X11-unix/X0
    source: /tmp/.X11-unix/X0
    type: disk
  Xauthority:
    path: /home/jonas/.Xauthority
    source: /home/jonas/.Xauthority
    type: disk
  mygpu:
    gid: "1000"
    type: gpu
    uid: "1000"

I have verified that the UIDs match, and that all the files referenced exist.
It’s probably not a problem with the gpu device, because I think it’s supposed to work without that (but with no graphics acceleration then).
When I try to run any X application inside the container, I get this:

No protocol specified
Error: Can't open display: :0

It doesn’t matter if the gpu device exists or not, it’s always the same result.
It might be a problem with the user Xorg is running as on Void, or maybe a configuration difference - worst case would be that the bug on GitHub there is actually not fixed at all (but it has to do with the GPU device only, so it’s probably unrelated).
Another worst case scenario would be that it’s because of different Xorg versions in the different distributions involved here (it looks like Void has xorg 7.6 with xorg server 1.20, whereas the Ubuntu versions has xorg 7.7 with xorg server 1.18).

Does anyone else run graphical apps in an Ubuntu container on Void? How did you get it working? What could I do for further troubleshooting?

Thanks!


#2

Hello

There is already a PR for lxd 3.2 which I opened some time ago but it still not commited.
I can approve that GPU bug is present in current lxd 3.1 and properly fixed in lxd 3.2

I didn’t add XAuthority device because I didn’t have one. Maybe you can try to delete it from container or run xhost + on your host.