Systemd on vivid beta

Tom H tomh0665 at gmail.com
Sat Mar 14 13:51:08 UTC 2015


On Sat, Mar 14, 2015 at 7:21 AM, Colin Law <clanlaw at gmail.com> wrote:
> On 13 March 2015 at 10:02, Colin Law <clanlaw at gmail.com> wrote:
>>
>> Thanks for the suggestion, I am using NM, but enabling that service
>> did not appear to make any difference. Looking at the information I
>> could find on that it seemed that the effect is the same as including
>> After=network-online.target and Wants=network-online.target in the
>> service file, and they are there already.
>>
>> However I think maybe the problem is more fundamental than I thought.
>> I find that if I just manually mount a cifs share ( sudo mount -t cifs
>> ...) and shutdown that I get the same delay on shutdown, whereas if I
>> do the same in an upstart boot then there is no delay. That seems
>> like a reportable bug to me, so I have reported it.
>> https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1431774
>
> In case anyone is interested this was caused by a missing dependency
> in the NetworkManager service file, allowing NM to shutdown too early.
> Fixed in today's network-manager update.

Good. Thanks for letting us know; especially since I was about to set
up a VM to try to replicate your problem.

The now-disabled
"0001-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch"
patch was removing the "Wants" and "Before":

<begin>
diff --git a/data/NetworkManager.service.in b/data/NetworkManager.service.in
index 84a9c95..2fb510f 100644
--- a/data/NetworkManager.service.in
+++ b/data/NetworkManager.service.in
@@ -1,7 +1,5 @@
 [Unit]
 Description=Network Manager
-Wants=network.target
-Before=network.target @DISTRO_NETWORK_SERVICE@

 [Service]
 Type=dbus
</end>

The rationale for this patch was:

<begin>
This patch is needed to avoid a dependency loop which is generated
by early boot (rcS) SysV init scripts depending on the $network LSB
system facility (either directly or indirectly via $remote_fs).

The $network LSB system facility is mapped to network.target.

Those rcS SysV init scripts are started in sysinit.target,
NetworkManager.service is started via multi-user.target, which depends
on sysinit.target.

As long as we have rcS SysV init scripts which such a dependency on
$remote_fs or $network we can not make NetworkManager.service a provider
for network.target.
</end>

Check the rcS scripts for network dependencies:

<begin>
# find /etc/rcS.d/ -type l -print | xargs grep -E '\$network|\$remote'
| grep -v Stop
/etc/rcS.d/S02alsa-utils:# Required-Start:    $local_fs $remote_fs
/etc/rcS.d/S04procps:# X-Start-Before:    $network
/etc/rcS.d/S02mountnfs.sh:# Should-Start:      $network $portmap
nfs-common  udev-mtab
/etc/rcS.d/S01console-setup:# Required-Start:    $remote_fs
/etc/rcS.d/S02x11-common:# Required-Start:    $remote_fs
/etc/rcS.d/S02lm-sensors:# Required-Start:    $remote_fs
/etc/rcS.d/S12bootmisc.sh:# Required-Start:    $remote_fs
</end>

They're all masked in "/lib/systemd/system/" except for console-setup
and lm-sensors, which don't have network dependencies in systemd:

<begin>
# sc cat console-setup.service
# /lib/systemd/system/console-setup.service
[Unit]
Description=Set console keymap
Documentation=man:loadkeys(1)
DefaultDependencies=no
After=local-fs.target

[Service]
Type=oneshot
ExecStart=/usr/bin/loadkeys /etc/console-setup/cached.kmap.gz

# sc cat lm-sensors.service
# /lib/systemd/system/lm-sensors.service
[Unit]
Description=Initialize hardware monitoring sensors

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=-/usr/bin/sensors -s
ExecStart=-/usr/bin/sensors

[Install]
WantedBy=multi-user.target
</end>




More information about the ubuntu-users mailing list