Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Discussions about using Linux guests in VirtualBox.
Post Reply
GeorgeRT
Posts: 13
Joined: 21. Jan 2017, 16:31

Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by GeorgeRT »

I have a CentOS 7.3 machine that is a guest running on Oracle VirtualBox. The host is a Windows machine. I can ping 8.8.8.8 from the Linux server. The internet works fine from the Windows host. The Linux server can ping itself by its hostname

Code: Select all

ping coolvm
. As root I recently did a

Code: Select all

yum -y update
command. That is when curl stopped working. FQDNs will not resolve.

If I try this:

Code: Select all

 curl -v http://www.google.com
I get this error:

Code: Select all

 * Could not resolve host: http://www.google.com; Unknown error
 * Closing connection 0 curl: (6) COuld not resolve host: http://www.google.com; Unknown error
The commands nslookup, dig and host have not been installed. I cannot install new Yum packages because I get an error related to host resolution ("Resolving time out").

The /etc/resolv.conf file looks like this:

Code: Select all

    # Generated by NetworkManager
    search localdomain
    nameserver 8.8.8.8
    nameserver 8.8.4.4
I tried rebooting the host machine (and thus the guest too). But that did not help me. Browsing the internet has not changed.

The interface for the main NIC in /etc/sysconfig/network-scripts/ has DNS server stanzas that have worked in the past. The interface file is standard and complete. I have not changed it since the

Code: Select all

yum -y update
command.

In Oracle VirtualBox, in Devices -> Network -> Network Settings, Adapter 1 has the "Attached to" setting of "NAT."

How can I get FQDNs to resolve? I want to use the Lynx command. My repositories rely on FQDNs to resolve. I cannot use yum to install packages.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by Perryg »

Has this guest ever been able to work as it should or is this a new install?

Post the results of ifconfig -a for this guest.
GeorgeRT
Posts: 13
Joined: 21. Jan 2017, 16:31

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by GeorgeRT »

Yes, this guest used to work perfectly. I could use Yum commands and curl would work.

Code: Select all

ifconfig -a 
returns

Code: Select all

-bash: ifconfig: command not found
I read that ifconfig was an older command and no longer installed on CentOS 7.x.

I cannot use Putty. So I cannot lift text. The route command does not work. I get "command not found."
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by Perryg »

Everybody has to be different these days I guess. Makes no sense to me the reasoning but the command would be ip addr for CLI in centos 7.

They keep this up and no one will be willing to help cross architecture.

Note: Once you get the ability to download again you can install net-tools and it will bring back ifconfig into the fold.
Note 2: You can always take a screen shot of the cent window from the host. Be sure to crop it to only show the cent window, and attach it here.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by Perryg »

It would also help to know what changed between the time this worked and now.
GeorgeRT
Posts: 13
Joined: 21. Jan 2017, 16:31

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by GeorgeRT »

I do not know how to download anything. The thing that changed between the time things were working and now: I used "yum -y update." I rebooted after packages updated. Now I cannot use curl. Rather than use ifconfig, I have used

Code: Select all

ip addr
and attached the results.
Attachments
Results of "ip addr"
Results of "ip addr"
pic1.jpg (68.38 KiB) Viewed 13761 times
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by Perryg »

If you find that you cannot resolve friendly URLs in a guest (using VBox NAT) you need to switch the way VirtualBox provides the DNS information.

Try this (on the host) in a terminal.

Code: Select all

VBoxManage modifyvm "VM name" --natdnshostresolver1 on
Replace the "VM name" with the name of your guest and don't forget the quotes " "

The above command is per VM. If you want to set this globally use the following in a host terminal.

Code: Select all

VBoxManage setextradata global natdnshostresolver1 on
Backup your VirtualBox.xml and the guests control file first in case you make a mistake.
GeorgeRT
Posts: 13
Joined: 21. Jan 2017, 16:31

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by GeorgeRT »

I tried this command (but I replaced "VM name"):

Code: Select all

VBoxManage modifyvm "VM name" --natdnshostresolver1 on
The command prompt just went to the next line. There was no error, so I think it worked. I tried with an incorrect "VM name." That produced an error. But when I started the Linux guest again, the curl problems remained. My main problem is no different from when I originally started this thread.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by socratis »

Aren't RHEL and CentOS siblings? The reason I'm bringing this up is because there is another thread (Network Service is not getting up in RHEL7) that exhibits the same problems.

I'm linking the two by posting a message to each thread. I don't want to merge the two, because it's going to be a mess. Simply everyone involved keep an eye on both threads. Just post a "Hey I'm having the same issue" on each other's thread so you'll be notified if a new post gets posted.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by Perryg »

Yes centos and redhat are related but there is a difference in the two posts such that they are not using the same network config. This one NAT and the other Natnet. The other one does not get an IP address and this one does, leading me to thing that the resolver for the guest is the cause for this one and maybe not the other one. Another difference is the OP from this ticket can ping the outside address but not the friendly name so it is definitely a DNS issue.

Edit: I do not have this or the other OP issue as I have just tested both again, so I think it must be an issue with the configuration of the guest or something corrupt in the network stack of both.
centos7-network.png
centos7-network.png (19.55 KiB) Viewed 13747 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by socratis »

Perryg wrote:I think it must be an issue with the configuration of the guest or something corrupt in the network stack of both.
That was my guesstimate as well when I "linked" the two of them.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
GeorgeRT
Posts: 13
Joined: 21. Jan 2017, 16:31

Re: Why am I getting "Curl (6) Could not resolve host" after I did a "yum -y update"?

Post by GeorgeRT »

On Windows 7 Professional (the host), I reinstalled Oracle VirtualBox with the latest version 5.1.18r14002. I created a new CentOS 7.3 guest. The problem persists on this new guest. FQDNs will not resolve. The curl command to google.com will result in an error.

I tried different steps to troubleshoot and resolve this. But I have not had any luck. I am going to have to stop using Oracle VirtualBox for my project and find a different solution.
Post Reply