<p dir="ltr">Well, the systemd side is already there – if you have kdbus, it'll create a user bus there, and if you have traditional dbus.service + dbus.socket, systemd will also happily connect to that.<br>
</p>

<br><div class="gmail_quote">On Tue, May 26, 2015, 23:46 Chris Morgan <<a href="mailto:chmorgan@gmail.com" target="_blank">chmorgan@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, May 26, 2015 at 4:05 PM, Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>> wrote:<br>
> On Tue, May 26, 2015 at 10:32 PM, Chris Morgan <<a href="mailto:chmorgan@gmail.com" target="_blank">chmorgan@gmail.com</a>> wrote:<br>
>><br>
>> On Tue, May 26, 2015 at 3:22 PM, Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>><br>
>> wrote:<br>
>> > On Tue, May 26, 2015 at 9:33 PM, Chris Morgan <<a href="mailto:chmorgan@gmail.com" target="_blank">chmorgan@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> But I can't seem to figure out how to do the same for user units.<br>
>> >> There doesn't seem to be an org.freedesktop.systemd1 interface on my<br>
>> >> current user's session bus and I wasn't able to spot anything in the<br>
>> >> interfaces on the system bus that had a nested interface of<br>
>> >> org.freedesktop.system1.Manager...<br>
>> ><br>
>> ><br>
>> > The first "org.freedesktop.systemd1" here is a /service/ name; the usual<br>
>> > hierarchy is bus - service - object - interface - method, no such thing<br>
>> > as<br>
>> > nested interfaces.<br>
>> ><br>
>> > Anyway. The user processes are not allowed to own service names on the<br>
>> > system bus. And `systemd --user` is a per-user service, not a<br>
>> > per-session<br>
>> > one, so it cannot be on the session bus for various reasons: it doesn't<br>
>> > know<br>
>> > the bus address; it needs to outlive the session bus; the user might<br>
>> > sometimes have multiple sessions with their own 'session bus' instances.<br>
>> ><br>
>> > So the idea is that `systemd --user` would be found on the /user/ bus,<br>
>> > which<br>
>> > would someday replace the 'session' bus entirely.<br>
>> ><br>
>> > But right now, the 'user' bus does not exist by default. To create it,<br>
>> > you<br>
>> > need either<br>
>> > a) enable/install/boot with kdbus,<br>
>> > or b) obtain the "dbus.service" & "dbus.socket" user units. (They're in<br>
>> > dbus-git, or various other places like<br>
>> > <<a href="https://wiki.archlinux.org/index.php/Systemd/User#D-Bus" target="_blank">https://wiki.archlinux.org/index.php/Systemd/User#D-Bus</a>>.)<br>
>> ><br>
>> > Configured this way, the 'user' bus won't replace the session bus yet,<br>
>> > but<br>
>> > you *will* be able to connect to it and reach systemd, at address<br>
>> > "kernel:path=/dev/kdbus/$UID-user/bus;unix:path=$XDG_RUNTIME_DIR/bus".<br>
>> ><br>
>> > --<br>
>> > Mantas Mikulėnas <<a href="mailto:grawity@gmail.com" target="_blank">grawity@gmail.com</a>><br>
>><br>
>> Hmm. I guess user services aren't used as much as system ones are?<br>
>><br>
>> Is there another way to interface with systemctl like functionality<br>
>> programmatically? I have a c application that today is shelling out to<br>
>> systemctl to start services (which is fine for me since I'm not that<br>
>> concerned if it fails but it would be nice to know right at that<br>
><br>
><br>
> Note that systemctl *does* report failure as the process exit status +<br>
> stderr output.<br>
><br>
<br>
Yep. But some services fall over after being started (bugs in our code etc).<br>
<br>
Does this also apply when doing 'systemctl status blah' eg. a non-zero<br>
exit status if the service isn't running? I'm thinking that may not be<br>
likely.<br>
<br>
<br>
>><br>
>> time), but once everything is started I'd like to go through the<br>
>> services to make sure they all got started successfully. I didn't want<br>
>> to shell out to 'systemctl --user status xxx' and parse the output....<br>
><br>
><br>
> Well, systemctl uses a private socket, at $XDG_RUNTIME_DIR/systemd/private.<br>
> It speaks the same DBus protocol, but using a direct peer-to-peer connection<br>
> (it's not a bus address).<br>
><br>
> Remember that it's named "private" for a reason -- it's not part of the<br>
> supported API and can go away at any time (e.g. it won't exist anymore with<br>
> kdbus), so use it at your own risk.<br>
><br>
<br>
<br>
Hmm. I guess I'll fall back to parsing the output of systemctl status<br>
until there is some mechanism to interact with user services.<br>
<br>
Is support for user dbus manager in the TODO or is that just something<br>
that is waiting on other infrastructure before being implemented? eg.<br>
kdbus?<br>
<br>
Chris<br>
</blockquote></div>