Question about process_control interface

Hey Guys,

I have a some questions about this interface.

  1. How is like to Stop a service via this Interface?
  2. Its possible to disable an own service, which we provide via snaps?
  3. How to start a Service with that?

I ask, because our software is like modular based with kind of connectors from other java services and we want to control them like start/stop/disable with specify commands.
I want only control or own installed snaps all other services should not be touched.

It exist an “friendly” way that makes possible?

in simliar I would like to use the systemd1.manager dbus interface with this options.

I guess when I like call snap stop snapapp from my java app via subcmd it will be comes an apparmor denial, correct?

Cheers and have a nice weekend


often it helps to take a look at the interface code:

Quoting from the code:

# Description: This interface allows for controlling other processes via
# signals, cpu affinity and nice.

so using something like kill -9 <pid> to send a signal to another process should work …

now, to obtain the pid for a process you want to control, you might also need the “system-observe” interface…

(note though that the interface is called “process-control”, not “service-control” so you can only crontrol something on the process level, it would need an additional interface to actually allow you to control systemd services on a higher level)

are you wanting to stop a service in one snap from a different snap, or are they all in the same snap?

@ogra, yeah I had taken a look into that code, but we have some kind of module snaps for kind of dataconnectors where we want to control from other snaps, like a service-control where can be like only permitted to own snaps.

@chipaca this are different snaps, where we want control from one snap.

We don’t have an interface for systemctl or service management via the DBus API because the policy would give device ownership to the snap. Your management snap could use the ‘snapd-control’ interface to do this (you can use the rest API then and also snap start|stop|restart), but please note its use in the public Snap Store is restricted (if you have a brand store you can use it as often as you like).

Hey @jdstrand, yeah I have build now a small python snap where we shipped with our custom images to manage our services, we have exclude all other system snaps from there so that other snaps can be installed as the predefined where we provide.