/tmp/.X11-unix/X0 does not show up in the container

Hello,

I have both host and container running Archlinux. I have lightdm running on the host and want to share its X credentials to the container.

On the host I can see,

$ ls -la /tmp/.X11-unix/   
total 0
drwxrwxrwt  2 root root  60 Dec  8 18:25 .
drwxrwxrwt 12 root root 320 Dec  8 18:25 ..
srwxrwxrwx  1 root root   0 Dec  8 18:25 X0

However in the container the X0 file is not there?

$ lxc exec sim1 -- ls -la /tmp/.X11-unix/
total 0
drwxrwxrwt 2 root root  40 Dec  8 18:47 .
drwxrwxrwt 9 root root 180 Dec  8 19:03 ..

However, the .Xauthority file does show up correctly,

$ ls -la /home/user/.Xauthority 
-rw------- 1 user users 488 Dec  8 19:20 /home/user/.Xauthority

$ lxc exec sim1 -- ls -la /home/user/.Xauthority 
-rw------- 1 user users 488 Dec  8 19:20 /home/user/.Xauthority

My container config looks like so,

$ lxc config show sim1
architecture: x86_64
config:
  environment.DISPLAY: :0
  image.architecture: amd64
  image.description: Archlinux current amd64 (20191208_04:18)
  image.os: Archlinux
  image.release: current
  image.serial: "20191208_04:18"
  image.type: squashfs
  raw.idmap: |
    uid 1001 1001
    gid 100 100
  volatile.base_image: bc145aae1ed946126064bf95758a31a3ae9672327643b4bed026a25c6c82eeef
  volatile.eth0.name: eth0
  volatile.idmap.base: "0"
  volatile.idmap.current: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1001},{"Isuid":true,"Isgid":false,"Hostid":1001,"Nsid":1001,"Maprange":1},{"Isuid":true,"Isgid":false,"Hostid":1001002,"Nsid":1002,"Maprange":999998998},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":100},{"Isuid":false,"Isgid":true,"Hostid":100,"Nsid":100,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000101,"Nsid":101,"Maprange":999999899}]'
  volatile.idmap.next: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1001},{"Isuid":true,"Isgid":false,"Hostid":1001,"Nsid":1001,"Maprange":1},{"Isuid":true,"Isgid":false,"Hostid":1001002,"Nsid":1002,"Maprange":999998998},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":100},{"Isuid":false,"Isgid":true,"Hostid":100,"Nsid":100,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000101,"Nsid":101,"Maprange":999999899}]'
  volatile.last_state.idmap: '[{"Isuid":true,"Isgid":false,"Hostid":1000000,"Nsid":0,"Maprange":1001},{"Isuid":true,"Isgid":false,"Hostid":1001,"Nsid":1001,"Maprange":1},{"Isuid":true,"Isgid":false,"Hostid":1001002,"Nsid":1002,"Maprange":999998998},{"Isuid":false,"Isgid":true,"Hostid":1000000,"Nsid":0,"Maprange":100},{"Isuid":false,"Isgid":true,"Hostid":100,"Nsid":100,"Maprange":1},{"Isuid":false,"Isgid":true,"Hostid":1000101,"Nsid":101,"Maprange":999999899}]'
  volatile.last_state.power: RUNNING
devices:
  X0:
    path: /tmp/.X11-unix/X0
    source: /tmp/.X11-unix/X0
    type: disk
  Xauthority:
    path: /home/user/.Xauthority
    source: /home/user/.Xauthority
    type: disk
  eth0:
    nictype: bridged
    parent: vlan300br
    type: nic
  mygpu:
    productid: 1d01
    type: gpu
    vendorid: 10de
ephemeral: false
profiles:
- default
stateful: false
description: ""

journalctl -xe shows up the following in the container,

Dec 08 21:27:16 sim1 systemd[1]: tmp-.X11\x2dunix-X0.mount: Mount process exited, code=exited, status=32/n/a
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- An n/a= process belonging to unit tmp-.X11\x2dunix-X0.mount has exited.
-- 
-- The process' exit code is 'exited' and its exit status is 32.
Dec 08 21:27:16 sim1 systemd[1]: Failed unmounting /tmp/.X11-unix/X0.
-- Subject: A stop job for unit tmp-.X11\x2dunix-X0.mount has finished
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A stop job for unit tmp-.X11\x2dunix-X0.mount has finished.

Solution is here.

See also https://blog.simos.info/running-x11-software-in-lxd-containers/ on using a proxy device instead.