[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#930472: lintian: systemd-service-file-missing-install-key shouldn't fire for dbus activated services



  Hi Chris,

On 6/13/19 11:05 PM, Chris Lamb wrote:
> tags 930472 + moreinfo
> thanks
>
> Hi Arnaud,
>
>> Upstream ships a systemd service file, and a d-bus service file. The
>> rauc daemon is d-bus activated (meaning, it's automatically started by
>> the client when needed).
> […]
>> So, well, I don't know if Lintian is aware of dbus service files that
>> get installed at `/usr/share/dbus-1/` (I'm not familiar with lintian at
>> all). If so, then Lintian could look for a key `SystemdService=` in the
>> d-bus service file, along with `BusName=` in the systemd service file.
> Perhaps I'm missing something but it looks sufficient to not emit this
> tag if the .service file contains a `BusName=` key, no need to look at
> any other files.


I did a bit of reading, but I'm not the d-bus expert, so this is just my
understanding.

1. A d-bus service that wants to "bus-activatable" ships a d-bus service
file in /usr/share/dbus-1 [1]
2. A d-bus service that wants to be started with systemd ships a systemd
service file in /lib/systemd/system, and provides `BusName=`
3. A d-bus service that wants both ships both files, and uses
`SystemdService=` in the d-bus service file, so that d-bus can let
systemd start the service.

Based on that, it seems to me that there's room for d-bus service that
just do number 2: ship a systemd service file, but don't want to be
dbus-activatable, and don't ship a d-bus service file.

Well, that's my understanding, and that's just theory.

Practice now, let me check what's up on my system

  $ ack -l BusName= /lib/systemd/system | wc -l
  27
  $ ack -l BusName= /lib/systemd/system | xargs grep '\[Install\]' | wc -l
  11
  # -> a bit less than 50% of the BusName= services here have an
[Install] section


Now let's see how many of these services have a d-bus service file that
contains `SystemdService=`


  $ c=0
  $ services=$(ack -l BusName= /lib/systemd/system | rev | cut -d/ -f1 |
rev | sort)
  $ for svc in $services; do grep -q -rn "SystemdService=$svc"
/usr/share/dbus-1/ || { echo "$svc ko"; c=$(expr $c + 1); }; done
  $ echo "$c BusName= systemd services don't have a dbus service file
with SystemdService="
  avahi-daemon.service ko
  bluetooth.service ko
  gdm.service ko
  iio-sensor-proxy.service ko
  ModemManager.service ko
  NetworkManager-dispatcher.service ko
  NetworkManager.service ko
  switcheroo-control.service ko
  systemd-hostnamed.service ko
  systemd-importd.service ko
  systemd-localed.service ko
  systemd-logind.service ko
  systemd-machined.service ko
  systemd-timedated.service ko
  14 BusName= systemd services don't have a dbus service file with
SystemdService=

I didn't look into all of them. But avahi proved to be a good example of
a the case number 2. If you look at
usr/share/dbus-1/system-services/org.freedesktop.Avahi.service, you will
see:

  # This service should not be bus activated if systemd isn't running,
  # so that activation won't conflict with the init script startup.
  Exec=/bin/false

So this is a good example of a service that provides `BusName=` and also
requires a Install section in the systemd service file.

What do you think of all of that ?

Cheers,

  Arnaud

----

[1]: https://dbus.freedesktop.org/doc/system-activation.txt


Reply to: