Re: CD, NFSROOT and expiring DHCP lease
Hmm, my last patch does not work, becaus building the initrd by dracut fails if the kill-dhclient.sh script does not exist. I've tried it another way by adding this to fai-make-nfsroot: sed -i -e '/kill-dhclient.sh/d' $NFSROOT/usr/lib/dracut/modules.d/35network-legacy/module-setup.sh It worked, the dhclient was started inside the initrd but not killed. So the dhclient is still running. But this also had problems when using an nfsroot mount, when I forced the lease-time to be short. I guess the dhclient cannot renew the IP because it accesses files from inside the initrd which are not available any more when FAI is running. So, I'm not sure if it works from fai-cd. How should we fix #987779? Any ideas? -- regards Thomas
Re: CD, NFSROOT and expiring DHCP lease
Hi Andrew, yes this makes it more worse, I can confirm it. The new approach will be to stop the initrd from killing dhclient. Here's the patch, but it's not yet tested: diff --git a/bin/fai-make-nfsroot b/bin/fai-make-nfsroot index 3b9fbb6e..02b332a4 100755 --- a/bin/fai-make-nfsroot +++ b/bin/fai-make-nfsroot @@ -458,6 +458,7 @@ EOF # remove file diversion, then create initrd rm $NFSROOT/etc/kernel/postinst.d/dracut $ROOTCMD dpkg-divert --rename --remove /etc/kernel/postinst.d/dracut +rm -f $NFSROOT/usr/lib/dracut/modules.d/35network-legacy/kill-dhclient.sh $ROOTCMD dpkg-reconfigure dracut set_root_pw > On Fri, 20 Aug 2021 20:20:08 +1200, Andrew Ruthven > said: > On Thu, 2021-04-29 at 22:48 +1200, Andrew Ruthven wrote: >> Is there an approach so that ISO images created with fai-cd > perform >> DHCP lease renewals? > As a workaround, you could write a hook, that starts dhclient. > Since the hooks are on the ISO and will be executed, this should work > until I release a new FAI version with a fix. > Yup, sure thing. I'll see about doing this tomorrow. > I can now confirm that this didn't work, in fact it made things worse! > Running dhclient caused a second IP to be allocated to the machine being built which then > caused the nfsroot to become unreachable.
Re: CD, NFSROOT and expiring DHCP lease
On Thu, 2021-04-29 at 22:48 +1200, Andrew Ruthven wrote: > > > Is there an approach so that ISO images created with fai-cd > > perform > > > DHCP lease renewals? > > As a workaround, you could write a hook, that starts dhclient. > > Since the hooks are on the ISO and will be executed, this should > > work > > until I release a new FAI version with a fix. > > Yup, sure thing. I'll see about doing this tomorrow. I can now confirm that this didn't work, in fact it made things worse! Running dhclient caused a second IP to be allocated to the machine being built which then caused the nfsroot to become unreachable. I wasn't able to get to the bottom of things as I had to get the new servers built. Cheers, Andrew -- Andrew Ruthven, Wellington, New Zealand and...@etc.gen.nz | Catalyst Cloud: | This space intentionally left blank https://catalystcloud.nz |
Re: CD, NFSROOT and expiring DHCP lease
On Thu, 2021-04-29 at 12:04 +0200, Thomas Lange wrote: > > > > > > On Thu, 29 Apr 2021 21:21:06 +1200, Andrew Ruthven < > > > > > > and...@etc.gen.nz> said: > > > Dracut acts as a DHCP client, but is a single shot only. Once > the > > lease expires nothing on the machine building rebuilt renews > > it. > Hi Andrew, > > you are right, in FAI the kernel (or maybe the initrd) configures the > IP addresses and sets valid_lft and preferred_lft to forever. It is the kernel which performs the DHCP request, and renews it as required. > Then a one-shot dhcp request is done, but with a different config and > dhcp script to write the file boot.log. > FAI does not start the dhclient to automatic renew the ip leases. > This > is a bug. Cool. Good to know I'm not going crazy! > > Is there an approach so that ISO images created with fai-cd > perform > > DHCP lease renewals? > As a workaround, you could write a hook, that starts dhclient. > Since the hooks are on the ISO and will be executed, this should work > until I release a new FAI version with a fix. Yup, sure thing. I'll see about doing this tomorrow. > It would be nice if you could file a bug report for this. Done. :) Cheers, Andrew -- Andrew Ruthven, Wellington, New Zealand and...@etc.gen.nz | Catalyst Cloud: | This space intentionally left blank https://catalystcloud.nz |
Re: CD, NFSROOT and expiring DHCP lease
> On Thu, 29 Apr 2021 21:21:06 +1200, Andrew Ruthven > said: > Dracut acts as a DHCP client, but is a single shot only. Once the > lease expires nothing on the machine building rebuilt renews > it. Hi Andrew, you are right, in FAI the kernel (or maybe the initrd) configures the IP addresses and sets valid_lft and preferred_lft to forever. Then a one-shot dhcp request is done, but with a different config and dhcp script to write the file boot.log. FAI does not start the dhclient to automatic renew the ip leases. This is a bug. > Is there an approach so that ISO images created with fai-cd perform > DHCP lease renewals? As a workaround, you could write a hook, that starts dhclient. Since the hooks are on the ISO and will be executed, this should work until I release a new FAI version with a fix. It would be nice if you could file a bug report for this. -- viele Grüße Thomas