Bug#887556: non deterministic behavior of network-online.target
Michael Biebl
email at michaelbiebl.de
Wed Jan 17 21:11:08 GMT 2018
Am 17.01.2018 um 21:39 schrieb Vladislav Kurz:
> Package: systemd
> Version: 232-25+deb9u1
> Severity: normal
>
> Hello,
>
> This is a followup to archived bug #870361
>
> I have been installing new servers with similar setup as last time, and
> ran into the same problem. I think I have narrowed the problem down to
> network-online.target
>
> The problem affects not only my custom service unit but also the generated
> unit for isc-dhcp-server.
> This is /var/run/systemd/generator.late/isc-dhcp-server.service
>
> # Automatically generated by systemd-sysv-generator
>
> [Unit]
> Documentation=man:systemd-sysv-generator(8)
> SourcePath=/etc/init.d/isc-dhcp-server
> Description=LSB: DHCP server
> Before=multi-user.target
> Before=multi-user.target
> Before=multi-user.target
> Before=graphical.target
> After=remote-fs.target
> After=network-online.target
> After=slapd.service
> After=nss-lookup.target
> Wants=network-online.target
>
> [Service]
> Type=forking
> Restart=no
> TimeoutSec=5min
> IgnoreSIGPIPE=no
> KillMode=process
> GuessMainPID=no
> RemainAfterExit=yes
> SuccessExitStatus=5 6
> ExecStart=/etc/init.d/isc-dhcp-server start
> ExecStop=/etc/init.d/isc-dhcp-server stop
>
> ==== EOF ====
>
> You see it has After=network-online.target, and yet my server failed to
> start DHCP server in 3 out of 4 reboots, with this in syslog:
>
> Jan 17 15:40:43 gw dhcpd[1269]: No subnet declaration for eno2 (no IPv4
> addresses).
> Jan 17 15:40:43 gw dhcpd[1269]: ** Ignoring requests on eno2. If this
> is not what
> Jan 17 15:40:43 gw dhcpd[1269]: you want, please write a subnet
> declaration
> Jan 17 15:40:43 gw dhcpd[1269]: in your dhcpd.conf file for the
> network segment
> Jan 17 15:40:43 gw dhcpd[1269]: to which interface eno2 is attached. **
> Jan 17 15:40:43 gw dhcpd[1269]:
> Jan 17 15:40:43 gw dhcpd[1269]:
> Jan 17 15:40:43 gw dhcpd[1269]: Not configured to listen on any interfaces!
>
> ==== EOF ====
>
> Yet after logging to the server eno2 was configured and I was able to
> start dhcp server manually. The dhcpd.conf is:
>
> option domain-name "example.com";
> option domain-name-servers 192.168.45.1;
> option netbios-name-servers 192.168.45.1;
> option ntp-servers 192.168.45.1;
> option log-servers 192.168.45.1;
> default-lease-time 86400;
> max-lease-time 604800;
> ddns-update-style none;
> authoritative;
> log-facility local7;
> subnet 192.168.45.0 netmask 255.255.255.0 {
> range 192.168.45.10 192.168.45.99;
> option routers 192.168.45.1;
> }
>
> ==== EOF ====
>
> I'm not using any network manager or anything...
> eno1 is using dhclient, but will be moved to static when it goes to
> production. eno2 (dhcp server interface) is static IPv4
>
> /etc/network/interfaces:
>
> # The loopback network interface
> auto lo
> iface lo inet loopback
>
> # The primary network interface
> auto eno1
> iface eno1 inet dhcp
> #address 192.168.1.2
> #netmask 255.255.255.0
> #gateway 192.168.1.1
>
> # The local network interface
> auto eno2
> iface eno2 inet static
> address 192.168.45.1
> netmask 255.255.255.0
>
> ==== EOF ====
>
> In /etc/default/isc-dhcp-server I have only:
>
> INTERFACESv4="eno2"
> INTERFACESv6=""
>
> My own service unit for mounting encrypted filesystem was failing at
> exactly the same reboot attempts as dhcp server, so I think this is not
> a bug in my unit or dhcp server but in systemd itself.
>
> My unit is:
>
> [Unit]
> Description=Mount encrypted disks (webstep script)
> ConditionPathExists=/usr/local/sbin/mount_enc_disks.sh
> After=network-online.target
> Wants=network-online.target
> Before=zfs-import-cache.service
>
> [Service]
> Type=oneshot
> ExecStart=/usr/local/sbin/mount_enc_disks.sh
> StandardOutput=journal
> RemainAfterExit=yes
>
> [Install]
> WantedBy=zfs.target
>
> ==== EOF ====
>
>
> I'm attaching a censored syslog from both good and bad boot. You can see
> that in failed case our script and dhcp server is started before
> dhclient, and on sucessful case it is staretd after dhclient. And I dare
> say that sucessfull assignment of IP address by dhclient should be a
> required before network-online.target is finished.
>
> My colleague has had a similar case with other server, where our script
> was not run at all, but zfs-import-cache was started early in boot
> process. And after a reboot (without any config change) everything went
> fine. Screenshot comparing the significant parts of boot is attached.
>
> If you want more config files I can send them.
>
> If you still think that it is not a fault of systemd, then please tell
> me what I have done wrong, and what should I put in unit files to keep
> them in this order:
>
> 1. network is fully functional (IP adresses assigned to all interfaces)
> 2. our script is run (wget key and decrypt filesystems)
> 3. zfs imports and mounts the filesystems
> 4. services that have data on encrypted zfs are started
>
It's not systemd that pulls in network-online.target. You should contact
the ifupdown maintainers why apparently network-online.target does not
work for you.
--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20180117/4f657862/attachment-0002.sig>
More information about the Pkg-systemd-maintainers
mailing list