Building Snaps on Solus

I’ve been trying to build a snap on Solus. By default, snapcraft tries to run multipass and fails with the errror launch failed: Failed to set iptables rule for table mangle: iptables: No chain/target/match by that name. If I add SNAPCRAFT_BUILD_ENVIRONMENT=host, I get an error saying Native builds aren't supported on Solus. Given snap comes prepackaged with Solus now I’m not sure why native builds wouldn’t be supported and I’m wondering how I should go about building snaps then?

1 Like

@hmnd I’ve had that issue myself.

Pretty sure I used base: core18 to bypass it. Give it a go and add it to your snapcraft.yaml file.

No luck with that, either. snapcraft init already has base: core18 as the default.

I’ve got the same problem on Solus.

Hi, thank you for trying snapcraft on Solus.

Use of SNAPCRAFT_BUILD_ENVIRONMENT is not really supported, I would appreciate if you can point me to any documentation mentioning this.

The reason --destructive-mode (building on host) will not work on Solus is that there is no matching base for Solus nor is there a way to handle build-packages or stage-packages which are in a way, tied to the base in use.

While I will need to leave sorting out the multipass issue to @Saviq, you can also try using LXD by passing --use-lxd in the CLI (consider installing and running lxd init prior).

Hey,

There’s no documentation mentioning that that env variable is supported, but that’s just one of the things I tried to get it to work.

Using LXD works, however! Thanks for your help!

Doing a search on the documentation website shows up:

It isn’t linked in the sidebar on the left, but is discoverable from https://snapcraft.io/docs/docs-roadmap. It’s also clearly out of date, claiming that Snapcraft 3.x doesn’t support LXD builds.

For what it is worth, I ended up switching my Github action from the --use-lxdcommand line argument to SNAPCRAFT_BUILD_ENVIRONMENT=lxd because it was more reliable. If you’re building an old project that doesn’t include the base: keyword, Snapcraft re-execs to the legacy version which supports the latter but not the former. Combined with cargo culting from old guides, this could cause people to favour the environment variable.

2 Likes