Snap is not removable

Hi,

Other than gadget,kernel and base snap, I added Hello snap to model assertion file and generated UC20 image.Then I tried to remove the Hello snap from the Ubuntu terminal. But I am not able remove the snap and seeing below log.

$snap remove Hello.
error: cannot remove “Hello”: snap “Hello” is not removable: snap is required

The snaps which are added to the model assertion file can not be removed?
Does model assertion file define the snaps which should be present in recovery mode?

That is correct.

Not sure about this bit, I expect that is also true.

i think this is managed by the presence: field in the model assertion… setting it to “optional” should make the snap removable i think …

1 Like

Thank you @futuretim and @ogra . :clap:

current test shows like Hello snap is not present in recovery mode and Hello app is present in run mode.

I need to understand Model assertion files as Ogra suggested. I started another thread for discussing recovery partitions and will update the test updates there.That will help us to get contents under proper label.

Yes, able to remove after setting presence: optional

1 Like

Thank you for posting something like this.

1 Like

Also note that you can have snaps present in different modes with the modes setting for individual snaps, from the docs:

  • modes (optional): a list with UC20 modes (verbs, “run”) or mode aliases for which the snap needs to be installed (“ephemeral”, for recover and install modes).
    Default is [run] which should not be used for types kernel|gadget and for the snap indicated by the “base” header.
    For “recovery” and “install” modes, “ephemeral” can be used. This will install the snaps only while the system is in an ephemeral state (running from tmpfs). They will not be installed on ubuntu-data unless explicitly declared, such as with [run, ephemeral], although those snaps will still reside on ubuntu-seed.

(from same linke @ogra shared)

So if you want your snap present in recovery mode you can use modes: [run, recover] for example

1 Like