Bug#996911: systemd: dbus signal JobRemoved for a failed job is 'done' instead of 'failed'

Alexandre Rossi niol at zincube.net
Wed Oct 20 17:08:56 BST 2021


Package: systemd
Version: 247.3-6
Severity: normal

Dear Maintainer,

man:org.freedesktop.systemd1 says:

    JobRemoved() are sent out each time a new job is queued or dequeued.
    [...] done indicates successful execution of a job.

However, when I subscribe to the JobRemoved signal and I restart a failing
job, I get 'done' as a result.

I used the following script:

--
#!/usr/bin/python3

from gi.repository import GLib

import dbus
import dbus.mainloop.glib


def systemd_event_cb(pid, jobid, unit, result):
    print('received event for unit %s with result %s'
          % (unit, result))

def subscribe():
    sysbus = dbus.SystemBus()
    systemd1 = sysbus.get_object('org.freedesktop.systemd1',
                                 '/org/freedesktop/systemd1')
    systemd1.connect_to_signal('JobRemoved', systemd_event_cb)
    manager = dbus.Interface(systemd1,
                             'org.freedesktop.systemd1.Manager')
    manager.Subscribe()

GLib.timeout_add(100, subscribe)

dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
loop = GLib.MainLoop()

loop.run()
--

The output of the script is:

	received event for unit davmail.service with result done

However:

--
$ sudo systemctl status davmail
× davmail.service - Davmail Exchange gateway
     Loaded: loaded (/lib/systemd/system/davmail.service; disabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2021-10-20 17:15:21 CEST; 12s ago
    Process: 10271 ExecStartPre=/usr/share/davmail/service-prepare (code=exited, status=0/SUCCESS)
    Process: 10274 ExecStart=/usr/bin/davmail -server /etc/davmail/davmail.properties (code=exited, status=1/FAILURE)
   Main PID: 10274 (code=exited, status=1/FAILURE)
        CPU: 27ms

oct. 20 17:15:21 skade systemd[1]: Starting Davmail Exchange gateway...
oct. 20 17:15:21 skade systemd[1]: Started Davmail Exchange gateway.
oct. 20 17:15:21 skade systemd[1]: davmail.service: Main process exited, code=exited, status=1/FAILURE
oct. 20 17:15:21 skade systemd[1]: davmail.service: Failed with result 'exit-code'.
--

Thanks,

Alex

-- Package-specific info:

-- System Information:
Debian Release: 11.1
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-9-amd64 (SMP w/4 CPU threads)
Locale: LANG=fr_FR.utf8, LC_CTYPE=fr_FR.utf8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages systemd depends on:
ii  adduser               3.118
ii  chrony [time-daemon]  4.0-8
ii  libacl1               2.2.53-10
ii  libapparmor1          2.13.6-10
ii  libaudit1             1:3.0-2
ii  libblkid1             2.36.1-8
ii  libc6                 2.31-13+deb11u2
ii  libcap2               1:2.44-1
ii  libcrypt1             1:4.4.18-4
ii  libcryptsetup12       2:2.3.5-1
ii  libgcrypt20           1.8.7-6
ii  libgnutls30           3.7.1-5
ii  libgpg-error0         1.38-2
ii  libip4tc2             1.8.7-1
ii  libkmod2              28-1
ii  liblz4-1              1.9.3-2
ii  liblzma5              5.2.5-2
ii  libmount1             2.36.1-8
ii  libpam0g              1.4.0-9+deb11u1
ii  libseccomp2           2.5.1-1
ii  libselinux1           3.1-3
ii  libsystemd0           247.3-6
ii  libzstd1              1.4.8+dfsg-2.1
ii  mount                 2.36.1-8
ii  util-linux            2.36.1-8

Versions of packages systemd recommends:
ii  dbus  1.12.20-2

Versions of packages systemd suggests:
ii  policykit-1        0.105-31
ii  systemd-container  247.3-6

Versions of packages systemd is related to:
pn  dracut           <none>
ii  initramfs-tools  0.140
pn  libnss-systemd   <none>
ii  libpam-systemd   247.3-6
ii  udev             247.3-6

-- Configuration Files:
/etc/systemd/journald.conf changed [not included]

-- no debconf information


More information about the Pkg-systemd-maintainers mailing list