systemd: /etc/dhcp/dhclient-enter-hooks.d/resolved error
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
Bionic |
Fix Released
|
Low
|
Unassigned | ||
Focal |
Fix Released
|
Low
|
Dan Streetman |
Bug Description
[impact]
with systemd-resolved disabled, dhclient doesn't correctly notify resolvconf about dns server(s)
[test case]
install resolvconf and ifupdown and disable systemd-resolved and systemd-networkd, use ifupdown to get a dhcp address where the lease includes a dns nameserver, verify resolvconf is using that dhcp-provided nameserver
[regression potential]
failure to correctly notify systemd-resolved about new dhclient-provided nameserver(s)
[scope]
this is needed for f and earlier
in g and later the hook script is moved to the isc-dhcp package, and edited to correctly check is-enabled systemd-resolved instead of only checking for the existence of the binary
[original description]
The functionality exists to allow users to revert to the traditional ifupdown
package for network configuration. Alongside this, systemd's often-buggy
resolver can be disabled. However, there's a logic error in the systemd-
supplied /etc/dhcp/
from populating /etc/resolv.conf properly when systemd-resolved is disabled.
The issue is here:
if [ -x /lib/systemd/
Instead of checking to see if the systemd-resolved service is enabled or
active, which would be the correct behaviour, this checks for the existence of
a binary, assuming that if it exists it's supposed to be used.
I've not tested this in the absence of resolvconf, but if systemd-resolved
isn't enabled, it's difficult to imagine this code wanting to run. I've tested
this with resolvconf and ifupdown driving dhclient, and it corrects the
behaviour that was broken with the introduction of systemd-resolved.
I'm attaching a patch, and am also including it here for easy access:
*** resolved.broken 2019-11-19 15:01:28.785588838 +0000
--- resolved 2019-11-19 15:08:06.519430073 +0000
***************
*** 14,20 ****
# (D) = master script downs interface
# (-) = master script does nothing with this
! if [ -x /lib/systemd/
# For safety, first undefine the nasty default make_resolv_conf()
case "$reason" in
--- 14,21 ----
# (D) = master script downs interface
# (-) = master script does nothing with this
! systemctl is-active systemd-resolved > /dev/null 2>&1
! if [ $? -eq 0 ]; then
# For safety, first undefine the nasty default make_resolv_conf()
case "$reason" in
Related branches
- Dimitri John Ledkov (community): Approve (code-review)
-
Diff: 202 lines (+153/-1)6 files modifieddebian/changelog (+18/-0)
debian/control (+1/-1)
debian/ifupdown.dhclient-enter-hook (+20/-0)
debian/ifupdown.dhclient-exit-hook (+110/-0)
debian/ifupdown.maintscript (+1/-0)
debian/install (+3/-0)
CVE References
tags: | added: rls-ff-incoming |
Changed in systemd (Ubuntu Focal): | |
status: | New → Triaged |
importance: | Undecided → Low |
tags: | added: resolved-resolvconf |
tags: | added: ddstreet |
tags: | removed: ddstreet |
description: | updated |
Changed in systemd (Ubuntu Focal): | |
assignee: | nobody → Dan Streetman (ddstreet) |
status: | Triaged → In Progress |
Changed in systemd (Ubuntu Bionic): | |
importance: | Undecided → Low |
sdezial notes this being terser. I do the long form out of superstitious awe
at the notion of a return code of zero being "true", even though it always
is, but this would be terser and also correct:
if systemctl is-active systemd-resolved > /dev/null 2>&1; then