Review of Systemd file for Notifications

Hi. I want to create a notification.service file so that systemd can run it and I can be notified about weather changes, something that used to happen. What should I put into the script, considering that usr/bin/notify-send is an empty file? I found the following systemd file and was wondering if it's okay--once I write a script for notify-send? The weather program is meteo-qt.

[Unit]
Description=Notification Service
After=network.target

[Service]
Type=oneshot
ExecStart=/user/bin/notify-send
Restart=on-failure
StandardOutput=inherit
StandardError=inherit

[Install]
WantedBy=multi-user.target

On my computers (22.04, 24.04 and 24.10) the file /usr/bin/notify-send is not empty. I think something went sideways on your system.

Try this on the commandline:

notify-send  summary body

If that does not work (which I assume because on your system it is empty) you might want to see if it is installed:

apt search libnotify-bin

And perhaps reinstall it

sudo apt install --reinstall libnotify-bin

The service that you want to create will not work because:

  1. /usr/bin/notify-send can not be used as a service c.q. daemon.
  2. /usr/bin/notify-send on your system seems to be an empty file and will therefore do nothing.
1 Like

I didn't think it should be empty. The libnotify-bin search returned the text you see, but I reinstalled it anyway. While on a search to get notifications working, I installed the package ayatana-indicator-notifications and then in Ayatana Settings, Notifications was a selectable category. I ran daemon-reload and restarted. I'm under the impression that notifications could be created by either notify-send or ayatana-notifications for the weather program, meteo-qt, that I have.
I have another problem--I since I upgraded to Jammy, I haven't been able to use Advanced Menu (in one of the screenshots, Mate Menu is missing).

Advanced Menu Troubles

I ran the reinstall command for mate-menu, but I still can't get Advanced Menu working; the file, ~/.config/mate-menu/applications.list is still there.



I want to ensure that the "Do Not Disturb" option is set to off globally on this machine. I have found this command

gsettings set org.gnome.desktop.notifications show-banners false

It seems weird that a user would enter false to set the option to receive notifications--am I wrong about this?

Would you be so kind to post text output as text instead of a screenshot ?
Otherwise you rob me of the possibility to copy/paste parts of your output into my wiki's and I have to copytype everything by hand. In this case:

Error calling StartServiceByName for org.freedesktop.Notifications: Timeout was reached

and by typing this instead of being able to copy paste from your output, a typo is easily made.
So, please please please, don't post text as pictures !
It is extremely easy (and faster and less kB) to copy paste from terminal into a message on this board.

Anyway, it seems that your notification daemon is not running.
Could you copy/paste the output of the following commands in a reply ?

stat /usr/lib/mate-notification-daemon/mate-notification-daemon
cat /usr/share/dbus-1/services/org.freedesktop.mate.Notifications.service

The org.freedesktop.mate.Notifications.service should be like:

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/mate-notification-daemon/mate-notification-daemon
AssumedAppArmorLabel=unconfined

I very much doubt that that setting will do anything, it is for the GNOME desktop, not for the MATE desktop.

2 Likes

@tkn So sorry! I won't do that again-- didn't think about those repercussions.

3 Likes

Hi. The org.freedesktop had extra text that I removed to make it the same as you said it should be. Now I'm going to try restarting the deamons and restarting

anthony@anthony-OptiPlex-9010:~$ stat /usr/lib/mate-notification-daemon/mate-notification-daemon

  File: /usr/lib/mate-notification-daemon/mate-notification-daemon
  Size: 88624     	Blocks: 176        IO Block: 4096   regular file
Device: 802h/2050d	Inode: 57935201    Links: 1
Access: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-03-08 14:23:16.000000000 -0600
Modify: 2021-12-11 14:40:50.000000000 -0600
Change: 2025-03-08 14:23:24.003323981 -0600
 Birth: 2025-03-08 14:23:23.458331438 -0600

anthony@anthony-OptiPlex-9010:~$ cat /usr/share/dbus-1/services/org.freedesktop.mate.Notifications.service

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/mate-notification-daemon/mate
AssumedAppArmorLabel=unconfined

I forgot something: which ubuntu-MATE version are you running ?

I'm writing this from my workstation which is running 22.04

on 22.04 the file in question is:
/usr/lib/mate-notification-daemon/mate-notification-daemon

