Bug 1044585

Summary: virt-builder network (eg. --install) doesn't work if resolv.conf sets nameserver 127.0.0.1
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, lzap, mbooth, ptoscano, rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-18 19:17:04 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:
Attachments:
Description Flags
0001-appliance-Create-an-etc-resolv.conf-file-referring-t.patch none

Description Richard W.M. Jones 2013-12-18 15:37:31 UTC
Description of problem:

If the *host* has /etc/resolv.conf containing:

nameserver 127.0.0.1

(or ::1 or similar), then virt-builder's network options such
as --install don't work.  The reason is that /etc/resolv.conf
gets copied verbatim into the guest, but an address like 127.0.0.1
doesn't make sense from inside the appliance.

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

virt-builder 1.24.2

How reproducible:

100%

Steps to Reproduce:
1. Have /etc/resolv.conf containing nameserver 127.0.0.1
2. Run virt-builder fedora-19 --install foo

Actual results:

yum / apt / etc fails to resolve repositories.  A typical
error would be:

Error: Cannot retrieve metalink for repository: fedora/19/x86_64. Please verify its path and try again

but the errors can vary depending on the guest being installed.

Expected results:

Network options should work.

Additional info:

Found by Lukáš Zapletal (lzap).

Comment 1 Richard W.M. Jones 2013-12-18 15:40:08 UTC
A workaround (if you have an http proxy) is to set:

export http_proxy=http://1.2.3.4:3128/
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy

Note you must use a dotted quad, not a hostname, so that
name resolution isn't needed.

Comment 2 Richard W.M. Jones 2013-12-18 16:06:55 UTC
Created attachment 838415 [details]
0001-appliance-Create-an-etc-resolv.conf-file-referring-t.patch

Lightly tested patch.

Comment 3 Richard W.M. Jones 2013-12-18 19:17:04 UTC
I pushed this fix and will backport it to 1.24.3 in time.

https://github.com/libguestfs/libguestfs/commit/1fcea09ee2e89d2e727e39df80dc595f5d0ba363