Support "ask for reboot" via snapcraft.yaml and snapd

We often have the case that customer snaps in Ubuntu Core will require a re-boot after refresh (to init certain config values or hardware changes etc).

Today such snaps require you to add something like dbus-send to your snap, craft a script (or binary or whatever) to talk to dbus and make your script use the snapd shutdown interface. This is a lot of extra code to maintain in these snaps, while snapd already knows how to manage shutdown when you get a kernel or core update.

I’d like to propose to open up this reboot feature via an option set in snapcraft.yaml/snap.yaml so snaps can just set this option and snapd will automatically trigger its builtin reboot process.

1 Like

Can you provide us with a real example. I’m sure the case is real but having a test case to work against would be helpful.