Package: fai-client
Version: 4.3.1
Severity: important

Dear Maintainer,

when using dracut as initrd (default with current FAI version), the
dhclient script will set the kernel's IP lifetime value to the DHCP
lease time. This change was introduced into dracut in [1] to signal
network management software on the real system (such as NetworkManager)
that the assigned IP is dynamic and that they should use DHCP to renew
it.

Once the nfsroot is mounted, dracut's dhclient is killed and FAI's own
dhclient instance is started. Unfortunately, neither Debian's default
dhclient script nor FAI's handle this situation, i.e. while dhclient
happily renews the lease with the real DHCP server, the kernel does not
know that it was in fact renewed, and once the lifetime has expired,
the kernel will automatically remove the IP from the interface. Since
that was the last IP assigned to said interface, the kernel will
automatically take the interface down. The computer will loose all
network connectivity (really bad with nfsroot) and subsequent dhclient
DHCP requests will fail (sendto: Network is down), since dhclient
doesn't really try to up the interface except at startup (and even
then, FAI's dhclient-script will never try to set the IP again, so
even if dhclient succeeded, that wouldn't help).

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1058519

This does not occur if the installation is fast enough that it is
complete before the lease expires (1h with a typical dnsmasq setup),
but if it takes longer, the installation will hang and not complete.

To verify this bug without having to wait a long time, just log into a
computer that's currently installing with FAI (using dracut as initrd)
and run ip -4 addr show. It will then print something like

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> [...]
    inet 192.168.10.23/24 brd 192.168.10.255 scope global dynamic eth0
       valid_lft 3568sec preferred_lft 3568sec
                 ^^^^                  ^^^^

A repeated call a few seconds later will see a decrease in that
number.

This can be worked around by logging into the computer during the
initial stage of the installation via SSH and manually setting the
lifetime to forver (then everything works):

ip -4 addr change 192.168.10.23/24 dev eth0 \
   valid_lft forever preferred_lft forever

For FAI, since the client IP is never expected to change (root on nfs
requires the IP to remain the same), the solution is to just explicitly
set the lifetime to forever on all IPs set by initrd.

To do this, I've placed the following code in $FAI/hooks/subroutines:

/sbin/ip -4 addr show | \
  /usr/bin/awk '/^[0-9]+: [^:]+:/ {
                   iface = substr($2, 1, length($2) - 1);
                }
                /^  *inet [0-9.]*\/[0-9]* / && iface != "lo" {
                   print $2, iface;
                }' | \
  while read addr iface
do
  /sbin/ip -4 addr change "$addr" dev "$iface" \
    valid_lft forever preferred_lft forever
done

I've now run a test installation with this fix and the problem
disappeared. Note that setting the lifetime to forever will not do any
harm if the lifetime is already forever, so it is safe to always
include this.

Therefore, I would suggest to call my code snippet (or something
similar) at the beginning of FAI to make sure the installation won't
abort if it takes longer than the default DHCP lease time (the lease
will be renewed anyway).

Thank you!

Christian

-- System Information:
Debian Release: 8.0
  APT prefers testing
APT policy: (500, 'testing'), (100, 'experimental'), (100, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: systemd (via /run/systemd/system)

Versions of packages fai-client depends on:
ii  debconf-utils    1.5.55
ii  file             1:5.22+15-1
ii  iproute          1:3.16.0-2
ii  iproute2         3.16.0-2
ii  libapt-pkg-perl  0.1.29+b2
ii  perl             5.20.2-2

Versions of packages fai-client recommends:
pn  libgraph-perl  <none>

Versions of packages fai-client suggests:
ii  logtail  1.3.17


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to