Thanks for that. Now I am treated to a new error:
Launching a VM.
launch failed: The following errors occurred:
failed to determine IP address
An error occurred with the instance when trying to launch with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.
With the following new yml file:
name: unofficialkyc-cli
summary: The command line interface to the unofficialkyc platform.
description: |
The command line interface to the unofficialkyc platform.
version: git
base: bare
build-base: core18
grade: devel
confinement: devmode
parts:
cli:
plugin: go
source: .
source-type: git
apps:
cli:
command: bin/kycli
plugs:
- network
Trying with --use-lxd provides the following message:
An error occurred when trying to communicate with the 'LXD' provider: cannot connect to the LXD socket ('/var/snap/lxd/common/lxd/unix.socket')...
The LXD daemon service is definitely active:
$ systemctl status snap.lxd.daemon
● snap.lxd.daemon.service - Service for snap application lxd.daemon
Loaded: loaded (/etc/systemd/system/snap.lxd.daemon.service; static)
Active: active (running) since Wed 2020-09-09 13:05:31 CDT; 17s ago
TriggeredBy: ● snap.lxd.daemon.unix.socket
Main PID: 9529 (daemon.start)
Tasks: 0 (limit: 19037)
Memory: 28.3M
CGroup: /system.slice/snap.lxd.daemon.service
‣ 9529 /bin/sh /snap/lxd/16926/commands/daemon.start
Sep 09 13:05:32 lcnix lxd.daemon[9726]: - proc_uptime
Sep 09 13:05:32 lcnix lxd.daemon[9726]: - shared_pidns
Sep 09 13:05:32 lcnix lxd.daemon[9726]: - cpuview_daemon
Sep 09 13:05:32 lcnix lxd.daemon[9726]: - loadavg_daemon
Sep 09 13:05:32 lcnix lxd.daemon[9726]: - pidfds
Sep 09 13:05:33 lcnix lxd.daemon[9529]: => Starting LXD
Sep 09 13:05:35 lcnix lxd.daemon[9769]: t=2020-09-09T13:05:35-0500 lvl=warn msg=" - Couldn't find the CGroup blkio.w>
Sep 09 13:05:35 lcnix lxd.daemon[9769]: t=2020-09-09T13:05:35-0500 lvl=warn msg=" - Couldn't find the CGroup hugetlb>
Sep 09 13:05:36 lcnix lxd.daemon[9529]: => First LXD execution on this system
Sep 09 13:05:36 lcnix lxd.daemon[9529]: => LXD is ready
Update: I found out from an @cjp256 that this was a problem of my not being added to the lxd group (which it seems like it should be done upon installation of snapcraft if it’s necessary ;p). Then I encountered this error:
➜ unofficialkyc-cli git:(master) ✗ snapcraft --use-lxd
Launching a container.
An error occurred with the instance when trying to launch with 'LXD': No storage pool found. Please create a new storage pool.
Ensure that 'LXD' is setup correctly and try again.
Which I had to solve by runnign lxd init, which I think should also be suggested in the help method here or perhaps even invoked.
Running snapcraft --use-lxd now shows:
Launching a container.
Build environment is in unknown state, cleaning first.
Waiting for container to be ready
To start your first instance, try: lxc launch ubuntu:18.04
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /lib/systemd/system/systemd-networkd.service.
Waiting for network to be ready...
Failed to setup networking.
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package udev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
systemd
E: Unable to locate package dirmngr
E: Package 'udev' has no installation candidate
E: Unable to locate package fuse
An error occurred when trying to execute 'apt-get install dirmngr udev fuse --yes' with 'LXD': returned exit code 100.
And that’s where I’m currently stuck, as I have no idea what the problem is here (Where is this output coming from? Is it trying to install packages on my computer? The “VM” it’s running? How do I get the VM into a state where it can resolve DNS entries? What is being symlinked here? etc.)
Trying to run it again produces a similar but not identical error:
Launching a container.
Build environment is in unknown state, cleaning first.
Waiting for container to be ready
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /lib/systemd/system/systemd-networkd.service.
Waiting for network to be ready...
Failed to setup networking.
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package udev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
systemd
E: Unable to locate package dirmngr
E: Package 'udev' has no installation candidate
E: Unable to locate package fuse
An error occurred when trying to execute 'apt-get install dirmngr udev fuse --yes' with 'LXD': returned exit code 100.
After running systemctl reload snap.lxd.daemon
(and trying the --debug flag I’ve seen a couple times) I got an again, similar, but non-identical error, after a much shorter period of time:
➜ unofficialkyc-cli git:(master) ✗ snapcraft --use-lxd --debug
Launching a container.
Build environment is in unknown state, cleaning first.
Waiting for container to be ready
Created symlink /etc/systemd/system/dbus-org.freedesktop.network1.service → /lib/systemd/system/systemd-networkd.service.
bWaiting for network to be ready...
Err:1 http://archive.ubuntu.com/ubuntu bionic InRelease
Could not connect to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
Err:2 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Unable to connect to archive.ubuntu.com:http:
Err:3 http://security.ubuntu.com/ubuntu bionic-security InRelease
Could not connect to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable)
Reading package lists... Done
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Could not connect to security.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Could not connect to archive.ubuntu.com:80 (2001:67c:1562::18). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1562::15). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1360:8001::24). - connect (101: Network is unreachable) Could not connect to archive.ubuntu.com:80 (2001:67c:1360:8001::23). - connect (101: Network is unreachable)
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Unable to connect to archive.ubuntu.com:http:
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package udev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
systemd
E: Unable to locate package dirmngr
E: Package 'udev' has no installation candidate
E: Unable to locate package fuse
An error occurred when trying to execute 'apt-get install dirmngr udev fuse --yes' with 'LXD': returned exit code 100.
Restarting the daemon with systemctl restart snap.lxd.daemon
causes it to revert to the old error already pasted here several times. Disconnecting from my VPN and setting /etc/resolv.conf to point to 1.1.1.1 then reloading, also didn’t do anything, as far as I could tell. The hack a person mentions in this thread also doesn’t work, though curiously I did not have an etc/resolv.conf file in my /snap/lxd/current directory in the first place.
At this point I decided to try using core20 for the build instead of core18; didn’t change anything, with or without --use-lxd. Also tried to install httplab from this guide; I get the same “failed to find IP address” and DNS resolution errors. I suspect that both LXD and multipass are failing to work because of the same networking configuration problems, but I don’t know what that might be.
@cjp256 suggested I run the ip addr
command via lxc exec
for diagnostic purposes but it appears the container doesn’t have ip
installed, or at least it’s outside of the PATH.
Update: the problem turned out to lie in my firewall settings. I use default UFW, which denies incoming traffic. The command ufw allow in on lxdbr0
looks like it fixed the problem I was having earlier where it couldn’t download updates. My firewall settings are not unique; anecdotally I thought it was the most comonworking configuration on linux desktops to deny unsolicited inbound traffic, so it’s strange this problem isn’t mentioned anywhere except in some LXD forum links.