Launching a VM.
launch failed: qemu-system-x86_64: cannot set up guest memory 'pc.ram': Cannot allocate memory
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 host was running Ubuntu 18.04.2 and free showed that it had 700+ megabytes available.
Given that the host Ubuntu was not taking up much memory, I would expect that the VM snapcraft created (which is also Ubuntu, right?) should be fine as well.
After a brief search, I could not find any guidance on how to troubleshoot this error. Is it possible to configure multipass or qemu to use less memory?
Checkout the SNAPCRAFT_BUILD_ENVIRONMENT_MEMORY environment variable:
by default it allocates 2GiB (the documentation is wrong but I currently can’t fix it)
One of the downside of a VM build is that it will always allocate all memory even if the guest OS isn’t use much. You might want to try building it in an LXD container instead.