Bug 978026

Summary: NetworkManager dispatcher unit file preset has wrong unit file name
Product: [Fedora] Fedora Reporter: Dan Williams <dcbw>
Component: systemdAssignee: systemd-maint
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: berend.de.schouwer, dcbw, johannbg, lnykryn, lpoetter, mschmidt, msekleta, notting, plautrba, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 948433 Environment:
Last Closed: 2013-06-26 08:05:01 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 948433    
Bug Blocks:    

Description Dan Williams 2013-06-25 20:23:50 UTC
+++ This bug was initially created as a clone of Bug #948433 +++

Currently nm_dispatcher is being forked off dbus-daemon by dbus's own activation logic. It would be a good thing if nm_dispatcher would be turned into its own systemd service instead, so that it can be introspected and controlled like any other system service, gets its own set of indexed logs, and so on. nm_dispatcher is currently one of the very few services we install by default that isn't a systemd service of its own.

Please make the following changes:

Add the following line to /usr/share/dbus-1/system-services/org.freedesktop.nm_dispatcher.service:

<snip>
SystemdService=dbus-org.freedesktop.nm-dispatcher.service
</snip>

Then, introduce /usr/lib/systemd/system/nm_dispatcher.service in your RPM:

<snip>
[Unit]
Description=Network Managing Dispatcher Service

[Service]
Type=dbus
BusName=org.freedesktop.nm_dispatcher
ExecStart=/usr/libexec/nm-dispatcher.action

[Install]
WantedBy=multi-user.target
Alias=dbus-org.freedesktop.nm-dispatcher.service
</snip>

Finally, add the snippets listed in https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd to you spec file:

<snip>
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd

[...]

%post
%systemd_post nm_dispatcher.service

%preun
%systemd_preun nm_dispatcher.service

%postun
%systemd_postun
</snip>

I will add nm_dispatcher.service to the preset file we ship, to ensure it is enabled by default.

Of course, please consider doing this changes together with those suggested in https://bugzilla.redhat.com/show_bug.cgi?id=787314#c37 -- in that case you can (and should) merge the macro lines above, to include the three unit names in the same line:

%systemd_post NetworkManager.service NetworkManager-wait-online.service nm_dispatcher.service

and

%systemd_preun NetworkManager.service NetworkManager-wait-online.service nm_dispatcher.service

--- Additional comment from Dan Williams on 2013-05-15 07:27:42 CDT ---

I've actually got plans to just merge the dispatcher back into NM for a variety of reasons, so I'm not sure we should bother to systemd-ize it at this point?  I'm not 100% sure when those changes would land though, possibly not by F19, so perhaps we do just systemd-ize it and then remove it again for F20?

--- Additional comment from Dan Williams on 2013-05-15 10:32:49 CDT ---

Built for F20; F19 will follow soon. NetworkManager-0.9.9.0-2.git20130515.fc20

--- Additional comment from Fedora Update System on 2013-06-07 17:28:38 CDT ---

NetworkManager-0.9.8.2-1.fc19,network-manager-applet-0.9.8.2-1.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/NetworkManager-0.9.8.2-1.fc19,network-manager-applet-0.9.8.2-1.fc19

--- Additional comment from Fedora Update System on 2013-06-08 22:28:18 CDT ---

NetworkManager-0.9.8.2-1.fc19, network-manager-applet-0.9.8.2-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

--- Additional comment from Berend De Schouwer on 2013-06-11 02:43:02 CDT ---

Scripts in /etc/NetworkManager/dispatcher.d/ no longer run.  I assume it's related to this (it appears related to NetworkManager-0.9.8.2-1.fc19)

I need a custom one for the corporate network when the laptop connects.

$ systemctl status dbus-org.freedesktop.nm-dispatcher.service
dbus-org.freedesktop.nm-dispatcher.service
   Loaded: error (Reason: No such file or directory)
   Active: inactive (dead)

%systemd_post seems to only run on install, not on upgrade of NetworkManager.

/usr/lib/systemd/system/nm_dispatcher.service doesn't exist, but 
/usr/share/dbus-1/system-services/org.freedesktop.nm_dispatcher.service references it.  /usr/lib/systemd/system/NetworkManager-dispatcher.service exists instead.

/usr/libexec/nm-dispatcher.action exists and references /etc/NetworkManager/dispatcher.d

/usr/bin/systemctl preset NetworkManager.service NetworkManager-wait-online.service NetworkManager-dispatcher.service doesn't seem to work.  It's still dbus-org.freedesktop.nm-dispatcher.service no such file or directory.

--- Additional comment from Berend De Schouwer on 2013-06-24 08:08:40 CDT ---

I think I fixed the dispatcher with:

sudo systemctl enable NetworkManager-dispatcher.service 

which created:

ln -s '/usr/lib/systemd/system/NetworkManager-dispatcher.service' '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'
ln -s '/usr/lib/systemd/system/NetworkManager-dispatcher.service' '/etc/systemd/system/multi-user.target.wants/NetworkManager-dispatcher.service'

--- Additional comment from Berend De Schouwer on 2013-06-24 08:14:07 CDT ---

Probable root cause: /usr/lib/systemd/system-preset/90-default.preset contains
'enable nm_dispatcher.service' but not 'enable NetworkManager-dispatcher.service'

Comment 1 Dan Williams 2013-06-25 20:26:20 UTC
TLDR: it's NetworkManager-dispatcher.service, not nm_dispatcher.service.  I suppose it could use a round of cleanups to harmonize the names and the dbus service and everything else but it's likely to change in the future anyway.

Comment 2 Bill Nottingham 2013-06-25 21:24:25 UTC
This is bug 977433, isn't it?

Comment 3 Michal Schmidt 2013-06-26 08:05:01 UTC

*** This bug has been marked as a duplicate of bug 977433 ***