I’m trying to add system reboot capability to my snap. The relevant portions of my snapcraft.yaml
:
apps:
backend:
plugs:
- shutdown
backend:
stage-packages:
- systemd
- systemd-sysv
snap interfaces mirros-one
shows everything is set up correctly:
:shutdown mirros-one
However, when I run snap run --shell mirros-one.backend
and then inside the snap shell shutdown -r now "my message"
, I get the following error:
Failed to start reboot.target: Access denied
See system logs and 'systemctl status reboot.target' for details.
The backend service issues the exact same command. I’m assuming the snap run --shell mirros-one.backend
environment has the same privileges?
I checked that systemd
package indeed provides reboot.target
:
user@host:~$ dpkg -S reboot.target
systemd: /lib/systemd/system/reboot.target
… and that it is present in my snap:
user@host:~$ ls /snap/mirros-one/current/lib/systemd/system | grep reboot
reboot.service
reboot.target
reboot.target.wants
systemd-reboot.service
I feel like I’m missing something obvious, any hints are very much appreciated