[systemd-devel] dbus user services using the session bus

Kok, Auke-jan H auke-jan.h.kok at intel.com
Wed Apr 3 09:48:46 PDT 2013


On Wed, Apr 3, 2013 at 6:22 AM, Will Stephenson <wstephenson at kde.org> wrote:
>
> I'm joining the flock of desktop people investigating using systemd to start a desktop session.  So far I've checked out user-session-units and have created some more granular unit files that will do a native systemd start rather than u-s-u's wrapper around the upstream start script.

As Tom asked, I'm interested in these changes as well - do you have
your code posted somewhere?

Also, you're saying there's a "start script" somewhere, can you tell
me what you mean by that?

I don't understand what you refer to by "wrapper", either. Technically
user-session-units doesn't wrap anything, it just provides straight
unit files. One of them is derivative of user at .service from systemd,
sure.

> I'm stuck now, because I want to start a service with Type=dbus that puts a service on the session bus, however, I can't see a way to specify the bus in the unit file.

you can insert variables into the user session by `systemctl --user
set-environment DBUS_S....`. This is the only way to globally assign a
dbus address to the session, but you'll have to do it before any
significant service runs in the first place, which includes before
dbus starts.

> I don't want to use dbus activation here to start the service as that invokes the chicken-egg problem that the service in question (kdeinit) job is to start all the processes that will be calling it via dbus later. Long term I would like to do away with this and perform this task via systemd too, but Type=dbus on the session bus seems like a valid use case that should work.
>
> I see there's a way to get the dbus session bus address into systemd because of the patch to fix this in user-session-units; would the right approach be to add a BusInstance= field to service and use the provided session bus address when watching for Type=dbus services that depend on user/dbus.service?

all of this stuff seems to work just fine with user-session-units - of
course the login/DM integration is wholly missing right now, but could
you start with user-session-units and make modifications to get where
you want?

Cheers,


Auke


More information about the systemd-devel mailing list