X11 unix domain socket appears only when container is booted twice

I’m using losetup to present a file for zpool to import as the root for lxd. The x11 socket is bound to the container. However, on first boot, the x11 socket is not there until the container is restarted.

Is there a reason why this happens?

What path are you exposing this at? The most common issue is someone using something in /tmp which then races with systemd or other init scripts wiping /tmp at boot time.

Yes it is at /tmp. But shouldn’t the x11 domain socket already be created after the graphical login? The socket is there just that it doesn’t appear on the first start of the container.

The issue is the other way around, your container as part of its boot sequence will wipe the content of /tmp so anything that’s passed into it through LXD may get deleted when the container boots or reboots.

I thought i’d insert this here to jog my memory.

I solved this by setting up an rc.local that would soft link the X0 socket from the X11 directory that was mounted elsewhere first. rc.local runs last so it shouldn’t get clobbered by any run units before itself.

1 Like

Thanks! Sounds I’ve got a chance to resume my attempts to setup my RPI :slight_smile: Now it’s limited only “gaming” part of my intention - RetroPie-based, with Stepmania on top (with resolution glitches).

As I’m kinda noob in the area, do you mind posting snipet from rc.local that does the job of soft-linking?

it’s really only

ln -s /tmp/.X11-unix/X0
exit 0

1 Like

ln -s “where lxd has bound the original to” /tmp/.X11-unix/X0

the message board hid the original full line.