I’m trying to build a snap and ran into problems with LXD not being able to create a listening socket. I removed the LXD snap but I can’t even get it installed now:
$ snapcraft
LXD is required but not installed. Do you wish to install LXD and configure it with the defaults? [y/N]: y
lxd 5.18-762f582 from Canonical✓ installed
Error: Failed to create local member network "lxdbr0" in project "default": The DNS and DHCP service exited prematurely: exit status 2 ("dnsmasq: failed to create listening socket for fd42:9056:e5c5:f475::1: Address already in use")
Traceback (most recent call last):
File "/snap/snapcraft/9542/lib/python3.8/site-packages/craft_providers/lxd/lxd.py", line 64, in init
subprocess.run(cmd, check=True)
File "/snap/snapcraft/9542/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['sudo', 'lxd', 'init', '--auto']' returned non-zero exit status 1.
netplan
doesn’t report anything listening on the above address.
Can anyone point me in the right direction?
UPDATE: I found here some explanation as to what happens. Apparently dnsmasq
was too eager to listen on all interfaces, including lxbr0
. I limited it to lo
and enp2s0
, and then LXD could auto-init itself.
But I still can’t build anything because of LXD complaining about missing network access:
$ snapcraft
Launching instance... \ (51.8s) Traceback (most recent call last):
File "/snap/snapcraft/9542/lib/python3.8/site-packages/craft_providers/bases/buildd.py", line 132, in _execute_run
proc = executor.execute_run(
File "/snap/snapcraft/9542/lib/python3.8/site-packages/craft_providers/lxd/lxd_instance.py", line 289, in execute_run
return self.lxc.exec(
File "/snap/snapcraft/9542/lib/python3.8/site-packages/craft_providers/lxd/lxc.py", line 371, in exec
return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check
File "/snap/snapcraft/9542/usr/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-ymuse-on-amd64-for-amd64-41419128', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'SNAPCRAFT_MANAGED_MODE=1', 'apt-get', 'update']' returned non-zero exit status 100.
...
craft_providers.bases.errors.NetworkError: A network related operation failed in a context of no network access.
Verify that the environment has internet connectivity; see https://craft-providers.readthedocs.io/ for further reference.
What also amazes me is that I never had any issue with LXD or network up to today, I used to build snaps without any issue. I’ve no idea what’s changed now. Please help.
UPDATE: why is this marked spam for god’s sake?