Snapcraft without snapd

I think I know the answer but is there an official way to install Snapcraft without snapd?

There’s no supported way on Linux, but you can check out the sources and run from there. Of course you would have to solve the issue of installing other necessary components by hand, such as lxd.

Right, thanks. I’m certainly aware that doing so by hand is at least theoretically possible. I was hoping there was an established way!

I think the worst problem to work around will happen when craft-providers tries to inject the snapcraft snap into the build environment. @mr_cal, what happens in this case if Snapcraft is running from sources on an environment without snapd?

What about a flatpak of snapcraft? It would support more people building more snaps in more places :slight_smile:.

I guess part of the problem there is that there is a bunch of “shelling out” to snap and ubuntu-image?

A good reference would the snapcraft Dockerfile, where snapcraft is installed without snapd.

I think the worst problem to work around will happen when craft-providers tries to inject the snapcraft snap into the build environment.

This is an interesting thought. If snapd socket is unavailable or not working, craft-providers tries to manually pack the snap with snap pack. But if that command fails, an error is raised.

Using the environmental variable SNAPCRAFT_INSTALL_SNAP_CHANNEL=<channel> would install snapcraft from the store instead injecting. I’m not sure about the core snaps. This would be an interesting exploration.