I have an user-defined local service (created manually), let’s it call it borg.service
I was trying to create a snap for that same user to wrap the command for the user:
command: /bin/systemctl --user restart borg.service
However when I try to run this, I get a DBUS error.
First question: is it even possible ? I could install the service globally if it would allow me to use in the snap.
This is not possible with a strictly confined snap, unless the borg.service is a part of a snap. If it is part of the snap that you are using, you can do
snapctl restart $SNAP_NAME.borg, if you want to restart the service for another snap, you need to use the snapd REST API and snapd-control, which requires a brand store to use.
Thank you, we do have a brand store (how convenient), I’m going to look for the REST API and snapd-control documentation
While we do have experimental support for user daemons in snapd (gated behind a feature flag), I’m not sure whether
snapctl restart is supported yet. I know service control was hooked up for install/update/remove of a snap, but I’m not sure about the snapctl integration.