New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bindmount for .X11-unix only works when done if container is running #4540
Comments
Yes, I think I know why. This usually happens when systemd mounts a new
|
Thanks for the suggestion, I'm sure it is the right direction. I don't get while using bind option when mounting a tmpfs? Anyway, I tried and it fails in other funny ways. Just to be sure, I also masked tmp.mount in systemd, which is responsible for mounting tmp as tmpfs. (documented here)
I have the following theory:
Is it possible that lxd itself overmounts bindmounts? Or is there some logic that avoids this? I also found lxc/lxc#434, which seems to tackle the same problem. |
Nothing that we can do here. Those mounts inside the container aren't going to be there when LXD sets up its own. My usual approach for things like that (/tmp or /run paths), is to have LXD mount them somewhere else, then doing another bind-mount or move mount inside the container. So something like this:
And then in the container, have an init script (or more hackish, use /etc/rc.local) to:
This will avoid the two main issues with /tmp:
|
Closing the issue as there's nothing particularly good that LXD can do when the container alters the mount table. Once we get abstract unix socket support to the proxy device, there'll be a much nicer way to forward X11 access to a container, without having to deal with any of that. That's tracked in #4167 |
Thanks for the help! After some fiddling with systemd I ended up with the script below to bindmount /mnt/x11 to /tmp/.X11-unix. It runs after systemd has mounted and cleaned /tmp. The filename is important, it needs to match the target mountpoint after systemd escaping.
|
Direct mounting /tmp/.X11-unix should be possible, with commenting out the .X11-unix creation in systemd-tmpfiles config.
Then shutdown your container && change your container configuration accordingly. |
Required information
Issue description
Forwarding the X11-socket only works when I add the device after the container has been started. It does not work when the device is configured while the container is not running or if the container is restarted.
Steps to reproduce
The text was updated successfully, but these errors were encountered: