Post Ubuntu and LXD Migration : Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory

@stgraber et al

I migrated from Ubuntu 17.10 --> 18.04. LXD 2.21 --> 3.1. While creating profile using my config (that worked well with LXD v2.21) I get following error: Get http://unix.socket/1.0: dial unix /var/lib/lxd/unix.socket: connect: no such file or directory

Following is my config info: Not sure what may have changed. Interestingly it worked well with my first migration (@ month back) on other machine Ubuntu 18.04 and LXD v3.0. Thoughts?

config {
boot.autostart =“true”
linux.kernel_modules = “bridge,br_netfilter,x_tables,ip_tables,ip_vs,ip_set,ipip,xt_mark,xt_multiport,ip_tunnel,tunnel4,netlink_diag,nf_conntrack,nfnetlink,overlay”
raw.lxc= “lxc.apparmor.profile = unconfined\nlxc.cgroup.devices.allow = a\ sys:rw cgroup:rw\nlxc.cap.drop =”
cgroup:rw\nlxc.cap.drop ="
security.nesting = “true”
security.privileged = “true”

That error message means that the LXD client (the lxc command) is unable to find a running LXD service.
In most cases relating to a LXD upgrade to the snap package, this has to do with the lxc command from the previous LXD installation. That is, most likely you are running the old lxc client instead of the new one from the snap package.

To verify, run

which lxc

It should say /snap/bin/lxc for the new snap package.

If indeed you get /snap/bin/lxc but still get the error, then the LXD service is not running.

Thanks @simos I am able to init LXD successfully with default storage, network. profile, container with default profile. Not sure if this issue is related with config parameters.

Following is the output based on your suggestions:

$which lxc
$ps ax | grep lxd
2585 ? Ss 0:00 /bin/sh /snap/lxd/7412/commands/daemon.start
3724 ? Sl 0:00 lxcfs /var/snap/lxd/common/var/lib/lxcfs -p /var/snap/lxd/common/
3732 ? Sl 0:03 lxd --logfile /var/snap/lxd/common/lxd/logs/lxd.log --group lxd
7607 ? S 0:00 dnsmasq --strict-order --bind-interfaces --pid-file=/var/snap/lxd/common/lxd/networks/lxdbr0/ --except-interface=lo --interface=lxdbr0 --quiet-dhcp --quiet-dhcp6 --quiet-ra --dhcp-no-override --dhcp-authoritative --dhcp-leasefile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.leases --dhcp-hostsfile=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.hosts --dhcp-range,,1h -s lxd -S /lxd/ --conf-file=/var/snap/lxd/common/lxd/networks/lxdbr0/dnsmasq.raw -u lxd

$sudo lxd
[sudo] password for xxxxxx:
EROR[06-20|20:21:05] Failed to start the daemon: LXD is already running
Error: LXD is already running

I think I found reason behind this issue. Plugin that I am using is pointing to older location and hence this error. New path is: /var/snap/lxd/common/lxd/unix.socket

Fix is:

$sudo ln -s /var/snap/lxd/common/lxd /var/lib/lxd


2020…new install and faced this problem!! …thanks for symlink solution!!

What happened here is that you have installed LXD twice on your systems.
First the DEB package, and then the SNAP package.
By doing this symlink, you are using the client software of the DEB package with the server LXD software from the snap package. Most likely, you are running the LXD 3.0 client software with the LXD 4.0 server software, which might cause issues and certainly you miss out of features of the LXD 4.0 client.

What you need to do, is remove the LXD 3.0 (DEB) client so that the client of the LXD 4.0 snap package is not masked any more.

sudo apt remove lxd-client -y
hash -r

Thank you! This solved my problem

We are discussing this on LXD Error: Get "http://unix.socket/1.0": dial unix /var/snap/lxd/common/lxd/unix.socket: connect: connection refused