I have a snap that will need to reboot the system via a command. When issuing the command, the application throws an error stating: “operation not permitted”.
To reboot the machine, I am using:
err := syscall.Reboot(syscall.LINUX_REBOOT_CMD_RESTART)
How do I give my snap rights to do this command? Is there a way to give sudo privileges to snaps?
Here is my yaml:
name: cm # you probably want to 'snapcraft register <name>'
version: '1.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: |
This is my-snap's description. You have a paragraph or two to tell the
most important story about your snap. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the snap
store.
grade: stable # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
apps:
cm:
command: cm
daemon: simple
restart-condition: always
plugs: [network-bind]
parts:
cm:
# See 'snapcraft plugins'
plugin: dump
source: ./dist