systemd resolv should separate the output of stdout and stderr

Bug #1849608 reported by Steven Shiau
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Fix Released
Undecided
Unassigned
Eoan
Fix Released
Undecided
Unassigned
Focal
Fix Released
Undecided
Unassigned

Bug Description

[impact]

dhclient fails to notify resolved about DNS servers due to bash-specific redirect inside 'resolved' hook script

[test case]

see original description below

[regression potential]

any regression would likely cause resolved not to be aware of dhclient-provided dns servers

[other info]

This is needed only in Eoan and later; X/B/D do not have the bash-specific redirect '&>' in their hook file.

The change that originally added the &> to eoan is also being applied to b/d in bug 1805183, but with this fix added also.

original description:
---

The file /etc/dhcp/dhclient-enter-hooks.d/resolved
provided by systemd (242-7ubuntu3) causes the dhclient failing to get DNS due to systemd-resolved is not run.
This issue can be reproduced on Ubuntu Eoan:
==============================
root@eoan:~# dhclient -v
Internet Systems Consortium DHCP Client 4.4.1
Copyright 2004-2018 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/ens224/00:0c:29:92:d4:da
Sending on LPF/ens224/00:0c:29:92:d4:da
Listening on LPF/ens192/00:0c:29:92:d4:d0
Sending on LPF/ens192/00:0c:29:92:d4:d0
Listening on LPF/ens160/00:0c:29:92:d4:c6
Sending on LPF/ens160/00:0c:29:92:d4:c6
Sending on Socket/fallback
DHCPDISCOVER on ens224 to 255.255.255.255 port 67 interval 3 (xid=0x6d9fb33d)
DHCPDISCOVER on ens192 to 255.255.255.255 port 67 interval 3 (xid=0xeb8fda26)
DHCPREQUEST for 192.168.120.4 on ens160 to 255.255.255.255 port 67 (xid=0x6d39545d)
DHCPACK of 192.168.120.4 from 192.168.120.254 (xid=0x5d54396d)
RTNETLINK answers: File exists
d41d8cd98f00b204e9800998ecf8427e /run/systemd/resolved.conf.d/isc-dhcp-v4-ens160.conf
md5sum: /run/systemd/resolved.conf.d/isc-dhcp-v6-ens160.conf: No such file or directory
5025823d750dda1f3f15e306c4a0afce /run/systemd/resolved.conf.d/isc-dhcp-v4-ens160.conf
md5sum: /run/systemd/resolved.conf.d/isc-dhcp-v6-ens160.conf: No such file or directory
bound to 192.168.120.4 -- renewal in 111 seconds.
root@eoan:~# resolvectl status |grep DNS
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
          DNSSEC NTA: 10.in-addr.arpa
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
==============================

Attached please find the patch for this. The output for md5sum in the hook file resolv should separate the stdout and stderr so it won't compare the wrong data.

Revision history for this message
Steven Shiau (stevenshiau) wrote :
affects: grub-efi-amd64-signed (Ubuntu) → systemd (Ubuntu)
Revision history for this message
Steven Shiau (stevenshiau) wrote :

BTW, forgot to mention, after applying the patch in my system, I have to reboot the system then run "dhclient -v" so that the stale status of previous dhclient won't confuse it.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "resolved.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu):
status: New → Confirmed
Dan Streetman (ddstreet)
description: updated
Balint Reczey (rbalint)
Changed in systemd (Ubuntu Focal):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 243-3ubuntu1

