Package: ifupdown
Version: 0.8.13
Severity: normal
Tags: patch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Dear Maintainer,
My laptop stops while the all interfaces listed in /etc/network/interfaces
are configured. This isn't necessary.
Systemd defines two relevant networking targets:
network.target
network-online.target
The currently shipped networking.target says it must complete before
network.target. It's an overkill because network.target is described by
systemd.special(7) as:
network.target
This unit is supposed to indicate when network functionality is
available, but it is only very weakly defined what that is supposed
to mean ...
I think "the loopback interface is up" is a reasonable interpretation of
this. As it is, it waits for all interfaces to come up which can take a
long time. In fact it has an explicit 5 minute timeout. This is in
contravention of systemd.special(7) saying it does "not delay execution
much":
network-online.target
...
In contrast, network.target is a passive unit (i.e. pulled in by
the provider of the functionality, rather than the consumer) that
usually does not delay execution much
Network-online.target on the other hand is a good match for "pause the boot
until all network interfaces are up", as systemd.special(7) describes it as:
network-online.target
Units that strictly require a configured network connection
should pull in network-online.target (via a Wants= type dependency)
and order themselves after it. This target unit is intended to pull
in a service that delays further execution until the network is
sufficiently set up.
The attached patch splits networking.service into
"networking-lo.service", which must happen before network.target, and
"networking-all.service", which must happen before network-online. When
applied my laptop boots nice and quickly, because as systemd.special(7)
says:
network-online.target
...
Usually ... network-online.target is not [part of the boot of most
systems].
That's certainly true for my fairly normal laptop install, and since no
one explicitly waits for network-online.target X now boots quickly and
while it is doing so the network interfaces are being brought up in the
background.
- -- System Information:
Debian Release: stretch/sid
APT prefers testing
APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages ifupdown depends on:
ii adduser 3.115
ii init-system-helpers 1.36
ii iproute2 4.6.0-1
ii libc6 2.23-1
ii lsb-base 9.20160629
Versions of packages ifupdown recommends:
ii isc-dhcp-client [dhcp-client] 4.3.4-1
Versions of packages ifupdown suggests:
ii ppp 2.4.7-1+2
pn rdnssd <none>
- -- no debconf information
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIVAwUBV4zArKzUn4heVFJuAQqkcQ//eSJJm53ONfTmuxWy6UjGoWGf6tnjMMsP
zZ2FjLKqoUjs7WA8diX8nZ5X0it3vgDHxNGdL9SHQHka2fh1hQ41mN2r2rS4U20B
XamAlyXsAce0zmX+cqno7SvBgvko6lB8sYx+YJcqjt90w89nB4m+TYiuEwKqP5g1
vsN/zKfv8qgPwlxh+0NqJ3Bl/GaJ403Dofw2BhO37LzokWm7+uiDu0n12CYymjrf
H/NZ/zD9l0K6pGnDufTUzNgQAKE8uVnm+0nlWIzI9lNQRcJ3YN0IpmzRwX1HknNp
bF+T7SiEOSO1ZrfIrDirp8FUGARXZDt9lU0KVIycCHMx4BK7ylD0IYg7wmwcnYST
zVIxPhKBn2+slvSwxmbR+7gJ+MyciDJSnjZgN3b/v5RGF92b8nes+92DuS5vmeND
DQf+qxz7TMlw4Gp92waiGWmMaFD96IU7u2oo+dvlgkOlmiBP8MBW4zHy4kvDGJer
V2FskPyabek1TKri7Xn5fAw1vRHoXTFkznP0SVrfdpf/upCRSu/vAhSFh7ARkmBe
GTZ7Q2z27JTrjqFlEpAAItNY5Aiag+uXUpCoxyXPuWcU4Ynx04m8Uhvx7mR0Qanr
jA3ubO8TRMTJojBcxbDKci4dsPFzb+yFUC8SL9L37CHpyvzxAaJFcmhFgZP0JGpv
2ITQ3it0B+0=
=mMZc
-----END PGP SIGNATURE-----
diff -Nur ifupdown-0.8.13/debian/networking-all.service ifupdown-0.8.13.new/debian/networking-all.service
--- ifupdown-0.8.13/debian/networking-all.service 1970-01-01 10:00:00.000000000 +1000
+++ ifupdown-0.8.13.new/debian/networking-all.service 2016-07-18 20:54:41.643821691 +1000
@@ -0,0 +1,22 @@
+[Unit]
+Description=Raise all network interfaces
+Documentation=man:interfaces(5)
+DefaultDependencies=no
+Wants=network.target
+After=networking.target
+Before=shutdown.target network-online.target
+Conflicts=shutdown.target
+Requires=networking-lo.service
+
+[Install]
+WantedBy=multi-user.target
+WantedBy=network-online.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=-/etc/default/networking
+ExecStartPre=-/bin/sh -c '[ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle'
+ExecStart=/sbin/ifup -a --read-environment
+ExecStop=/sbin/ifdown -a --read-environment
+RemainAfterExit=true
+TimeoutStartSec=5min
diff -Nur ifupdown-0.8.13/debian/networking-lo.service ifupdown-0.8.13.new/debian/networking-lo.service
--- ifupdown-0.8.13/debian/networking-lo.service 1970-01-01 10:00:00.000000000 +1000
+++ ifupdown-0.8.13.new/debian/networking-lo.service 2016-07-18 20:53:35.998147128 +1000
@@ -0,0 +1,20 @@
+[Unit]
+Description=Raise loopback interface
+Documentation=man:interfaces(5)
+DefaultDependencies=no
+Wants=network.target
+After=local-fs.target network-pre.target apparmor.service systemd-sysctl.service systemd-modules-load.service
+Before=network.target shutdown.target
+Conflicts=shutdown.target
+
+[Install]
+WantedBy=multi-user.target
+WantedBy=network-online.target
+WantedBy=networking-all.target
+
+[Service]
+Type=oneshot
+EnvironmentFile=-/etc/default/networking
+ExecStart=/sbin/ifup --read-environment lo
+ExecStop=/sbin/ifdown --read-environment lo
+RemainAfterExit=true