Daemon: dbus examples

Jamie Strandboge jamie at canonical.com
Mon Dec 12 21:33:45 UTC 2016


On Sat, 2016-12-10 at 14:29 +0100, l-snapcraft at znn.info wrote:
> Hi Snapcrafter,
> 
> in the documentation about keys in the yaml i saw a mention of "daemon:
> dbus" (1), but i could not find an explanation in the documentation of a
> real world example how it is used on github.
> 
> Can someone point me to an example snapcraft.yaml where i can see how it
> is used?
> Or other documentation that gets more into detail.
> 
> Thanks a lot.
> 
> Greetings,
> lightonflux
> 
> 1: http://snapcraft.io/docs/snaps/metadata
> 

I looked into this just now to give an overall status.

'daemon: dbus' was part of Ubuntu Core 15.04, it was only for system services
and it was removed in series 16 in favor of 'interfaces'. As of now,

1. snapd allows specifying 'daemon: dbus' but when you do it generates an
incomplete systemd service file:

/usr/lib/snapd/snapd[2329]: task.go:303: DEBUG: 2016-12-12T14:33:18-06:00 ERROR
[start snap.test-hello-dbus.test-hello-dbusd-system.service] failed with exit
status 1: Failed to start snap.test-hello-dbus.test-hello-dbusd-system.service:
Unit snap.test-hello-dbus.test-hello-dbusd-system.service is not loaded
properly: Invalid argument.#012See system logs and 'systemctl status snap.test-
hello-dbus.test-hello-dbusd-system.service' for details.

2. snapcraft doesn't allow you to specify it (which is good since the
implementation doesn't work correctly)

3. http://snapcraft.io/docs/snaps/metadata incorrectly lists it

4. https://github.com/snapcore/snapd/wiki/Snap-format also incorrectly lists it

I fixed '4' just now to remove the reference to 'dbus' and I filed a bug:
https://bugs.launchpad.net/snappy/+bug/1649399


In terms of what you can do with dbus today:
- you can use a named socket and a private bus for processes within your snap 
  to communicate 
- if you are snapping something that is covered by an existing interface[1], you
  can use that interface
- if you are snapping a service that is useful for more than just your snap, you
  can develop an interface for snapd

In snapd 2.20 we are working to have the 'dbus' generic interface in place[2].
With it you can specify the bus name (session or system), the well-known name to
bind to and then use interface connections to connect your client to your
service.

In a future version of snapd, service activation will be supported[3] (eg, for
session services) as well as running daemons on the session bus[4]. AIUI the
Ubuntu Personal folks are working on this and they have a design and the
implementation should start soon. Thanks!

[1]https://github.com/snapcore/snapd/wiki/Interfaces
[2]https://bugs.launchpad.net/snappy/+bug/1590679
[3]https://bugs.launchpad.net/snappy/+bug/1648990
[4]https://bugs.launchpad.net/snappy/+bug/1613420

-- 
Jamie Strandboge             | http://www.canonical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20161212/466bccdf/attachment.sig>


More information about the Snapcraft mailing list