Notify-send issue

notify-send "Header" "Content" --icon network-idle
su -l user -c 'notify-send "Header" "Content" --icon network-idle'

I’m using the latest updated Qubes OS 4.1 release. Neither of these commands work when called in /rw/config/rc.local or /rw/config/qubes-firewall-user-script.
Please advise.

1 Like

for me, notify-send doesn’t work in fedora 36 or 37.
Gives dbus error, “The name is not activatable”

The command must be done in dom0.

I guess that also solve the OP issue.

It doesn’t need to be run in dom0, I don’t have any issues running notify-send from appVMs.

I don’t think it will work from rc.local, the script is run before xorg is started, and I think you need xorg to show the message.

I have, but as usual, minimal template (I answered too quickly).

It’s then a missing package: libnotify ?

Well it’s not, don’t know why I have thought that, as I do have the DBus error
and therefore the package.

Its probably the notification daemon that is missing or not started (it should auto-start).

To get notification from (fedora) app qubes, install notification-daemon and libnotify (already installed).
Just tested fom fresh fedora 37 minimal template.


1 Like

In such cases, I often use an until loop


until sudo -u user notify-send Hello
    sleep 1 && continue

szz9pza said it doesn’t start because dbus isn’t ready.

You can wait and see if it becomes available, but you probably need to set up the dbus address variable.

You can also make an .desktop file in /home/user/.config/autostart and use that file to execute your shell script, that is what I normally do when I need to run something that requires xorg to be up and running.

It’s more than notification-daemon and libnotify; something else has changed in fedora 36,37.

I found out during upgrade, because whatever it is broke the CLI VPN script

It calls notify-send. When that fails, openvpn crashes out.

Had to comment out those notify-send lines in script to make openvpn work.

Of course, now it doesn’t notify about link status.

ps says notification-daemon running.

notify-send is installed and fully functional in fedora 37.
There must be an error in that script in calling it, rather than
anything else.
As user, can you confirm this with notify-send 'test' 'test'

Post the section of the script you have commented out, and how you are
calling the script.

I never presume to speak for the Qubes team. When I comment in the Forum or in the mailing lists I speak for myself.

I use the qubes-vpn-handler script from here:

and had to comment out the lines with notify-send and the else line to keep it working after f35.

Did you confirm that notify-send was working, as I asked?

I asked you to cite the lines you comment out, rather than me have
to search for them.
I also asked how you are calling the script.

I figured out a solution to using notify-send as any user. Essentially I had to install dbus-x11 to perform dbus-launch and add a notification service for dbus so notifications could be sent properly.

The following steps work for Fedora 38. It should also work for Debian systems.

  1. Install dbus-x11 in template
sudo dnf install dbus-x11
  1. Copy the following into /usr/share/dbus-1/services/org.freedesktop.Notifications.service
[D-BUS Service]

It should be noted this assumes you’re using xfce4 in dom0. If you are not see which notification service you are using by doing ps aux | grep notify and replacing that in the exec.

The script below is for notification of Wireguard connections via the preup, postup, predown, and postdown hooks in the Wireguard configuration.

Every time dbus-launch executes it creates a new session so we store it in a temporary file and reuse it.


# Hostname of vm

# Wireguard config file

# File to store dbus session

# Function to send notification with a timeout
send_notification() {
    local start_time=$(date +%s)
    local timeout=30
    local success=0

    # Set the DISPLAY environment variable
    export DISPLAY=:0

    # If DBUS_SESSION_BUS_ADDRESS isn't set, try to source from file or launch a new one
    if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
        if [ -f "$DBUS_INFO_FILE" ]; then
            source "$DBUS_INFO_FILE"

        # Check if D-Bus is still running
        if ! pgrep -f "dbus-daemon --fork --print-address 5 --print-pid 6" > /dev/null; then
            eval $(/usr/bin/dbus-launch --sh-syntax) > "$DBUS_INFO_FILE"

    # Try to send the notification until it succeeds or timeout
    while [[ $(( $(date +%s) - $start_time )) -lt $timeout ]]; do
        # Attempt to send the notification
        /usr/bin/notify-send "$@" && {
        sleep 1

    if [[ $success -eq 0 ]]; then
        echo "Failed to send notification after 30 seconds."

        # Exit with code 0 to not fail wg-quick service

ENDPOINT=$(grep "Endpoint" $WIREGUARD_CONFIG | cut -d '=' -f 2 | cut -d ':' -f 1)

# Handling wireguard notification hooks
case $1 in
        send_notification "Wireguard: $HOSTNAME" "Connecting to $ENDPOINT..."
        send_notification "Wireguard: $HOSTNAME" "Connected to $ENDPOINT!"
        send_notification "Wireguard: $HOSTNAME" "Disconnecting from $ENDPOINT..."
        send_notification "Wireguard: $HOSTNAME" "Disconnected from $ENDPOINT!"
        echo "Invalid argument. Use preup, postup, predown, or postdown."
        exit 1

I opened a somewhat related issue about this