Bug 1048520

Summary: dns lookup not working during package installation
Product: Red Hat Enterprise Linux 7 Reporter: Kay Williams <kay>
Component: anacondaAssignee: Radek Vykydal <rvykydal>
Status: CLOSED ERRATA QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: atodorov, dcbw, ljozsa, mbanas, rvykydal
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: anaconda-19.31.87-1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 13:57:15 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:
Attachments:
Description Flags
anaconda.ifcfg.log
none
anaconda.log
none
anaconda.packaging.log
none
anaconda.program.log
none
anaconda.storage.log
none
anaconda.xlog
none
syslog none

Description Kay Williams 2014-01-04 20:26:50 UTC
Description of problem:

In rhel7, rpm scriptlets are unable to resolve hostnames during system installation. This is happening because no /etc/resolv.conf exists in the install chroot. When an /etc/resolv.conf file is manually created in the install chroot (e.g. within a scriptlet), dns resolution works as expected.

This issue is new in rhel7. In rhel6, an appropriate /etc/resolv.conf file existed without extra work by the rpm (presuming dns is configured using anaconda command line or kickstart parameters).

How reproducible:

We have tried with both virt-install and boot.iso install with the same result.

Steps to Reproduce:
1. Create an rpm package with a post-install script that attempts to access network resources using a dns hostname (e.g. use curl to download a file from the internet). Have the scriptlet exit with an error status if network access fails.
2. Include the package in a custom spin. (Using kickstart should work as well).
3. Perform a system installation.
4. View /var/log/anaconda/anaconda.packaging.log to see a scriptlet failed error.

Actual results:
Scriptlet fails attempting to resolve the hostname.

Expected results:
Hostname resolution completes without error.

Notes:
1. If the scriptlet is modified to access the network resource using an ipaddress rather than a hostname, install completes without error.

Comment 2 Brian Lane 2014-01-06 17:01:43 UTC
Please include the logs from /tmp/*log as individul text/plain attachments.

I'm going to move this to NetworkManager, it should be handling the writing of /etc/resolv.conf when they network comes up.

Comment 3 Kay Williams 2014-01-06 23:05:36 UTC
Created attachment 846330 [details]
anaconda.ifcfg.log

Comment 4 Kay Williams 2014-01-06 23:05:57 UTC
Created attachment 846331 [details]
anaconda.log

Comment 5 Kay Williams 2014-01-06 23:06:20 UTC
Created attachment 846332 [details]
anaconda.packaging.log

Comment 6 Kay Williams 2014-01-06 23:06:40 UTC
Created attachment 846333 [details]
anaconda.program.log

Comment 7 Kay Williams 2014-01-06 23:07:14 UTC
Created attachment 846334 [details]
anaconda.storage.log

Comment 8 Kay Williams 2014-01-06 23:09:22 UTC
Created attachment 846335 [details]
anaconda.xlog

Comment 9 Kay Williams 2014-01-06 23:09:44 UTC
Created attachment 846336 [details]
syslog

Comment 10 Kay Williams 2014-01-06 23:15:58 UTC
In the attached anaconda.packaging.log, the scriptlet failed error occurs at line 1553 after the package test.7-4.el7.noarch attempts the following command:

curl http://google.com

Comment 11 Radek Vykydal 2014-01-07 10:03:36 UTC
I think the problem here is that (unlike in rhel6) /etc/resolv.conf is not copied to chroot.

Comment 13 Kay Williams 2014-05-01 15:11:14 UTC
Hello, any chance we can get a fix for this for rhel7?  It is still broken in the release candidate.

For rhel6, we have rpms with simple post scripts to download external content. 

Without a fix, the rhel7 rpm logic is more complex.

1. Install a script that downloads external content.
2. Install a systemd service that runs once to execute the script.
3. Use a post script that determines if we are running under anaconda.
4. If so, enable the systemd service so that it runs at first boot.
5. Else, simply run the script.

Comment 14 Radek Vykydal 2014-05-02 11:32:16 UTC
I've prepared updates image for rhel7 rc2 (should work with rhel7 rc too) containing patch which copies /etc/resolv.conf to target system root before installing packages:

It can by applied for testing by adding boot option:

updates=http://rvykydal.fedorapeople.org/updates.chrootresolv.img

Does it fix the issue for you?

Comment 15 Kay Williams 2014-05-05 19:37:19 UTC
Yes, it works. Thank you!

Comment 17 Alexander Todorov 2014-12-01 12:47:48 UTC
Verified with anaconda-19.31.111-1. Here's my test.spec for reference.

Summary: Test package
Name:    test
Version: 1
Release: 1%{?dist}
License: GPLv2+
Group:   Applications/System
URL:     http://fedoraproject.org/wiki/Anaconda

Requires: curl


%description
Test package.

%prep
echo > /dev/null

%build
echo > /dev/null

%install
mkdir -p %{buildroot}/opt

%files
%dir /opt/

%post

curl http://google.com


%changelog
* Mon Dec 01 2014 Alexander Todorov <atodorov.com> - 1-1
- test

Comment 19 errata-xmlrpc 2015-03-05 13:57:15 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0312.html