but on 24.04 (mediabox) and 24.10 (my stinkpad) it is:
/usr/libexec/mate-notification-daemon/mate-notification-daemon

and the file /usr/share/dbus-1/services/org.freedesktop.mate.Notifications.service
on both 24.04 and 24.10 contains:

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/libexec/mate-notification-daemon/mate-notification-daemon
AssumedAppArmorLabel=unconfined

Sorry for not checking this first.
Let me know if this works :slight_smile:

2 Likes

I have 22.04. Here's the Dbus Service file content:

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/mate-notification-daemon/mate
AssumedAppArmorLabel=unconfined

The contents of the mate-notification-daemon won't display in Pluma.

Seems getting these notifications for weather is a big problem--probably easier to do without?

Ah, I see. The 3rd line of the Dbus Service file is incomplete.
it reads:
Exec=/usr/lib/mate-notification-daemon/mate
but should be:
Exec=/usr/lib/mate-notification-daemon/mate-notification-daemon

2 Likes

Hi. I'm having trouble with this issue again and hoping some new information will help. About the screenshots--I include them because it allows for understanding things instantly.

[1]+  Stopped                 sudo systemctl list-units --failed
anthony@anthony-OptiPlex-9010:~$ sudo service clamav-freshclam.service start
Failed to start clamav-freshclam.service.service: Unit clamav-freshclam.service.service not found.
anthony@anthony-OptiPlex-9010:~$ sudo service clamav-freshclam.service start
Failed to start clamav-freshclam.service.service: Unit clamav-freshclam.service.service not found.
anthony@anthony-OptiPlex-9010:~$ sudo service clamav-freshclam start
anthony@anthony-OptiPlex-9010:~$ sudo service org.freedesktop.Notifications start
Failed to start org.freedesktop.Notifications.service: Unit org.freedesktop.Notifications.service not found.
anthony@anthony-OptiPlex-9010:~$ sudo service org.freedesktop.Notifications start
Failed to start org.freedesktop.Notifications.service: Unit org.freedesktop.Notifications.service not found.
anthony@anthony-OptiPlex-9010:~$ 

org.freedesktop.mate.Notifications.service

[D-BUS Service]
Name=org.freedesktop.Notifications
Exec=/usr/lib/mate-notification-daemon/mate-notification-daemon
AssumedAppArmorLabel=unconfined
anthony@anthony-OptiPlex-9010:~$ systemctl status dbus
● dbus.service - D-Bus System Message Bus
     Loaded: loaded (/lib/systemd/system/dbus.service; static)
     Active: active (running) since Mon 2025-03-10 10:27:20 CDT; 14h ago
TriggeredBy: ● dbus.socket
       Docs: man:dbus-daemon(1)
   Main PID: 1038 (dbus-daemon)
      Tasks: 1 (limit: 28449)
     Memory: 1.1G
        CPU: 1min 3.249s
     CGroup: /system.slice/dbus.service
             └─1038 @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activatio>

Mar 10 20:37:10 anthony-OptiPlex-9010 org.debian.apt[39556]: 20:37:10 AptDaemon [INFO]: Quitting due >
Mar 10 20:37:10 anthony-OptiPlex-9010 org.debian.apt[39556]: 20:37:10 AptDaemon [INFO]: Quitting was >
Mar 10 23:35:24 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Activating via systemd: service nam>
Mar 10 23:35:24 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Successfully activated service 'org>
lines 1-16...skipping...
● dbus.service - D-Bus System Message Bus
     Loaded: loaded (/lib/systemd/system/dbus.service; static)
     Active: active (running) since Mon 2025-03-10 10:27:20 CDT; 14h ago
TriggeredBy: ● dbus.socket
       Docs: man:dbus-daemon(1)
   Main PID: 1038 (dbus-daemon)
      Tasks: 1 (limit: 28449)
     Memory: 1.1G
        CPU: 1min 3.249s
     CGroup: /system.slice/dbus.service
             └─1038 @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only

