Multipass/VMs by default discourages newcomers

Bug #1859424 reported by Loïc Minier
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

Hi,

Snapcraft by default will try to install and use multipass to build snaps. This is for reproducibility of the build, as to ensure the rootfs and the kernel are well defined when building a snap.

I'm regularly introducing snapcraft to new persons and had a series of newcomers that struggled creating their first snap because of the multipass by default behavior.

Recently, I had two persons on macOS running Ubuntu in a VM that spent hours figuring out why things were not working from their Ubuntu VM because they hadn't enabled nested virtualization and multipass couldn't create a nested VM in their manually managed VM. Today, a new snapcraft user running an Ubuntu VM under Windows was hit by the same thing. I also had a person in my team iterating over snap builds that found the builds super slow because he hadn't noticed that snapcraft switched from LXD to multipass behind the scenes.

How could snapcraft do a better job?
 ⋅ snapcraft could make a prominent statement about the fact it's about to use multipass
 ⋅ snapcraft could detect availability of KVM extensions before trying to launch multipass or availability of a working multipass setup, or could fallback on LXD
 ⋅ documentation could be changed to explain the differences between running snapcraft natively vs running it in a VM and requirements for that VM setup
 ⋅ more ambitiously, snapcraft could distinguish between release and non-release builds and give a default fast/debug debug good for iterations with a fat warning that --release should be used for a release build

Best,
- Loïc Minier

Revision history for this message
Loïc Minier (lool) wrote :

For the record, outside of another bug with automatic install of multipass (bug #1859427), this is what happens if I try building a snap under a VM that doesn't support nesting (a multipass provided vm):
ubuntu@tireless-panther:~/s$ snapcraft
Launching a VM.
launch failed: The following errors occurred:
snapcraft-webface: shutdown called while starting
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.

Revision history for this message
Michał Sawicz (saviq) wrote :

Hi @Loïc, one thing we improved in the 1.0 is "health checks" and related messages. We're trying to detect that virtualization is indeed possible and let the user know - failing early with a verbose error message.

If that doesn't happen in certain scenarios, we'd be interested to know and would like to fix.

We'll have a look at the two scenarios you mentioned, please keep them coming if you find more.

Revision history for this message
Michał Sawicz (saviq) wrote :
Revision history for this message
Michał Sawicz (saviq) wrote :

Another data point:

Multipass edge (since fixing https://github.com/canonical/multipass/issues/1312) will print much nicer error messages, depending on where the problem lies:

$ multipass exec primary -- snap run multipass launch snapcraft:core18
launch failed: The following errors occurred:
qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
evolved-peacock: shutdown called while starting

$ multipass exec primary -- snap run multipass launch snapcraft:core18 --mem 256M
launch failed: CPU does not support KVM extensions.

Revision history for this message
Colin Ian King (colin-king) wrote :

Just like to add that when building natively on non-x86 hardware (such as s390x or ppc64el) there are no multipass implementations that currently work so once cannot build a snap on this hardware. This discourages me from building and testing snaps locally.

Revision history for this message
Michał Sawicz (saviq) wrote :

@colin-king, if you can get us access to such hardware that has KVM capabilities, we'd love to fix whatever's not working.

Revision history for this message
Christopher Townsend (townsend) wrote :

I think snapcraft should automatically fall back to using LXD if Multipass is not available on a particular architecture.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.