Error: open /tmp/lxd_editor_<number>.yaml: no such file or directory

Hello,

In my LXD single-node server I cannot edit objects:

root@core01-rdc-cor:/tmp#   snap list lxd
Name  Version         Rev    Tracking     Publisher   Notes
lxd   5.21.4-7b6bd68  36153  5.21/stable  canonical✓  held

root@core01-rdc-cor:/tmp#   lxc config edit proxy01
Error: open /tmp/lxd_editor_2214415763.yaml: no such file or directory

THere is some discussion around this here - lxc profile edit leads to error. · Issue #5171 · canonical/lxd · GitHub - but it is not that recent and I’m not sure yet what is the root cause and if it is a problem in LXD or elsewhere.

Did someone have a similar issue recently?

This looks like Error: open /tmp/lxd_editor_1760900616.yaml: no such file or directory · Issue #16171 · canonical/lxd · GitHub which was tracked down to be a likely issue with snapd reaping files from private tmp dir. The fix landed in core24 (see core-base/static/usr/lib/tmpfiles.d/snap-tmp.conf at core24 · canonical/core-base · GitHub) but it not (yet?) in core22 (it’s missing from core-base/static/usr/lib/tmpfiles.d at core22 · canonical/core-base · GitHub).

Newer LXD version use core24 and we have plans to migrate 5.21 to this newer core too. Until then, you can probably create that tmpfiles.d snippet yourself do avoid running into the problem.

Hello @sdeziel1, thanks yes it seems this is the same issue.

you can probably create that tmpfiles.d snippet yourself do avoid running into the problem.

Do you mean changing manually the default one? On the affected system I have the following (comments stripped away):

D /tmp 1777 root root 30d

A user suggests a workaround: Error: open /tmp/lxd_editor_1760900616.yaml: no such file or directory · Issue #16171 · canonical/lxd · GitHub. But it seems different.

The default one you mentioned if for the host’s /tmp. Here due to the snap confinement, each snap gets its own /tmp and they show up in the host’s in /tmp/snap-private-tmp/*/tmp.

As such, my suggestion is to create in your host a file named /etc/tmpfiles.d/snap-tmp.conf with this content:

# Workaround for https://github.com/canonical/lxd/issues/16171
X /tmp/snap-private-tmp/*/tmp
1 Like

@sdeziel1, thanks I’ve applied the workaround.

Newer LXD version use core24 and we have plans to migrate 5.21 to this newer core too

Is there any tracking ticket for this activity?

I asked the snapd team about their plan to backport this to core22.

Thanks a lot @sdeziel1 !