Mar 10 20:37:10 anthony-OptiPlex-9010 org.debian.apt[39556]: 20:37:10 AptDaemon [INFO]: Quitting due to inactivity
Mar 10 20:37:10 anthony-OptiPlex-9010 org.debian.apt[39556]: 20:37:10 AptDaemon [INFO]: Quitting was requested
Mar 10 23:35:24 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Activating via systemd: service name='org.freedesktop.hostname1' >
Mar 10 23:35:24 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Successfully activated service 'org.freedesktop.hostname1'
Mar 10 23:37:40 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Activating via systemd: service name='org.freedesktop.timedate1' >
Mar 10 23:37:40 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Successfully activated service 'org.freedesktop.timedate1'
Mar 10 23:52:34 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Activating via systemd: service name='org.freedesktop.hostname1' >
Mar 10 23:52:34 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Successfully activated service 'org.freedesktop.hostname1'
Mar 10 23:54:18 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Activating via systemd: service name='org.freedesktop.hostname1' >
Mar 10 23:54:18 anthony-OptiPlex-9010 dbus-daemon[1038]: [system] Successfully activated service 'org.freedesktop.hostname1'

[2]+  Stopped                 systemctl status dbus

I hope it helped you because I can't make heads or tails of it :slight_smile:

Anyway, if I am not mistaken, any /usr/share/dbus-1 services need to be started by dbus. You can not start them manually.

The services that you can start by hand are in /lib/systemd and /etc/systemd

The one you are probably looking for is:
/usr/lib/systemd/user/ayatana-indicator-notifications.service

let's try:

thom@monolith:~$ systemctl --user status ayatana-indicator-notifications.service
○ ayatana-indicator-notifications.service - Ayatana Indicator Notifications
     Loaded: loaded (/usr/lib/systemd/user/ayatana-indicator-notifications.service; enabled; vendor preset: enabled)
     Active: inactive (dead)
thom@monolith:~$ cat /etc/systemd/user/ayatana-indicators.target.wants/ayatana-indicator-notifications.service
[Unit]
Description=Ayatana Indicator Notifications
PartOf=graphical-session.target
PartOf=ayatana-indicators.target

[Service]
ExecStart=/usr/libexec/ayatana-indicator-notifications/ayatana-indicator-notifications-service
Restart=on-failure

[Install]
WantedBy=ayatana-indicators.target

Are yours the same ?

That is correct. There is no service which ends with .service.service
Also, the command service is deprecated since ubuntu runs on systemd.

Try this:

sudo systemctl start clamav-freshclam
1 Like

Hi. The screenshots show the paths to the files, their names in Caja; I read that Dbus runs under systemd and that because of it, systemd should have its own version of the service name--so I thought the Caja screenshot should show a filename under systemd similar to .Notifications, but it doesn't.
I'm not interested in the freshclam.service--I was just experimenting with the systemctl list-units --failed command, hoping that I would find the name of the .Notification service, since variations resulted in the service not being found.
Thanks for your continued help--I will try what you suggested later today.

Hi. Here's the two commands; I thought the exec file was a typo because every time I have entered .service, it was with a period and not a hyphen--I fixed this mistake when it didn't work. I tried to start the service with both systemctl and through the service command--both reported not being able to find ayatana-indicators. The outputs have a period before service, so I was thinking they were looking for a .service file and not a -service; I thought that's what confused the computer.

anthony@anthony-OptiPlex-9010:~$ sudo service ayatana-indicator-notifications start
Failed to start ayatana-indicator-notifications.service: Unit ayatana-indicator-notifications.service not found.

anthony@anthony-OptiPlex-9010:~$ sudo systemctl start ayatana-indicator-notifications
Failed to start ayatana-indicator-notifications.service: Unit ayatana-indicator-notifications.service not found.

anthony@anthony-OptiPlex-9010:~$ systemctl --user status ayatana-indicator-notifications.service
○ ayatana-indicator-notifications.service - Ayatana Indicator Notifications
     Loaded: loaded (/usr/lib/systemd/user/ayatana-indicator-notifications.serv>
     Active: inactive (dead)

[1]+  Stopped                 systemctl --user status ayatana-indicator-notifications.service

anthony@anthony-OptiPlex-9010:~$ cat /etc/systemd/user/ayatana-indicators.target.wants/ayatana-indicator-notifications.service
[Unit]
Description=Ayatana Indicator Notifications
PartOf=graphical-session.target
PartOf=ayatana-indicators.target

[Service]
ExecStart=/usr/libexec/ayatana-indicator-notifications/ayatana-indicator-notifications-service
Restart=on-failure

[Install]
WantedBy=ayatana-indicators.target