lxd

permission denied on installing lxd via snap


I'm trying to install LXD on my Ubuntu via this tutorial https://docs.conjure-up.io/devel/en/user-manual#users-of-lxd in it says I have to follow these steps:

  1. sudo snap install lxd (no problem in installing)
  2. /snap/bin/lxd init (I get the below error)

Error: Failed to connect to local LXD: Get http://unix.socket/1.0: dial unix /var/snap/lxd/common/lxd/unix.socket: connect: permission denied

can anyone tell me how to fix it?


Solution

  • Looks like for some reason the permissions on the unix.socket are not correct. (I tried this myself and works fine). The permission on my unix.socket look like this:

    srw-rw----  1 root lxd     0 Nov  7 18:02 unix.socket
    

    I would try:

    sudo chown root:lxd /var/snap/lxd/common/lxd/unix.socket
    sudo chmod 664 /var/snap/lxd/common/lxd/unix.socket
    sudo chmod u+s /var/snap/lxd/common/lxd/unix.socket
    

    If not then it could be an issue with your /var/snap/lxd/common/lxd/ directory. Does it even exist?