Lxc publish fails with Error: mkdir /tmp/lxd_lxd_metadata_133785845: no such file or directory

on some of my servers i can not publish an image from a container, but only if I have metadata on it:

this works:

~$ lxc publish testct
Instance published with fingerprint: 3e71942baa172d529447499e7fd4963d696b6497fa36e8651db827463a45b83a

but as soon as I want to set any metadata, it fails with:

~$ lxc publish testct a=b
Error: mkdir /tmp/lxd_lxd_metadata_730759384: no such file or directory
Exit Code: 1

sounds like a variation of this one

except lxc file push works in this case. Any other directory maybe that I have to spare from the tmpwatch?

Thank you.

Which LXD version is this?

5.10-b392610 from stable snap

any ideas, something to try before I reboot?

so, I have investigated further and noticed that /tmp/ is nmounted twice in the lxd namespace and when I unmounted it once, it all started to work.

# nsenter -a -t $(pgrep -f "lxd --logfile")
-bash-5.0# fgrep /tmp /proc/mounts
/dev/sdc2 /tmp xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/sdc2 /var/tmp xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/sdc2 /tmp xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
# umount /tmp
-bash-5.0# fgrep /tmp /proc/mounts
/dev/sda2 /tmp xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
/dev/sda2 /var/tmp xfs rw,relatime,attr2,inode64,logbufs=8,logbsize=32k,noquota 0 0
# logout

But…(!): on the working servers, /tmp/ was/is still mounted twice in the lxd namespace and they are still working. So, still no idea what is going on, but maybe it helps the next poor soul google leads this way :wink: