Bug 2115094 - Systemd package updates resolv.conf unexpectedly
Summary: Systemd package updates resolv.conf unexpectedly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-08-03 20:01 UTC by Noah Meyerhans
Modified: 2022-11-02 19:53 UTC (History)
11 users (show)

Fixed In Version: systemd-252~rc2-612.fc38 systemd-251.7-611.fc37
Clone Of:
Environment:
Last Closed: 2022-11-02 19:53:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Noah Meyerhans 2022-08-03 20:01:23 UTC
Description of problem:

This issue is related to https://bugzilla.redhat.com/show_bug.cgi?id=1891847

On my system, I have pointed the /etc/resolv.conf symlink to ../run/systemd/resolve/resolv.conf. I do not have DNSStubListener disabled in resolved.conf.  Updating the systemd package causes that symlink to be overwritten with a link to ../run/systemd/resolve/stub-resolv.conf

Opening this with "low" severity because DNS is not broken, but the resolution process has changed unexpectedly.

Version-Release number of selected component (if applicable): systemd-251.3-2.fc37.x86_64 (and earlier)


How reproducible: 100%


Steps to Reproduce:
1. Start with an up-to-date Fedora 36 system
2. Update the /etc/resolv.conf symlink to point to systemd-resolved's resolv.conf: sudo ln -sf ../run/systemd/resolve/resolv.conf /etc/resolv.conf
3. Update to systemd from rawhide: sudo dnf update systemd --releasever=rawhide
4. Inspect the /etc/resolv.conf symlink

Actual results:

The /etc/resolv.conf symlink has been updated to point to ../run/systemd/resolve/stub-resolv.conf

Expected results:

The /etc/resolv.conf symlink was preserved such that it still points to ../run/systemd/resolve/resolv.conf

Additional info:

The %posttrans resolved section in the spec file contains the following:

# Also don't create the symlink to the stub when the stub is disabled (#1891847 again).

if systemctl -q is-enabled systemd-resolved.service &>/dev/null &&
   ! systemd-analyze cat-config systemd/resolved.conf 2>/dev/null |
        grep -iqE '^DNSStubListener\s*=\s*(no?|false|0|off)\s*$'; then

  if ! test -e /etc/resolv.conf && ! test -L /etc/resolv.conf; then
    ln -sv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf || :
  elif test -d /run/systemd/system/ &&
     ! mountpoint /etc/resolv.conf &>/dev/null; then
    ln -fsv ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf || :
  fi
fi


This code checks to see if DNSStubListener is disabled, and avoids replacing /etc/resolv.conf if it is. However, the situation in which /etc/resolv.conf points to /run/systemd/resolve/resolv.conf even when DNSStubListener is enabled is valid and is not detected.  One possible solution to this might be to add an additional condition to the outer `if` block:

   [ $(readlink -f /etc/resolv.conf) != /run/systemd/resolve/resolv.conf ]

Comment 1 Ben Cotton 2022-08-09 13:35:41 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.

Comment 2 Fedora Update System 2022-10-18 13:16:12 UTC
FEDORA-2022-a5f8e10002 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2022-a5f8e10002

Comment 3 Fedora Update System 2022-10-18 13:19:59 UTC
FEDORA-2022-a5f8e10002 has been pushed to the Fedora 38 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 4 Fedora Update System 2022-10-24 20:05:41 UTC
FEDORA-2022-c72fd8b071 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2022-c72fd8b071

Comment 5 Fedora Update System 2022-10-25 11:34:49 UTC
FEDORA-2022-c72fd8b071 has been pushed to the Fedora 37 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2022-c72fd8b071`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-c72fd8b071

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2022-11-02 19:53:08 UTC
FEDORA-2022-c72fd8b071 has been pushed to the Fedora 37 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.