5

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?

Rico
  • 58,485
  • 12
  • 111
  • 141
ksadjad
  • 593
  • 8
  • 20

2 Answers2

4

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?

Rico
  • 58,485
  • 12
  • 111
  • 141
0

Proper way according to Ubuntu page is:

  1. sudo apt install lxd
  2. sudo lxd init
  3. sudo adduser <your-user> lxd
  4. newgrp lxd

Now you are ready to launch:

  • lxc launch ubuntu:22.04 test
Philipp
  • 1,191
  • 1
  • 14
  • 16