Permission denied on /var/snap/lxd/common/lxd/unix.socket everytime snap updates lxd

I have multiple systems where i have lxd installed on via snap, but on one system i keep getting an error once in a while regarding the unix.socket which does not have the correct permissions.

Error: Get "http://unix.socket/1.0": dial unix /var/snap/lxd/common/lxd/unix.socket: connect: permission denied

At that time the permission are the following:

srw-rw---- 1 root root 0 May 31 20:09 /var/snap/lxd/common/lxd/unix.socket

I then need to run:

sudo chown root:lxd /var/snap/lxd/common/lxd/unix.socket

to get it working again.

What can i do to have this fixed permanently?

Thanks in advance!

Hi @BlackDex,
I’m not so sure but you can change that file /etc/systemd/system/snap.lxd.daemon.unix.socket and add the
SocketUser=root
SocketGroup=lxd
parameters after the SocketMode
After changing the parameter make sure daemon-reload should be executed.
Regards.

It sounds like you’re having an issue with the snap.lxd.activate job which is the one resolving permission issues on refresh.

Can you run snap services lxd to make sure that the lxd.activate service isn’t somehow disabled? (it should normally report as enabled inactivate)

That seems to be the issue indeed:

$ snap services lxd
Service          Startup   Current   Notes
lxd.activate     disabled  inactive  -
lxd.daemon       enabled   active    socket-activated
lxd.user-daemon  enabled   inactive  socket-activated

Ok, i checked the systemctl list-unit-files | grep snap and it looks like for some reason it was disabled there. I have now enabled it again, and it show the correct status now.

I will check if there are some other discrepancies as well.

Thanks for pointing me into the right direction!