---------------
systemd (243-3ubuntu1) focal; urgency=medium

  [ Dan Streetman ]
  * Fix resolved fallback to TCP (LP: #1849658)
    Author: Dan Streetman
    File: debian/patches/resolved-set-stream-type-during-DnsStream-creation.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=f1ee30b13c9d2d34968b09ce620f3bc24a1a78c7
  * Separate stderr and stdout of /etc/dhcp/dhclient-enter-hooks.d/resolved
    (LP: #1849608)
    Author: Dan Streetman
    File: debian/extra/dhclient-enter-resolved-hook
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=fec4d6d026488a1d32ad9dceef18d9ea9c8acbda

  [ Balint Reczey ]
  * Merge to Ubuntu from Debian experimental
  * Refresh patches:
    - Dropped changes:
      * udevadm trigger: do not propagate EACCES and ENODEV.
        File: debian/patches/udevadm-trigger-do-not-propagate-EACCES-and-ENODEV.patch
        https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=334e3fdc904de05105c78763c88220c1976d1946
      * Pass personality test even when i386 userland runs on amd64 kernel
        File: debian/patches/debian/UBUNTU-test-Pass-personality-test-even-when-i386-userland-runs-o.patch
        https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=42e0bfc426f19430f6768ef4922a9531a345765f

systemd (243-3) experimental; urgency=medium

  * Import patches from v243-stable branch (up to ef677436aa)

 -- Balint Reczey <email address hidden> Wed, 30 Oct 2019 15:19:33 +0100

Changed in systemd (Ubuntu Focal):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in systemd (Ubuntu Eoan):
status: New → Confirmed
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Steven, or anyone else affected,

Accepted systemd into eoan-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/systemd/242-7ubuntu3.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-eoan to verification-done-eoan. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-eoan. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in systemd (Ubuntu Eoan):
status: Confirmed → Fix Committed
tags: added: verification-needed verification-needed-eoan
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (systemd/242-7ubuntu3.2)

All autopkgtests for the newly accepted systemd (242-7ubuntu3.2) for eoan have finished running.
The following regressions have been reported in tests triggered by the package:

gvfs/1.42.1-1ubuntu1 (amd64)
systemd/242-7ubuntu3.2 (ppc64el)
ndctl/unknown (armhf)
casper/1.427 (amd64)
netplan.io/0.98-0ubuntu1 (ppc64el)
munin/unknown (armhf)
linux-oem-osp1/5.0.0-1026.29 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/eoan/update_excuses.html#systemd

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Dan Streetman (ddstreet)
description: updated
Revision history for this message
Dan Streetman (ddstreet) wrote :

ubuntu@lp1849608-e:~$ dpkg -l systemd|grep ii
ii systemd 242-7ubuntu3 amd64 system and service manager
ubuntu@lp1849608-e:~$ sudo dhclient ens3
1496d6a9ac0e80d0d89028d430a5cd2c /run/systemd/resolved.conf.d/isc-dhcp-v4-ens3.conf
md5sum: /run/systemd/resolved.conf.d/isc-dhcp-v6-ens3.conf: No such file or directory
bc36e352f2f891c62533a81bd3520f98 /run/systemd/resolved.conf.d/isc-dhcp-v4-ens3.conf
md5sum: /run/systemd/resolved.conf.d/isc-dhcp-v6-ens3.conf: No such file or directory
ubuntu@lp1849608-e:~$ resolvectl status | grep DNS
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
          DNSSEC NTA: 10.in-addr.arpa
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

ubuntu@lp1849608-e:~$ dpkg -l systemd|grep ii
ii systemd 242-7ubuntu3.2 amd64 system and service manager
ubuntu@lp1849608-e:~$ sudo dhclient ens3
cmp: EOF on /tmp/tmp.inWeTd586j which is empty
ubuntu@lp1849608-e:~$ resolvectl status | grep DNS
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.122.1
          DNS Domain: vm
          DNSSEC NTA: 10.in-addr.arpa
MulticastDNS setting: no
  DNSOverTLS setting: no
      DNSSEC setting: no
    DNSSEC supported: no

tags: added: verification-done verification-done-eoan
removed: verification-needed verification-needed-eoan
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package systemd - 242-7ubuntu3.2

---------------
systemd (242-7ubuntu3.2) eoan; urgency=medium

  [ Dan Streetman ]
  * d/extra/dhclient-enter-resolved-hook:
    - Replace use of bash-only &> with > and 2> (LP: #1849608)
  * d/p/lp1849658-resolved-set-stream-type-during-DnsStream-creation.patch:
    - Fix bug in refcounting TCP stream types (LP: #1849658)
  * d/extra/dhclient-enter-resolved-hook: cleanup temp $newstate file

  [ Rafael David Tinoco ]
  * Add support to KeepConfiguration= fixing behaviour for HA (LP: #1815101)
    - d/p/lp1815101-01-networkd-add-support-to-keep-configuration.patch
    - d/p/lp1815101-02-networkd-stop-clients-when-networkd-shuts-down.patch
    - d/p/lp1815101-03-network-add-KeepConfiguration-dhcp-on-stop.patch
    - d/p/lp1815101-04-network-make-KeepConfiguration-static-drop-DHCP-addr.patch
    - d/p/lp1815101-05-man-add-documentation-about-KeepConfiguration.patch

systemd (242-7ubuntu3.1) eoan; urgency=medium

  [ Balint Reczey ]
  * Fix shutdown and related actions from the login screen (LP: #1847896)
    File: debian/patches/logind-consider-greeter-sessions-suitable-as-display-sess.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=b407dfd8c9dc81594553c27467c35b383333d74c
  * debian/gbp.conf: Set debian-branch to ubuntu-eoan
    File: debian/gbp.conf
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=f399ce2cf4701a2dbb4b3505d2dd17a210d62f5c

  [ Dan Streetman ]
  * Fix bogus routes after DHCP lease change (LP: #1831787)
    Files:
    - debian/patches/lp1831787/0001-networkd-Add-back-static-routes-after-DHCPv4-lease-e.patch
    - debian/patches/lp1831787/0002-network-set-preferred-source-in-removing-route-entry.patch
    - debian/patches/lp1831787/0003-network-lower-log-level-about-critical-connection.patch
    - debian/patches/lp1831787/0004-network-reset-Link-dhcp4_configured-flag-earlier.patch
    - debian/patches/lp1831787/0005-network-split-dhcp_lease_lost-into-small-pieces.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=ced3f5c2f619083f7beb164d94d4ccfe52222fe8
  * Set src address for dhcp 'classless' routes (LP: #1835581)
    File: debian/patches/lp1835581-src-network-networkd-dhcp4.c-set-prefsrc-for-classle.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=6a7ef370fb1335548448920be4ae6176b67044a8
  * Allows cache=no-negative option to be set, ignoring negative answers to
    be cached (LP: #1668771)
    File: debian/patches/lp1668771-resolved-switch-cache-option-to-a-tri-state-option-s.patch
    https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=27def26f5b1d1b8ba314c4a925fc1b7c43837f86

 -- Dan Streetman <email address hidden> Fri, 01 Nov 2019 16:33:08 -0400

Changed in systemd (Ubuntu Eoan):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for systemd has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.