Bug 1785244

Summary: /etc/resolv.conf is broken when it's an absolute symbolic link on the host
Product: [Fedora] Fedora Reporter: Martin Pitt <mpitt>
Component: toolboxAssignee: Debarshi Ray <debarshir>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 31CC: debarshir, luca.giuzzi
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: toolbox-0.0.95-1.fc32 toolbox-0.0.95-1.fc33 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-01 19:30:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Martin Pitt 2019-12-19 13:40:34 UTC
Description of problem: It's quite common for a host to not have a direct static /etc/resolv.conf, but a symlink to a file in /run. Particularly with NetworkManager or systemd-resolved.

Version-Release number of selected component (if applicable):

toolbox-0.0.17-1.fc31.noarch

How reproducible: Always


Steps to Reproduce:
1. Set up host to have /etc/resolv.conf -> /run/NetworkManager/resolv.conf
2. toolbox create
3. toolbox run sudo dnf install gzip

Actual results:

Failed to download metadata for repo 'fedora-modular'
Error: Failed to download metadata for repo 'fedora-modular'


Expected results: DNS resolution works

Additional info:

Toolbox sets up /etc/resolv.conf as symlink to /run/host/etc/resolv.conf . But that is a symlink itself, and /run/NetworkManager just doesn't exist in the container.

Simple suggestion: copy the contents instead of creating the link. But that fails with VPN changes, short leases, and dynamic wifis.

Better suggestion: if the host's /etc/resolv.conf is a symlink, readlink it and prepend /run/host/:

    sudo ln -sfn /run/host/$(readlink /run/host/etc/resolv.conf) /etc/resolv.conf

Comment 1 Martin Pitt 2020-02-26 22:34:55 UTC
I sent a fix to upstream: https://github.com/containers/toolbox/pull/380

Comment 2 Martin Pitt 2020-07-09 20:02:08 UTC
Unfortunately my fix was ignored all the time, and now it does not apply any more to the Go rewrite. That's still affected by the exact same bug, though.

toolbox-0.0.92-1.fc32.x86_64

Comment 3 Debarshi Ray 2020-08-28 12:41:50 UTC
> 1. Set up host to have
> /etc/resolv.conf -> /run/NetworkManager/resolv.conf

My understanding from reading the patches used to implement the switch to systemd-resolved in Fedora 33 [1] is that a relative symbolic link would be used:
  /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

That already works since Toolbox 0.0.14, which is relatively old by now.

Maybe consider changing the link locally on your system for a short-term workaround?

Anyway, the absolute symbolic link is also fixed upstream now.

Thanks for pursuing this, and my apologies for the delay.

[1] https://fedoraproject.org/wiki/Changes/systemd-resolved

Comment 4 Debarshi Ray 2020-08-30 21:13:21 UTC
*** Bug 1798005 has been marked as a duplicate of this bug. ***

Comment 5 Fedora Update System 2020-08-30 21:15:36 UTC
FEDORA-2020-885e55baff has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-885e55baff

Comment 6 Fedora Update System 2020-08-30 21:17:45 UTC
FEDORA-2020-306addaac0 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-306addaac0

Comment 7 Fedora Update System 2020-08-31 15:55:18 UTC
FEDORA-2020-306addaac0 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-306addaac0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-306addaac0

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

Comment 8 Fedora Update System 2020-08-31 18:57:16 UTC
FEDORA-2020-885e55baff has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-885e55baff`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-885e55baff

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

Comment 9 Fedora Update System 2020-09-01 19:30:50 UTC
FEDORA-2020-306addaac0 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2020-09-10 20:29:04 UTC
FEDORA-2020-885e55baff has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.