Bug 545435

Summary: /etc/hosts doesn't contain ipv6 record
Product: [Fedora] Fedora Reporter: Daniel Mach <dmach>
Component: mockAssignee: Clark Williams <williams>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 12CC: dcantrell, kdudka, mebrown, williams
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.0.2-1.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-01-12 23:52:30 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daniel Mach 2009-12-08 15:23:44 UTC
curl testsuite fails on bad network setup.
localhost6 is missing in the buildroot.

default /etc/hosts written in the buildroot contains:
127.0.0.1 localhost localhost.localdomain $HOSTNAME

Can you change it to a similar record which is in setup package?
It contains:
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

Comment 1 Clark Williams 2009-12-10 22:16:12 UTC
All we're doing is copying the system /etc/hosts into the chroot when the chroot is created. Not sure I want to take on editing of that file to see if it contains an IPv6 entry and add it if it doesn't.

Comment 2 Daniel Mach 2009-12-11 11:13:01 UTC
(In reply to comment #1)
> All we're doing is copying the system /etc/hosts into the chroot when the
> chroot is created. Not sure I want to take on editing of that file to see if it
> contains an IPv6 entry and add it if it doesn't.  

That's not exactly true.
If you switch this feature off, default /etc/hosts is written to the chroot:

if not config_opts['use_host_resolv'] and not config_opts['files'].has_key('etc/hosts'):
    config_opts['files']['etc/hosts'] = "127.0.0.1 localhost localhost.localdomain %s\n" % gethostname();

Comment 3 Clark Williams 2009-12-11 15:18:11 UTC
Ah, good point.

So what you'd like is a sane default if not copying the system hosts file?

Comment 4 Daniel Mach 2009-12-11 16:11:32 UTC
Exactly.
Since this is how koji uses mock by default, it would be nice to fix it.

Comment 5 Clark Williams 2009-12-11 17:49:33 UTC
That makes sense. 

One question: do we need to add the results of gethostname() to the IPv6 line, or can we just use the line you listed above? I mean do we need to do this:

    # default /etc/hosts contents
    if not config_opts['use_host_resolv'] and not  
        config_opts['files'].has_key('etc/hosts'):
        config_opts['files']['etc/hosts'] = '''
127.0.0.1 localhost localhost.localdomain %s
::1       localhost localhost.localdomain localhost6 localhost6.localdomain6 %s
''' % (gethostname(), gethostname())

or do we do this:

    # default /etc/hosts contents
    if not config_opts['use_host_resolv'] and not  
        config_opts['files'].has_key('etc/hosts'):
        config_opts['files']['etc/hosts'] = '''
127.0.0.1 localhost localhost.localdomain %s
::1       localhost localhost.localdomain localhost6 localhost6.localdomain6
''' % gethostname()

Comment 6 Fedora Update System 2009-12-23 23:06:19 UTC
mock-1.0.2-1.el5 has been submitted as an update for Fedora EPEL 5.
http://admin.fedoraproject.org/updates/mock-1.0.2-1.el5

Comment 7 Fedora Update System 2009-12-24 03:52:08 UTC
mock-1.0.2-1.el5 has been pushed to the Fedora EPEL 5 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mock'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/EL-5/FEDORA-EPEL-2009-1055

Comment 8 Fedora Update System 2009-12-24 20:34:52 UTC
mock-1.0.2-1.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mock'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-13597

Comment 9 Kamil Dudka 2010-01-10 15:45:28 UTC
(In reply to comment #5)
> One question: do we need to add the results of gethostname() to the IPv6 line,
> or can we just use the line you listed above? I mean do we need to do this:

I didn't answer, because both variants from comment #5 looks good to me.

However what you have done afterwards is none of the variants above, or am I wrong?

The hostname in /etc/hosts is not needed by curl, which is actually the reason of this bug opened, but I am only afraid that removing hostname completely might break something else.

Comment 10 Fedora Update System 2010-01-12 23:52:25 UTC
mock-1.0.2-1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 11 Fedora Update System 2010-01-12 23:56:29 UTC
mock-1.0.2-1.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Daniel Mach 2010-01-13 13:00:55 UTC
(In reply to comment #9)
> The hostname in /etc/hosts is not needed by curl, which is actually the reason
> of this bug opened, but I am only afraid that removing hostname completely
> might break something else.    

Mock buildroots are isolated environment and processes inside are not supposed to communicate over network. They also shouldn't need even the hostname (localhost should be sufficient). I'm OK with the change, we'll see what happens...