Error: Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused after changing backups destination

I did changes described here Configuring backups directory
after some time I experienced this:

Error: Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused

after doing:

systemctl stop snap.lxd.daemon.unix.socket


lxd --debug --group lxd

I see this:

DBUG[03-18|13:26:17] Connecting to a local LXD over a Unix socket DBUG[03-18|13:26:17] Sending request to LXD method=GET url=http://unix.socket/1.0 etag= INFO[03-18|13:26:17] LXD 3.22 is starting in normal mode path=/var/snap/lxd/common/lxd EROR[03-18|13:26:17] Failed to start the daemon: Failed to chmod dir /var/snap/lxd/common/lxd/backups: chmod /var/snap/lxd/common/lxd/backups: no such file or directory INFO[03-18|13:26:17] Starting shutdown sequence DBUG[03-18|13:26:17] Not unmounting temporary filesystems (containers are still running) Error: Failed to chmod dir /var/snap/lxd/common/lxd/backups: chmod /var/snap/lxd/common/lxd/backups: no such file or directory

ls -la /var/snap/lxd/common/lxd/backups

gives this output:

lrwxrwxrwx 1 root root 62 Mar 17 15:00 /var/snap/lxd/common/lxd/backups -> /var/snap/lxd/common/lxd/storage-pools/bkp_pool/custom/bkp_vol

please advise

What storage driver is that pool on and what did you set the config key to?

sorry, I went with the nuclear option since I’m in a hurry.
the driver was dir and everything worked fine for one day.

there is a link at the top to the original post, I add those storage/volumes for backup purposes. worked fine, then lxd died

okay and that was on the stable 3.22 snap?

Do you remember how that pool was created? Was it using the source= option to point to a path somewhere on the filesystem?

I have default lxd snap installed, and it auto updates. So I guess it was the latest one.

these are the commands
lxc storage create bkp_pool dir source=/data/lxdbkp
lxc storage volume create bkp_pool bkp_vol
lxc config set storage.backups_volume bkp_pool/bkp_vol

after that I triggered export and it used /data/lxdbkp which is on another partition fine.

Okay, so it’s most likely an ordering issue with the source=/data/lxdbkp.
I’ll attempt to reproduce this here.

I’m sorry, I don’t understand which ordering issue.
The thing that puzzles me the most is that it actually worked…then it didn’t
In the meantime, I suspended my laptop couple of times, never restarted.

LXD never writes outside of the LXD path, so on startup your /data/lxdbkp is mounted over /var/snap/lxd/common/lxd/storage-pools/bkp_pool

This needs to happen before anything can deal with those directories.

just one question, the storage/volumes configuration and all the options, everything is in dqlite database?
I’m asking because if I need to fix the config while lxd is unresponsive, how I can do that?

The database documentation covers this.
There is a file that you can write in the database directory, statements included in it will be run immediately on startup. should fix your issue

ok, I will look into the doc. it would be good to have a cli tool which would let one manage the config of lxd even if lxd is not running