If Dunst is launched in a context where it can't access an X server or Wayland, it crashes and dumps core right away.
This may e. g. happen in a virtual terminal session while X isn't running or when Dunst is launched by root on a system where X is run by a regular user.
Obviously, neither is an expected use case, but in particular the former can happen by incident rather quickly.
So all in all I think it would be good, if Dunst handled this situation a bit more gracefully.
Steps to reproduce:
- Make sure that Dunst is the only notification daemon around and a tool to track core dumps is available, e. g. systemd-coredump.
- Have a regular user issue an arbitrary invocation of notify-send on a virtual terminal while no X server or other windowing system is running.
- Check the core dump log. Will be similar to
Jul 28 18:58:12 desktop-1 systemd[12638]: Created slice User Core Session Slice.
Jul 28 18:58:12 desktop-1 systemd[12638]: Starting D-Bus User Message Bus...
Jul 28 18:58:12 desktop-1 systemd[12638]: Started D-Bus User Message Bus.
Jul 28 18:58:12 desktop-1 dbus-daemon[12662]: [session uid=1000 pid=12662] Activating systemd to hand-off: service name='org.freedesktop.Notifications' unit='dunst.service' requested by ':1.0' (uid=1000 pid=12660 comm="notify-send --app-name=notify-send CLI Tests zu Du")
Jul 28 18:58:12 desktop-1 dbus-daemon[12662]: [session uid=1000 pid=12662] Successfully activated service 'org.freedesktop.systemd1'
Jul 28 18:58:12 desktop-1 systemd[12638]: Starting Dunst notification daemon...
Jul 28 18:58:12 desktop-1 dunst[12664]: WARNING: Cannot open X11 display.
Jul 28 18:58:12 desktop-1 kernel: show_signal: 6 callbacks suppressed
Jul 28 18:58:12 desktop-1 kernel: traps: dunst[12664] trap int3 ip:7fdc62b26855 sp:7ffe6dbbe590 error:0 in libglib-2.0.so.0.7200.3[7fdc62ae6000+92000]
Jul 28 18:58:12 desktop-1 kernel: audit: type=1701 audit(1659027492.933:174): auid=1000 uid=1000 gid=1000 ses=8 pid=12664 comm="dunst" exe="/usr/bin/dunst" sig=5 res=1
Jul 28 18:58:12 desktop-1 audit[12664]: ANOM_ABEND auid=1000 uid=1000 gid=1000 ses=8 pid=12664 comm="dunst" exe="/usr/bin/dunst" sig=5 res=1
Jul 28 18:58:12 desktop-1 dunst[12664]: ERROR: [ get_x11_output:0065] Couldn't initialize X11 output. Aborting...
Jul 28 18:58:12 desktop-1 systemd[1]: Created slice Slice /system/systemd-coredump.
Jul 28 18:58:12 desktop-1 audit: BPF prog-id=39 op=LOAD
Jul 28 18:58:12 desktop-1 audit: BPF prog-id=40 op=LOAD
Jul 28 18:58:12 desktop-1 audit: BPF prog-id=41 op=LOAD
Jul 28 18:58:12 desktop-1 kernel: audit: type=1334 audit(1659027492.970:175): prog-id=39 op=LOAD
Jul 28 18:58:12 desktop-1 kernel: audit: type=1334 audit(1659027492.970:176): prog-id=40 op=LOAD
Jul 28 18:58:12 desktop-1 kernel: audit: type=1334 audit(1659027492.970:177): prog-id=41 op=LOAD
Jul 28 18:58:12 desktop-1 kernel: audit: type=1130 audit(1659027492.973:178): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@0-12668-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jul 28 18:58:12 desktop-1 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-coredump@0-12668-0 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jul 28 18:58:12 desktop-1 systemd[1]: Started Process Core Dump (PID 12668/UID 0).
Jul 28 18:58:13 desktop-1 systemd[12638]: Starting Monitoring core dumps :: *.service...
Jul 28 18:58:13 desktop-1 systemd-coredump[12669]: Process 12664 (dunst) of user 1000 dumped core.
Module linux-vdso.so.1 with build-id a5290dd75cb1eb0fb20c7a46c6fa011045892af5
Module libbrotlicommon.so.1 with build-id acfd597a977c8087bb6184383daae2e828a9ce42
Module libpthread.so.0 with build-id 95ae4f30a6f12ccbff645d30f8e1a3ee23ec7d36
[...]
I took the liberty to quickly post the logs without debug symbols enabled as the problem seems to be 100% and easily reproducible. If you do need an output with debug symbols enabled, just let me know.
1ef38e5 on Arch Linux x86_64 per AUR package dunst-git.
If Dunst is launched in a context where it can't access an X server or Wayland, it crashes and dumps core right away.
This may e. g. happen in a virtual terminal session while X isn't running or when Dunst is launched by root on a system where X is run by a regular user.
Obviously, neither is an expected use case, but in particular the former can happen by incident rather quickly.
So all in all I think it would be good, if Dunst handled this situation a bit more gracefully.
Steps to reproduce:
I took the liberty to quickly post the logs without debug symbols enabled as the problem seems to be 100% and easily reproducible. If you do need an output with debug symbols enabled, just let me know.
1ef38e5 on Arch Linux x86_64 per AUR package dunst-git.