[Libguestfs] Name resolution not working inside virt-customize

Richard W.M. Jones rjones at redhat.com
Fri Mar 13 16:21:37 UTC 2015


On Fri, Mar 13, 2015 at 11:28:56AM -0400, Lee Revell wrote:
> On 03/13/2015 11:13 AM, Richard W.M. Jones wrote:
> >
> >Yes, the log indicates name resolution not working.  Please try the
> >diagnosis steps that I outlined in:
> >
> >https://www.redhat.com/archives/libguestfs/2015-March/msg00075.html
> 
> Sorry, I somehow missed the above message.
> 
> $ ./run guestfish get-backend
> direct
> 
> Here are the outputs of the /dev/tcp test, first doing:
> 
> $ ./run guestfish -v -x --network -a /dev/null run : debug sh 'exec
> 3<> /dev/tcp/google.com/80 ; echo -e "GET /\n" >&3 ; cat <&3'
> 
> And then by IP:
> 
> $ ./run guestfish -v -x --network -a /dev/null run : debug sh 'exec
> 3<> /dev/tcp/173.194.121.5/80 ; echo -e "GET /\n" >&3 ; cat <&3'
> 
> Both fail...

So what's happening is that /etc/resolv.conf in the appliance never
gets created.

*If* /etc/resolv.conf had been created then we should see evidence
that this code had been run:

https://github.com/libguestfs/libguestfs/blob/master/daemon/command.c#L148-L215

(eg. the "renaming ... to ..." messages should appear).

Question is why does /etc/resolv.conf not get created?

On Fedora, it is created by dhclient running from appliance/init:

https://github.com/libguestfs/libguestfs/blob/master/appliance/init#L88-L94

On Debian/Ubuntu that is supposed to run dhclient if available or
dhcpcd if not.

Run `./run virt-rescue --network --scratch' on the Ubuntu host and see if:

 - either dhclient or dhcpcd exists in the appliance

 - they work when you run them, or if there is an error message

 - if running one of them creates /etc/resolv.conf

I don't see any error in the log from either dhclient or dhcpcd, so I
have to assume that one of them ran, but perhaps there is some other
problem.

Also perhaps the packagelist (appliance/packagelist.in) doesn't list
the right package containing dhclient/dhcpcd.

Also maybe a different dhcp client is needed.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list