Trouble building Snapd with Snapcraft

I’m trying to build Snapd as described in its HACKING.md document.

I installed the channel 4.x version of it:

$ snap list snapcraft
Name       Version  Rev   Tracking    Publisher   Notes
snapcraft  4.8      6512  4.x/stable  canonical✓  classic

But when I try snapcraft, it fails both with Multipass and Lxd:

$ snapcraft -d --use-lxd
Launching a container.
Build environment is in unknown state, cleaning first.
Waiting for container to be ready
Timed out waiting for systemd to be ready...
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-resolved.service, pointing to /lib/systemd/system/systemd-resolved.service.
Created symlink /etc/systemd/system/multi-user.target.wants/systemd-networkd.service, pointing to /lib/systemd/system/systemd-networkd.service.
Created symlink /etc/systemd/system/sockets.target.wants/systemd-networkd.socket, pointing to /lib/systemd/system/systemd-networkd.socket.
Failed to connect to bus: No such file or directory
An error occurred when trying to execute 'systemctl restart systemd-resolved' with 'LXD': returned exit code 1.
$ snapcraft -d
Launching a VM.
Build environment is in unknown state, cleaning first.
info failed: The following errors occurred:
instance "snapcraft-snapd" does not exist
launch failed: Remote "snapcraft" is unknown or unreachable.
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.

I couldn’t find a working solution when searching for each of those error messages.

In case it is useful:

$ ps aux|grep -e bus -e systemd
root         556  0.0  0.2  64824 23560 ?        S<s  07:43   0:01 /lib/systemd/systemd-journald
root         617  0.0  0.0  27680  7868 ?        Ss   07:43   0:02 /lib/systemd/systemd-udevd
systemd+     956  0.0  0.1  26800 14836 ?        Ss   07:43   0:03 /lib/systemd/systemd-resolved
systemd+     957  0.0  0.0  89324  6576 ?        Ssl  07:43   0:00 /lib/systemd/systemd-timesyncd
message+    1019  0.0  0.0   9992  5664 ?        Ss   07:43   0:02 @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root        1033  0.0  0.1  48376  8080 ?        Ss   07:43   0:00 /lib/systemd/systemd-logind
root        1034  0.0  0.1 138972  9408 ?        Ssl  07:43   0:00 /usr/sbin/thermald --systemd --dbus-enable --adaptive
nteodos+    1152  0.0  0.1  17764 10332 ?        Ss   07:43   0:02 /lib/systemd/systemd --user
nteodos+    1302  0.0  0.0   9340  5080 ?        Ss   07:43   0:01 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
nteodos+    1577  0.0  0.0 309660  7640 ?        Ssl  07:44   0:00 /usr/libexec/at-spi-bus-launcher
nteodos+    1585  0.0  0.0   8428  4288 ?        S    07:44   0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 11 --address=unix:path=/run/user/1000/at-spi/bus_0

Things I already tried

I also repeated the snapcraft command after trying these:

/etc/init.d/dbus
export XDG_RUNTIME_DIR="/run/user/$UID"
sudo loginctl enable-linger "$USER"

Checked that dbus-user-session is installed.

Hi, I found a fix for the multipass version here https://forum.snapcraft.io/t/snapcraft-stopped-working-issuing-multipass-error/30157?u=faliagas. Maybe you’d like to check it out.

1 Like

For me this wasn’t a solution. See

This happens after a multipass updated, now I’m unable to build snaps