Fix dhclient removing the IP address on renew
basementhud/pipeline/head This commit looks good Details

For some reason, `dhclient` fires an *EXPIRE* event every time it renews
the DHCP lease, even if the lease has not expired.  `dhclient-script`
then removes the IP address from the interface, which of course breaks
the connection to the NBD server and blocks all reads from the root
filesystem.  To avoid this strange situation, we need to stop
`dhclient-script` acting on the *EXPIRE* event.  Luckily, it provides a
"hook" mechanism that we can use; since the hook script is dot-sourced,
we can just `exit` the process to avoid any further changes in that run.
pull/1/head
Dustin 2022-04-06 16:46:44 -05:00
parent 93c9c90468
commit 4f49686ff1
1 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# Avoid handling the EXPIRE event, which would ordinarily result in the
# IP address being removed from the interface. `dhclient` fires the
# EXPIRE event every time it renews the lease, even if the lease has not
# actually expired.
if [ "${reason}" = EXPIRE ]; then
exit 0
fi