5

I have an executable I'd like to run as a user and that user should be able to start and stop that service without sudo.

I have systemd --user always running for the user by running loginctl enable-linger user

I've confirmed the systemd --user instance is running as that user using ps but when I try to run any systemctl command as that user, I get the following error:

vagrant-ubuntu-vivid-64:~$ systemctl --user list-units
Failed to get D-Bus connection: Connection refused

Based on my googling it sounds like I should have a dbus-daemon instance running as that user but it is not. It should be noted I'm switching to the user with su so it may not be counting as a "login".

I have two questions:

  1. Can my user instance of systemd just use the system instance of d-bus?
  2. Should Ubuntu somehow be starting a user instance of d-bus for me?
  • Ubuntu still uses upstart to manage the user session instead of a systemd user session. – psusi Jul 21 '15 at 0:35
  • @psusi thanks for the comment. Do you have a reference or some more docs on this? – Luke Hoersten Jul 22 '15 at 4:58
  • Nope; just looked at the running system. – psusi Jul 22 '15 at 21:55
  • Confirmed you are correct with devs in irc. Systemd user sessions are blocked on Ubuntu phone moving to systemd. They recommended policykit instead. You can post your answer so I can mark this done if you like. – Luke Hoersten Jul 22 '15 at 22:27
4

Ubuntu is still using upstart to manage the user session, and systemd only manages the system session. Hopefully in the next release, the user session will migrate to systemd, and then this will work.

  • So there is no systemd user session D-Bus in Ubuntu? Is this also true for Kubuntu 15.10? – Silicomancer Dec 19 '15 at 22:38
  • 1
    @Silicomancer, yes. – psusi Dec 20 '15 at 2:47
  • I tried a lot of things. And "systemctl --user list-units" acutally works on my system. Also "busctl --user | grep systemd" lists "org.freedesktop.systemd1" as "(activateable)". Doesn't this mean there is a user d-bus instance running? – Silicomancer Dec 20 '15 at 9:42
  • 1
    @Silicomancer there is a user dbus session, but if you follow the chain of parent processes with ps l you will find that all of your processes are ancestors of an upstart process rather than a systemd one. I'm not sure why systemctl --user list-units works... it seems that it shouldn't. – psusi Dec 22 '15 at 0:55
  • Ok. I see. Thanks! Do you have an idea in which Kubuntu version that will change? – Silicomancer Dec 22 '15 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.