How to make container's access to host X server permanent

Hi everyone,

First post! I run several desktop applications in LXD containers on Arch Linux and use the following line so that the container can use the host’s X server.

lxc config device add opera x disk source=/tmp/.X11-unix/ path=/tmp/.X11-unix/

This works fine until I reboot, at which point I have to remove and then add again, as the container has lost access to X. Is this normal? And if so, is there a way to make the assignment permanent?

Thanks in advance.

1 Like

Hello Daniel,

Have a look at this guide on how to create a LXD profile that you can then use to launch such GUI containers,

That guide also includes support for audio on top of accelerated X support.
The guide has been tested on all sort of Ubuntu combinations, therefore it would be good to get feedback on ArchLinux.

I think that the issue with your command is that you do not bind-mount the socket but the directory it is in.

/tmp is wiped by most Linux distributions on boot, so having LXD bind-mount something there doesn’t really work since it will either get overmounted by a tmpfs or wiped during boot.

Ah, that’s what I was looking for! It makes sense now that I think about it. Thank you,