Snap commands from within Snap

Hello,

I am experimenting with a system that runs on a server or device. The concept is that there is a main control snap application that reaches out to an external API and receives some data. Based on the data, it would install one or more other snaps.

I wouldn’t package these at build time, it would be configured during runtime.

The thought was that I could call ‘snap install’ form within the container, and I swear this worked at some point, but seems to no longer work. It is possible I manually installed the snap using ‘unsafe’.

Is it possible to run snap commands form within a snap? I thought I had this working at some point but seems now I get “Permission Denied”.

I have tried “confinement: classic” as well as adding “snapd-control” to my plugs, but neither seem to work.

I have searched around for something like this but cannot find an example of this working, or discussion about this. Any help would be appreciated.

Thank you, Rob

Snapcraft itself uses confinement: classic, and installed with --classic and makes use of snaps calling other snaps. As soon as classic is used, there is no container or confinement of any sort (in practical terms).