[systemd-devel] Socket activation and busname aliases in Network/ModemManager

Colin Guthrie gmane at colin.guthr.ie
Thu Jun 20 01:31:30 PDT 2013


Hi,

Leading on from the "Masking socket activated..." thread recently, I was
thinking a bit about some of the units in Network Manager.

Network Manager 0.9.8.0 contains the following NetworkManager.service unit.

[Unit]
Description=Network Manager
After=syslog.target
Wants=network.target
Before=network.target

[Service]
Type=dbus
BusName=org.freedesktop.NetworkManager
ExecStart=/usr/sbin/NetworkManager --no-daemon
# Suppress stderr to eliminate duplicated messages in syslog. NM calls
openlog()
# with LOG_PERROR when run in foreground. But systemd redirects stderr to
# syslog by default, which results in logging each message twice.
StandardError=null
# NM doesn't want systemd to kill its children for it
KillMode=process

[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.NetworkManager.service
Also=NetworkManager-wait-online.service



This ensures a dbus-org.freedesktop.NetworkManager.service alias.

Now the dbus service file
/usr/share/dbus-1/system-services/org.freedesktop.NetworkManager.service
has this:

# This D-Bus service activation file is only for systemd support since
# an auto-activated NetworkManager would be quite surprising for those
people
# who have NM installed but turned off.  Thus the Exec path available to
# D-Bus is /bin/false, but systemd knows the real Exec path due to the NM
# systemd .service file.

[D-BUS Service]
Name=org.freedesktop.NetworkManager
Exec=/bin/false
User=root
SystemdService=dbus-org.freedesktop.NetworkManager.service


As is uses the dbus alias, I guess the intention is that it only works
when the service is enabled in systemd. Without the service being
enabled, the alias does not exist and thus it cannot be bus activated.


I guess that all makes sense although it is a little bit counter
intuitively "belt and braces" as you cannot enable on-demand bus
activation without enabling static activation on boot also (due to
WantedBy= line).


Now for NetworkManager itself this more or less OK. You'll be needing it
pretty much immediately on boot anyway, but what's caught me out a
little bit more is that ModemManager (0.7.991) also follows this same
pattern.

For me this seems a little strange. Modems are not as common these days
and I don't really want to have this enabled and running on my machine
if I don't really need it. Normally I'd expect it to be bus activated if
I go the relevant menu options via one of the NM control applets etc.

I presume that to have "bus activation by default", the only change
needed would be to change the dbus .service file for modem manager to
refer to the SystemdService via it's normal name and not via it's bus
alias? Is this the "expected" way to work.

Cheers

Col



-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/



More information about the systemd-devel mailing list