Building for core18: multipass issue

Hi all,

I also encountered the similar the issue when I used snapcraft to create a uc18 gadget for arm64:

    $ snapcraft cleanbuild --target-arch=arm64
    Setting target machine to 'arm64'
    Creating snapcraft-loudly-fresh-mole
    Starting snapcraft-loudly-fresh-mole
    ...
    You need multipass installed to build snaps which use the base keyword.
    Would you like to install it now? [y/N]: y
    snapd is not logged in, snap install commands will use sudo
    multipass (beta) 2018.12.1 from Canonical✓ installed
    Channel latest/beta for multipass is closed; temporarily forwarding to beta.
    Waiting for multipass...
    Setting target machine to 'arm64'
    Launching a VM.
    launch failed: modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.15.0-1030-oem/modules.dep.bin'
    modprobe: FATAL: Module msr not found in directory /lib/modules/4.15.0-1030-oem
    An error occurred when trying to launch the instance with 'multipass': returned exit code 2.
    Ensure that 'multipass' is setup correctly and try again.
    Error: not found
    Stopping local:snapcraft-loudly-fresh-mole
    An error occurred when trying to copy files using 'lxd': returned exit code 1

I ensure that multipass can be launched formally under the host, however, the snapcraft cleanbuild always failed to trigger the multipass/lxd.

Hi @woodrow, by saying

do you mean that multipass launch works fine on the host normally?

The following messages:

    launch failed: modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.15.0-1030-oem/modules.dep.bin'
    modprobe: FATAL: Module msr not found in directory /lib/modules/4.15.0-1030-oem
    An error occurred when trying to launch the instance with 'multipass': returned exit code 2.

suggest there’s something weird going on with your kernel packages. We’re using a tweaked kvm-ok script to check whether your host can do KVM. It fails loading the msr module that allows checking for BIOS support of virtualization. Can you check if you can modprobe msr and run the upstream kvm-ok script from the cpu-checker package?

If you would also please file an issue on our GitHub we can probably make this a non-fatal error in the check script.

Hi @Saviq,

Yes, after I met the issue, I tried to install mulitpass snap on host, and it did work with launch. There are actions I just went through:

$ lsmod | grep msr
msr                    16384  0
$ snap list
Name                  Version         Rev   Tracking  Publisher   Notes
core                  16-2.36.3       6130  stable    canonical✓  core
gnome-3-26-1604       3.26.0          74    stable/…  canonical✓  -
gnome-calculator      3.30.1          260   stable/…  canonical✓  -
gnome-characters      3.30.0          139   stable/…  canonical✓  -
gnome-logs            3.30.0          45    stable/…  canonical✓  -
gnome-system-monitor  3.30.0          57    stable/…  canonical✓  -
gtk-common-themes     0.1-4-g88bc1b2  818   stable/…  canonical✓  -
hw-probe              1.4-10          153   stable    linuxhw     -
multipass             2018.12.1       572   beta      canonical✓  classic
ubuntu-image          1.4+snap3       104   stable    canonical✓  classic
$ multipass launch
Launched: full-ribbonfish
$ multipass list
Name                    State             IPv4             Release
full-ribbonfish         RUNNING           10.127.219.211   Ubuntu 18.04 LTS
$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

Like above situation, the thing is very strange to me. Why does “snapcraft cleanbuild” need to trigger multipass and lxd at the same time?

Thanks, I will do that if someone also affected this symptom.

That one sounds like a snapcraft issue, cleanbuild is a legacy command that should have nothing to do with Multipass.

Ok, I filed a bug on launchpad to track the case I hit, https://bugs.launchpad.net/snapcraft/+bug/1811208

I’m getting this issue when trying to build a package:

$ multipass launch
One quick question before we launch … Would you like to help                    
the Multipass developers, by sending anonymous usage data?
This includes your operating system, which images you use,
the number of instances, their properties and how long you use them.
We’d also like to measure Multipass’s speed.

Send usage data (yes/no/Later)? no

Launched: spruce-dugong                                   
# multipass itself is working fine                      
$ snapcraft 
Launching a VM.
launch failed: Downloaded image hash does not match                             
An error occurred when trying to launch the instance with 'multipass': returned exit code 2.
Ensure that 'multipass' is setup correctly and try again.

The most annoying thing is that it redownloads the image each time so that debugging this is really painful. Are there workarounds for this issue?

I can’t even use cleanbuild instead :’(

snapcraft cleanbuild
The cleanbuild command is no longer supported when using the base keyword.

How do I directly build on the host system, nowadays?

Thanks a lot for your help!

Refer:

2 Likes

Thank you very much, this will work for now. You just saved my evening :wink:

Hi @TimSueberkrueb, this suggests something went wrong with the image snapcraft's using to build. Can you please try and multipass launch snapcraft:core16 (or core18 if that’s your base: in snapcraft.yaml)? The hash error is definitely coming from Multipass itself.

I don’t know why, but it works now, after having run multipass launch snapcraft:core18 manually. Thanks @Saviq!

FWIW I think you may have hit our bug #569. It probably resolved itself over time, after our HTTP cache expired.

1 Like

I’m experiencing the same thing now

$ multipass launch
launch failed: The following errors occurred:                                   
venerated-snapper: shutdown called while starting

$ multipass launch snapcraft:core18
launch failed: The following errors occurred:                                   
simple-garfish: shutdown called while starting

Hi @YamiYukiSenpai, could you please file this as an issue on our GitHub?

In the mean time, could you please also run:

$ multipass launch snapcraft:core18 -vvv

This will print more verbose logging to the console.

Thanks!

This happens to me a lot. I need to reboot and then ‘snapcraft’ command does not fail with the multipass error. Xenial.

I had similar error:

user@user# sudo snapcraft
Support for 'multipass' needs to be set up. Would you like to do that it now? [y/N]: y                                                                                                                    
snapd is not logged in, snap install commands will use sudo                                                                                                                                               
multipass (latest/beta) 0.8.0 from Canonical✓ installed
Waiting for multipass...                                                                                                                                                                                  
Launching a VM.                                                                                                                                                                                           
launch failed: failed to start qemu instance                                                                                                                                                              
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.  

Solved it by installing snapcraft from apt instead of snap

sudo snap remove snapcraft

sudo apt install snapcraft

1 Like

That is not a solution. You’re papering over the problem by installing an old version of snapcraft. You are missing a lot of new functionality by doing this, of which only one part is the multipass integration.

1 Like

Thanks @lucyllewy, good to know.

Running multipass launch snapcraft:core18 -vvv and getting the error launch failed: failed to start qemu instance , reboot or sudo does not help and same error on core16.
Running it on nanopi Duo2 (armv7l processor architecture).

Where is your kernel from? If you are using a Ubuntu derivative, the kernel does not have KVM enabled and thus multipass does not work (see LP bug https://bugs.launchpad.net/ubuntu/+source/linux-raspi2/+bug/1783961, the bug is for ARM64, but AFAIK the same problem exists for armhf).

However, multipass should be outputting more helpful debug information, but perhaps the fix (see https://github.com/CanonicalLtd/multipass/pull/948) has not landed in the beta channel yet, can you try snap refresh multipass --edge and run multipass launch snapcraft:core18 -vvv again to see what it outputs?

After installing snap edge sudo snap install snapcraft --edge --classic and executing sudo snap refresh multipass --edge I run the command and got an error:

user@user$ multipass launch snapcraft:core18 -vvv
[2019-09-02T17:36:01.106] [debug] [daemon] Loading AppArmor policy: 

#include <tunables/global>
profile multipass.dnsmasq flags=(attach_disconnected) {
  #include <abstractions/base>
  #include <abstractions/nameservice>

  capability chown,
  capability net_bind_service,
  capability setgid,
  capability setuid,
  capability dac_override,
  capability dac_read_search,
  capability net_admin,         # for DHCP server
  capability net_raw,           # for DHCP server ping checks
  network inet raw,
  network inet6 raw,

  # Allow multipassd send dnsmasq signals
  signal (receive) peer=snap.multipass.multipassd,

  # access to iface mtu needed for Router Advertisement messages in IPv6
  # Neighbor Discovery protocol (RFC 2461)
  @{PROC}/sys/net/ipv6/conf/*/mtu r,

  # binary and its libs
  /snap/multipass/1102/usr/sbin/dnsmasq ixr,
  /snap/multipass/1102/{usr/,}lib/@{multiarch}/{,**/}*.so* rm,

  # CLASSIC ONLY: need to specify required libs from core snap
  /snap/core18/*/{,usr/}lib/@{multiarch}/{,**/}*.so* rm,

  /var/snap/multipass/common/data/multipassd/network/dnsmasq.leases rw,           # Leases file
  /var/snap/multipass/common/data/multipassd/network/dnsmasq.hosts r,             # Hosts file

  /var/snap/multipass/common/data/multipassd/network/dnsmasq.pid w,     # pid file
}
    

launch failed: Failed to load AppArmor policy                                   
#include <tunables/global>
profile multipass.dnsmasq flags=(attach_disconnected) {
  #include <abstractions/base>
  #include <abstractions/nameservice>

  capability chown,
  capability net_bind_service,
  capability setgid,
  capability setuid,
  capability dac_override,
  capability dac_read_search,
  capability net_admin,         # for DHCP server
  capability net_raw,           # for DHCP server ping checks
  network inet raw,
  network inet6 raw,

  # Allow multipassd send dnsmasq signals
  signal (receive) peer=snap.multipass.multipassd,

  # access to iface mtu needed for Router Advertisement messages in IPv6
  # Neighbor Discovery protocol (RFC 2461)
  @{PROC}/sys/net/ipv6/conf/*/mtu r,

  # binary and its libs
  /snap/multipass/1102/usr/sbin/dnsmasq ixr,
  /snap/multipass/1102/{usr/,}lib/@{multiarch}/{,**/}*.so* rm,

  # CLASSIC ONLY: need to specify required libs from core snap
  /snap/core18/*/{,usr/}lib/@{multiarch}/{,**/}*.so* rm,

  /var/snap/multipass/common/data/multipassd/network/dnsmasq.leases rw,           # Leases file
  /var/snap/multipass/common/data/multipassd/network/dnsmasq.hosts r,             # Hosts file

  /var/snap/multipass/common/data/multipassd/network/dnsmasq.pid w,     # pid file
}
    : errno=1 ()

If snap edge isn’t good tell me and I will post another comment without the edge channel.

I am running

FriendlyCore (base on UbuntuCore), Kernel: Linux-4.14

One developer told me

You can build FriendlyElec’s Linux-4.14 by yourself according this wiki

If its help you better understand what kernel I am using.

Hi @guyluz11, it seems like your kernel does not have AppArmor support and we just enabled that on Multipass edge… This being a low-spec device, did you consider snapcraft --use-lxd to avoid the VM overhead?