Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Systemd user service doesn't work #74

Open
pavelkogan opened this issue May 5, 2016 · 4 comments
Open

Systemd user service doesn't work #74

pavelkogan opened this issue May 5, 2016 · 4 comments

Comments

@pavelkogan
Copy link

I'm trying to set up a systemd user service to work with gnome-shell-extensions-mediaplayer.

I can get mpDris2 to run through systemd, but the extension doesn't pick anything up. It does work when I just run mpDris2 from the command line.

Looking at the service status, the only difference I can see from just running the command is the following extra log:

2016-05-05 13:44:13,100 mpDris2 WARNING: Failed to connect to GNOME Settings Daemon. Media keys won't work.

When I try to monitor the bus:

gdbus monitor --session --dest org.mpris.MediaPlayer2.mpd

Instead of working with the running systemd mpDris2, it starts a new one (which works with the extension). Not sure what this means.

@grawity
Copy link
Collaborator

grawity commented May 5, 2016

This will only work correctly if your distro has enabled the "user bus" for everything.

systemd --user services don't have access to the "session" bus (of which there can be several anyway), since they run outside a session. They instead have a "user" bus shared across all sessions, and graphical sessions can be configured to connect to the user bus instead of launching a session bus.

@grawity
Copy link
Collaborator

grawity commented May 5, 2016

(The user bus works the same way as a session bus would, including tools using it via the --session option etc. – the only technical difference is that it's started by dbus.service instead of dbus-launch, and has a fixed address instead of a random one.)

@pavelkogan
Copy link
Author

I'm on Ubuntu 16.04. I did install dbus-user-session and start a user bus with systemctl --user enable dbus.service, etc., since the mpDris2 service wouldn't start without it.

Do I need to do something else to get this to work? You said something about configuring graphical sessions?

@smcv
Copy link
Contributor

smcv commented Jul 25, 2016

The combination of mpDris2 and dbus-user-session definitely works on Debian (I maintain those Debian packages).

Ubuntu might have some weirdness around the way their sessions are currently launched via Upstart - you might need to wait for a later Ubuntu release for this to work properly. I know there's work currently being done, for Ubuntu 16.10 or later, to enable dbus-user-session by default and migrate from Upstart to systemd to launch graphical sessions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants