Permission denied to run lxc list after an snap update

I run the following as a user in the lxd group:

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

Then I run the same command as root without problem. I see two containers, one stopped and the other running. I stopped the running container. Then I run the lxc list again as daniel, and this time the command listed the containers, and I can run other lxc commands with that user.

I guess that the issue is related with the fact that sockets get broken when the lxd snap was automatically updated as was suggested in Do you think this issue was related to the automatic update?

If lxc list as user daniel used to work, but momentarily does not work (permission denied), then this is one indication that the snap package of LXD is updating now. It takes a few moments, and then gets updated. The containers continue to run (they do not reboot), but you have to run again any lxc exec shells.

You mention that you did sudo lxc on the containers, and a bit later you could run lxc as a non-root user. Again, this looks like the snap update was completed as soon as tried to run the sudo lxc commands, which then made it possible to run lxc as a non-root user.

When it first happened to me (badge of honor that you use LXD so much that you stumbled upon a snap update), I was confused with the permission denied error. I would have expected some message that the Unix socket is dead instead. Probably something special happens internally that causes the permission denied.

As it is mentioned in the github issue, I think that we should all start scheduling any LXD updates to happen at an ungodly hour.