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

fail to start dunst via systemd and service #347

Closed
jduf opened this issue Aug 1, 2017 · 11 comments
Closed

fail to start dunst via systemd and service #347

jduf opened this issue Aug 1, 2017 · 11 comments

Comments

@jduf
Copy link

jduf commented Aug 1, 2017

I run the latest version of dunst on a debian 9 and I can't start dunst properly. I read your documentation and the make install command correctly sets all the files required to start dunst via systemd. Unfortunately it doesn't work and the command journalctl -b -p 7..0 run as root outputs:

Aug 01 11:52:38 pink-floyd systemd[986]: Starting Dunst notification daemon... 
Aug 01 11:52:38 pink-floyd systemd[986]: Starting Accessibility services bus...
Aug 01 11:52:39 pink-floyd dbus-daemon[1107]: Successfully activated service 'org.a11y.Bus' 
Aug 01 11:52:39 pink-floyd systemd[986]: Started Accessibility services bus.
Aug 01 11:52:39 pink-floyd dunst[1297]: cannot open display
Aug 01 11:52:39 pink-floyd systemd[986]: dunst.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 11:52:39 pink-floyd systemd[986]: Failed to start Dunst notification daemon.
Aug 01 11:52:39 pink-floyd systemd[986]: dunst.service: Unit entered failed state.
Aug 01 11:52:39 pink-floyd systemd[986]: dunst.service: Failed with result 'exit-code'.

then a bit later in the same output

Aug 01 11:58:01 pink-floyd systemd[986]: Starting Dunst notification daemon...
Aug 01 11:58:01 pink-floyd dunst[4114]: cannot open display
Aug 01 11:58:01 pink-floyd systemd[986]: dunst.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 11:58:01 pink-floyd systemd[986]: Failed to start Dunst notification daemon.
Aug 01 11:58:01 pink-floyd systemd[986]: dunst.service: Unit entered failed state.
Aug 01 11:58:01 pink-floyd systemd[986]: dunst.service: Failed with result 'exit-code'.

Thanks for your help

@bebehei
Copy link
Member

bebehei commented Aug 1, 2017

Aug 01 11:58:01 pink-floyd dunst[4114]: cannot open display

Obviously, the DISPLAY-variable is not set. Add in your systemd-service file in the Service-Section the line Environment=DISPLAY=:0.

But that's just the quickfix.

@tsipinakis
Copy link
Member

tsipinakis commented Aug 1, 2017

As @bebehei said, the most likely cause is that the DISPLAY environment variable is not set within systemd. I just ran a test on a Debian 9 VM with i3, xinit and dbus-user-session installed and the systemd service appears to be working fine.

Can you give some more details on your setup? What desktop environment are you using? How are you starting X?

@bebehei
Copy link
Member

bebehei commented Aug 1, 2017

Related commit: 52b08e4

@jduf
Copy link
Author

jduf commented Aug 1, 2017

Thanks for your quick response!

I'm using a minimalistic version of debian with dwm for desktop environment. I log on my session via the terminal and then run xinit which executes the ~/.xinitrc containing:

#!/bin/bash
exec dwm

@tsipinakis
Copy link
Member

tsipinakis commented Aug 1, 2017

log on my session via the terminal and then run xinit

Ah, there's the problem, xinit is the low level command to initialize X, useful if you want a truly minimal system but it skips the system-wide X initialization which can cause problems. I'd recommend using startx instead if possible.

After some digging, looks like that the relevant scripts to properly link dbus, systemd and X11 apps are 20dbus_xdg-runtime and 95dbus_update-activation-env from the dbus-user-session package.

@jduf
Copy link
Author

jduf commented Aug 1, 2017

adding the Environment=DISPLAY=:0 in /usr/local/lib/systemd/user/dunst.service solved the problem.

If you find a "long term solution" to this problem, let me know !

thanks again!

@jduf jduf closed this as completed Aug 1, 2017
@tsipinakis
Copy link
Member

tsipinakis commented Aug 1, 2017

Glad that worked, though that file may be overwritten on updates.

Another (possibly better) solution would be to add systemctl --user set-environment DISPLAY=:0 to your xinitrc file. (Untested, though theoretically it should work)

@WhyNotHugo
Copy link
Contributor

systemctl --user import-environment DISPLAY is probably better, since it'll work with wayland/xwayland and non-default DISPLAYs.

@ericfreese
Copy link
Contributor

This might not be relevant to many folks, but I was struggling with this for a while and found that I had a script (50-systemd-user.sh) in /etc/X11/xinit/xinitrc.d/ that wasn't being called by anything. When initially setting up my ~/.xinitrc file, I had removed the final if block that runs every script in that dir. Adding it back in fixed the issue. Check the default xinitrc file at /etc/X11/xinit/xinitrc, and see the note here:

Note: At the very least, ensure that the last if block in /etc/X11/xinit/xinitrc is present in your ~/.xinitrc file to ensure that the scripts in /etc/X11/xinit/xinitrc.d are sourced.

@mpaccione
Copy link

mpaccione commented May 14, 2021

I've added the Environment to the dunst.service file and reloaded the daemons. It still doesn't start.

I am able to run it in the console by typing dunst however it keeps outtputing : Xlib: extension "RANDR" missing on display ":0". It tries XINERAMA first.

I'd really like to have this working. I start a new job on Monday and particularly need notifications. Can someone help me please.
#866

@fwsmit
Copy link
Member

fwsmit commented May 14, 2021

@mpaccione please try not to clutter other issues to get other people to look at your issue. Just wait patiently for your issue to be answered.

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

7 participants