The snapcraft build environment must be one of: 'host', 'managed-host', or 'multipass' Why?

Since this morning, the instruction on building with LXD does not seem to work. I got the following message:
The snapcraft build environment must be one of: 'host', 'managed-host', or 'multipass'.

I searched on this forum and sees the proposal of snapcraft VM build environment with multipass. However, this is no mention that SNAPCRAFT_BUILD_ENVIRONMENT=lxd is deprecated.

Also, what is the future plan with regarding to using containers (lxd and docker) vs VM solutions as a clean build environment? One concern with the VM is that it can’t take advantages of all the system resources for build as my build can be fairly large.

Thanks

4 Likes

Update: re-installing snapcraft seems to fixed it, but a while, the same behavior comes back. Can someone from the snapcraft team explain or document why this message shows up? It seems that I’m not the only one.
Thanks

I doubt this is not only deprecated, but also obsoleted.

For the snap building in non-snapcraft cleanbuild LXD containers, set SNAPCRAFT_BUILD_ENVIRONMENT=host seems to solve the issue, refer How to create a LXD container for snap development for a guide to create one.

I will try that. The instruction you reference seems to be from before the SNAPCRAFT_BUILD_ENVIRONMENT=lxd is introduced and involves many manual steps.

Do you know which commit/post talks about retires this feature? Multipass is not the solution since most likely I would require all available resource to build the project for dev purposes.

I found the commit that removed it. However, there seems to be some conflicting information here at the forum and release note and this commit message. They seems to say multi-pass becomes the default, but the existing path should not be broken. Even this commit message says that we should continue to be able to use the lxd build environment. However, the code removed the support if you read it.

For reference, here is the commit that removed the lxd build environment:

commit 27ec9ba63ef76cf48eada41f8ff9f91e7c38a211
Author: Sergio Schvezov <sergio.schvezov@canonical.com>
Date:   Wed Oct 10 15:41:07 2018 -0300

    lifecycle: remove lxd support for bases (#2335)
    
    cleanbuild and containerbuilds have not moved on to proper build environments.
    Support for LXD is slated to come back in the form of a build provider
    inherited class.
    
    Projects not using bases should be able to continue building using cleanbuild
    or lxd as a build environment setting.
    
    LP: #1796980
    
    Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com>
2 Likes