Could not resolve host unknown error

when I try to load a web page to terminal it gives curl: (6) Could not resolve host error. I have internet in my PC and trying from my home internet connection. So as I there is no any proxy invo...

when I try to load a web page to terminal it gives curl: (6) Could not resolve host error.

I have internet in my PC and trying from my home internet connection. So as I there is no any proxy involve here.

[root@localhost kevin]# curl http://google.com
curl: (6) Could not resolve host: google.com; Name or service not known

clean all and tried again but no lucky.

But if I use IP instead of the domain name, it works fine.

[root@localhost kevin]# curl http://173.194.46.0

any clue please?

Sathish's user avatar

Sathish

3,7001 gold badge16 silver badges28 bronze badges

asked Jul 26, 2014 at 5:26

Nayana Adassuriya's user avatar

Nayana AdassuriyaNayana Adassuriya

23k28 gold badges103 silver badges145 bronze badges

5

Issues were:

  1. IPV6 enabled
  2. Wrong DNS server

Here is how I fixed it:

IPV6 Disabling

  • Open Terminal
  • Type su and enter to log in as the super user
  • Enter the root password
  • Type cd /etc/modprobe.d/ to change directory to /etc/modprobe.d/
  • Type vi disableipv6.conf to create a new file there
  • Press Esc + i to insert data to file
  • Type install ipv6 /bin/true on the file to avoid loading IPV6 related modules
  • Type Esc + : and then wq for save and exit
  • Type reboot to restart fedora
  • After reboot open terminal and type lsmod | grep ipv6
  • If no result, it means you properly disabled IPV6

Add Google DNS server

  • Open Terminal
  • Type su and enter to log in as the super user
  • Enter the root password
  • Type cat /etc/resolv.conf to check what DNS server your Fedora using. Mostly this will be your Modem IP address.
  • Now we have to Find a powerful DNS server. Luckily there is a open DNS server maintain by Google.
  • Go to this page and find out what are the «Google Public DNS IP addresses»
  • Today those are 8.8.8.8 and 8.8.4.4. But in future those may change.
  • Type vi /etc/resolv.conf to edit the resolv.conf file
  • Press Esc + i for insert data to file
  • Comment all the things in the file by inserting # at the begin of the each line. Do not delete anything because can be useful in future.
  • Type below two lines in the file

    nameserver 8.8.8.8
    nameserver 8.8.4.4

    -Type Esc + : and then wq for save and exit

  • Now you are done and everything works fine (Not necessary to restart).
  • But every time when you restart the computer your /etc/resolv.conf will be replaced by default. So I’ll let you find a way to avoid that.

Here is my blog post about this:
http://codeketchup.blogspot.sg/2014/07/how-to-fix-curl-6-could-not-resolve.html

Jahan Zinedine's user avatar

answered Jul 28, 2014 at 1:29

Nayana Adassuriya's user avatar

Nayana AdassuriyaNayana Adassuriya

23k28 gold badges103 silver badges145 bronze badges

4

Perhaps you have some very weird and restrictive SELinux rules in place?

If not, try strace -o /tmp/wtf -fF curl -v google.com and try to spot from /tmp/wtf output file what’s going on.

answered Jul 26, 2014 at 11:12

Sathish's user avatar

5

I have today similar problem. But weirder.

  • host — works host pl.archive.ubuntu.com
  • dig — works on default and on all other DNS’s dig pl.archive.ubuntu.com, dig @127.0.1.1 pl.archive.ubuntu.com
  • curl — doesn’t work! but for some addresses it does. WEIRD! Same in Ruby, APT and many more.
$ curl -v http://google.com/
*   Trying 172.217.18.78...
* Connected to google.com (172.217.18.78) port 80 (#0)
> GET / HTTP/1.1
> Host: google.com
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 302 Found
< Cache-Control: private
< Content-Type: text/html; charset=UTF-8
< Referrer-Policy: no-referrer
< Location: http://www.google.pl/?gfe_rd=cr&ei=pt9UWfqXL4uBX_W5n8gB
< Content-Length: 256
< Date: Thu, 29 Jun 2017 11:08:22 GMT
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.pl/?gfe_rd=cr&ei=pt9UWfqXL4uBX_W5n8gB">here</A>.
</BODY></HTML>
* Connection #0 to host google.com left intact

$ curl -v http://pl.archive.ubuntu.com/
* Could not resolve host: pl.archive.ubuntu.com
* Closing connection 0
curl: (6) Could not resolve host: pl.archive.ubuntu.com

Revelation

Eventually I used strace on curl and found that it was connection to nscd deamon.

connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = 0

Solution

I’ve restarted the nscd service (Name Service Cache Daemon) and it helped to solve this issue!

systemctl restart nscd.service

answered Jun 29, 2017 at 11:29

Chris Suszyński's user avatar

3

There is no need to disable IPv6 as the answer suggests. The reason curl fails is simply because the DNS resolution is missing.

There is one liner solution to this.

If you care about what is inside /etc/resolv.conf then append it:

echo 'nameserver 1.1.1.1' | sudo tee -a /etc/resolv.conf >/dev/null

I usually don’t care and just replace the content of the file:

echo 'nameserver 1.1.1.1' | sudo tee /etc/resolv.conf >/dev/null

answered Oct 11, 2021 at 17:33

Houman's user avatar

HoumanHouman

63.2k86 gold badges266 silver badges455 bronze badges

0

Try nslookup google.com to determine if there’s a DNS issue.
192.168.1.254 is your local network address and it looks like your system is using it as a DNS server. Is this your gateway/modem router as well?
What happens when you try ping google.com. Can you browse to it on a Internet web browser?

answered Jul 26, 2014 at 13:25

Benjamin B's user avatar

2

In Our case, the command was passed through mail/skype and the person who needs to execute copied an extra space.

we found that extra space after an hour and removing that made it work.

answered Aug 6, 2022 at 3:20

nikhil2000's user avatar

nikhil2000nikhil2000

1493 silver badges13 bronze badges

I had an issue with IPV6 that suddenly showed up in wordpress admin where curl failed to connect to wordpress.org etc giving

An unexpected error occurred. Something may be wrong with WordPress.org

and also

Installation failed: Download failed. cURL error 28: Resolving timed out after 10005 milliseconds

I eventually sorted by adding the following as a php file in mu-plugins:

add_action( 'http_api_curl', function( $curl_handle ) { curl_setopt( $curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );});

and also when using curl directly in php by using the following option in the options array:

curl_setopt_array($curl, array(CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4));

The OS is IBM i (OS400/i5OS) v7.2 running on Power 6 and the php version is 8.1.10. Interestingly IPV6 is not active on the box.

answered Sep 17, 2022 at 11:37

jez001's user avatar

I have a fresh install of latest centos 7

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 
[root@localhost ~]# 

I wanted to install something and wget was not installed so when I tried to install wget I saw tha yum is giving error.

I saw maybe all the topics about this problem on the internet but no luck I cant find my solution.

[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.

 One of the configured repositories failed (CentOS-7 - Base),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=base ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable base
        or
            subscription-manager repos --disable=base

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
[root@localhost ~]# 

So when I list the repos I get this:

[root@localhost ~]# yum repolist all
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=centosplus&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/centosplus/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/updates/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.
repo id                                                                                         repo name                                                                                         status
C7.0.1406-base/x86_64                                                                           CentOS-7.0.1406 - Base                                                                            disabled
C7.0.1406-centosplus/x86_64                                                                     CentOS-7.0.1406 - CentOSPlus                                                                      disabled
C7.0.1406-extras/x86_64                                                                         CentOS-7.0.1406 - Extras                                                                          disabled
C7.0.1406-fasttrack/x86_64                                                                      CentOS-7.0.1406 - CentOSPlus                                                                      disabled
C7.0.1406-updates/x86_64                                                                        CentOS-7.0.1406 - Updates                                                                         disabled
C7.1.1503-base/x86_64                                                                           CentOS-7.1.1503 - Base                                                                            disabled
C7.1.1503-centosplus/x86_64                                                                     CentOS-7.1.1503 - CentOSPlus                                                                      disabled
C7.1.1503-extras/x86_64                                                                         CentOS-7.1.1503 - Extras                                                                          disabled
C7.1.1503-fasttrack/x86_64                                                                      CentOS-7.1.1503 - CentOSPlus                                                                      disabled
C7.1.1503-updates/x86_64                                                                        CentOS-7.1.1503 - Updates                                                                         disabled
C7.2.1511-base/x86_64                                                                           CentOS-7.2.1511 - Base                                                                            disabled
C7.2.1511-centosplus/x86_64                                                                     CentOS-7.2.1511 - CentOSPlus                                                                      disabled
C7.2.1511-extras/x86_64                                                                         CentOS-7.2.1511 - Extras                                                                          disabled
C7.2.1511-fasttrack/x86_64                                                                      CentOS-7.2.1511 - CentOSPlus                                                                      disabled
C7.2.1511-updates/x86_64                                                                        CentOS-7.2.1511 - Updates                                                                         disabled
C7.3.1611-base/x86_64                                                                           CentOS-7.3.1611 - Base                                                                            disabled
C7.3.1611-centosplus/x86_64                                                                     CentOS-7.3.1611 - CentOSPlus                                                                      disabled
C7.3.1611-extras/x86_64                                                                         CentOS-7.3.1611 - Extras                                                                          disabled
C7.3.1611-fasttrack/x86_64                                                                      CentOS-7.3.1611 - CentOSPlus                                                                      disabled
C7.3.1611-updates/x86_64                                                                        CentOS-7.3.1611 - Updates                                                                         disabled
base/7/x86_64                                                                                   CentOS-7 - Base                                                                                   enabled: 0
base-debuginfo/x86_64                                                                           CentOS-7 - Debuginfo                                                                              disabled
base-source/7                                                                                   CentOS-7 - Base Sources                                                                           disabled
c7-media                                                                                        CentOS-7 - Media                                                                                  disabled
centosplus/7/x86_64                                                                             CentOS-7 - Plus                                                                                   enabled: 0
centosplus-source/7                                                                             CentOS-7 - Plus Sources                                                                           disabled
cr/7/x86_64                                                                                     CentOS-7 - cr                                                                                     disabled
extras/7/x86_64                                                                                 CentOS-7 - Extras                                                                                 enabled: 0
extras-source/7                                                                                 CentOS-7 - Extras Sources                                                                         disabled
fasttrack/7/x86_64                                                                              CentOS-7 - fasttrack                                                                              disabled
updates/7/x86_64                                                                                CentOS-7 - Updates                                                                                enabled: 0
updates-source/7                                                                                CentOS-7 - Updates Sources                                                                        disabled
repolist: 0
[root@localhost ~]# 

Im not sure where can be the problem its a fresh install on my vmware/OVH dedicated server.

I have another server installed and working fine but this time I got this problem .

Any one can help me?I have also tried to enable all disabled lines in etc/yum.repo.d

my /etc/yum.repos.d/CentOS-Base.repo

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#1 2013-03-10 14:01:27

BlackSnowflake
Member
Registered: 2013-03-10
Posts: 6

could not resolve host (nil); Unknown error

Trying to install arch linux into virtualbox…
I got it to boot and everything, got my internet set up (I think), installed virtualbox guest stuff, and then had to reboot.
I try to do sudo pacman -S xorg-twm xorg-xclock xterm so that I can test X before installing a desktop enveiroment..
It then asks me for my password, the Y/N thing, etc.
And then I get a whole bunch of lines saying «error: failed retrieving file [filename] from [somewhere] : could not resolve host (nil); Unknown error»
And after that it says error: failed to commit transactions (download library error)

I follow this guide (http://wideaperture.net/blog/?p=3851), I am currently right above step 17.
Anyone knows what to do? I’m installing Arch Linux for the first time so I’m a total newbie.

#2 2013-03-10 15:12:20

John0000
Member
Registered: 2012-04-12
Posts: 40

Re: could not resolve host (nil); Unknown error

Hello,

BlackSnowflake wrote:

got my internet set up (I think)

Try

and check for replies.
Also, what is the output of

?

EDIT : quote from you link :
To set the the hostname, create the file ‘/etc/hostname’ in nano with the following command:

    # nano /etc/hostname

This will bring up a blank file in nano.  Type your hostname as the only line in the file.  Then quit to the command line in the usual way, saving your changes as you go.

Did you do this correclty ? Check with

Last edited by John0000 (2013-03-10 15:14:42)

#3 2013-03-10 15:16:29

BlackSnowflake
Member
Registered: 2013-03-10
Posts: 6

Re: could not resolve host (nil); Unknown error

ping google.com gives me «ping: unknown host google.com»
It’s kind of hard for me to give the output of ip addr because I can’t take a screenshot (for some reason my print screen key does nothing (even when virtualbox isn’t running) but that is an issue for another time) and I can’t copy it…

#4 2013-03-10 15:27:44

BlackSnowflake
Member
Registered: 2013-03-10
Posts: 6

Re: could not resolve host (nil); Unknown error

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisk noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scop host
valid_lft forever preffered_lft forever
2: enp0s3: <BROADCAST,MULTICAST> mtu 1500 qdisk noop state DOWN qlen 1000
link/ether 08:00:27:9d:1a:5b brd ff:ff:ff:ff:ff:ff

Done. I had to look at the thing, memorise a bit, and then type it here, but this is the output of ip addr

Last edited by BlackSnowflake (2013-03-10 15:28:01)

#5 2013-03-10 15:27:49

John0000
Member
Registered: 2012-04-12
Posts: 40

Re: could not resolve host (nil); Unknown error

Alright so this is apparently network related.
I’m not expert but first I would make sure you have an hostname set up :

Then try to (re)start dhcpcd :

And check again with

.
Look at the logs also

You can make screeshot in virtualbox with ‘Host+E’ , ‘Host’ being the right ‘Ctrl’ key is you didn’t change it.

#6 2013-03-10 15:31:12

BlackSnowflake
Member
Registered: 2013-03-10
Posts: 6

Re: could not resolve host (nil); Unknown error

Checked for the hostname, had that setup.
Did sudo systemctl restart dhcpcd (it gave me an acces denied error without sudo) and retried, same thing.
journalctl told me «Showing user generated messages only. Users in the group «adm» can see all messages. pass -q to turn this notice off»
EDIT: host + E did nothing. I tried pasting my clipboard in GIMP (because that’s how screenshots work with windows, even though I use linux mint ATM) and nothing happened, suggesting there is no image copied.

Last edited by BlackSnowflake (2013-03-10 15:32:52)

#7 2013-03-10 15:39:00

John0000
Member
Registered: 2012-04-12
Posts: 40

Re: could not resolve host (nil); Unknown error

Type journalctl with sudo, then push the end key to go at the last messages.

The guide you followed said :

sudo systemctl enable dhcpcd@eth0.service

But with rescent archlinux changes, as you said with the result of ‘ip addr’, the base name of ethernet device has changed to enp0s3, maybe that’s why you don’t have the network. First disable the previous command :

sudo systemctl disable dhcpcd@eth0.service

Then enable with the right name

sudo systemctl enable dhcpcd@enp0s3.service

Either way, paste here the logs of journalctl (just type if you see some errors) after doing a

sudo systemctl restart dhcpcd

We never know, but have you checked your ethernet cable is plugged in?

For the screenshots, when I’m in virtualbox and do left ctrl+e, a window pop up to save the .png…

#8 2013-03-10 15:40:01

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,013

Re: could not resolve host (nil); Unknown error

BlackSnowflake wrote:


2: enp0s3: <BROADCAST,MULTICAST> mtu 1500 qdisk noop state DOWN qlen 1000
link/ether 08:00:27:9d:1a:5b brd ff:ff:ff:ff:ff:ff

The network is down.

# ip link set enp0s3  up
# dhcpcd enp0s3

Should get you going.  If so, then we will work through how to get it to start automatically.

One other thing.  How is your virtual machine’s network configured?  Bridged, NAT, or Host Only?

Last edited by ewaller (2013-03-10 15:40:42)


Nothing is too wonderful to be true, if it be consistent with the laws of nature — Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. — Alan Turing

How to Ask Questions the Smart Way

#9 2013-03-10 15:49:24

BlackSnowflake
Member
Registered: 2013-03-10
Posts: 6

Re: could not resolve host (nil); Unknown error

I tried all that, still the same problem when trying to do «ping google.com»
Will post the errors of journalctl that are at the end
0s3: sendmsg: Cannot assign requested adress is the only red thing I’m getting
EDIT: restarted the VM, everything is fixed now! THANKS!

Last edited by BlackSnowflake (2013-03-10 15:51:00)

#10 2013-03-10 15:58:42

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,013

Re: could not resolve host (nil); Unknown error

Do you have it starting automatically, or do you want to work on that?


Nothing is too wonderful to be true, if it be consistent with the laws of nature — Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. — Alan Turing

How to Ask Questions the Smart Way

#11 2013-03-10 16:08:17

BlackSnowflake
Member
Registered: 2013-03-10
Posts: 6

Re: could not resolve host (nil); Unknown error

Well I suppose that I have it starting automaticly if it works when I completely restart the VM. I will be back here if that’s for some reason not the case.
Currently installing Gnome desktop, otherwise I would check.
EDIT: Everything works now, succesfully installed Gnome desktop, then removed it, then installed xfce, and internet is working.
I’m probably gonna try move it out of virtualbox later, but that’s an issue for another time.

Last edited by BlackSnowflake (2013-03-10 17:11:52)

I have installed Centos 7 in Vmware WorkStation. I tried to install few new packages using yum install. However, I was getting error “Could not resolve host: mirrorlist.centos.org Centos 7″

[root@localhost ~]# yum install dos2unix
Loaded plugins: fastestmirror
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.

 One of the configured repositories failed (CentOS-7 - Base),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=base ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable base
        or
            subscription-manager repos --disable=base

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"

Possible Reason for the issue and Resolution.

1. Ethernet Interface is disabled.

Check ethernet status, if its disconnected then you need to enable it.

Steps to enable ethernet in your CentOS machine.

Step 1. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 file and change ONBOOT value from no to “yes”

vi /etc/sysconfig/network-scripts/ifcfg-eth0

ONBOOT=yes

Step 2: Restart Network Service

/etc/init.d/network restart

Step 3: validate

Try “yum update” command now. If it worked then your problem is solved now.

2. There might be issue due to missing nameserver in /etc/resolv.conf . Check nameserver entry in /etc/resolv.conf . If its blank then defined nameserver

vi /etc/resolv.conf

nameserver 9.9.9.9

(Visited 12,806 times, 684 visits today)

About Roopendra

A DevOps Engineer, adventure trekker, having experience in various DevOps tools and technologies including Jenkins, TeamCity, Elasticsearch Logstash Kibana(ELK), Ansible and scripting languages. I am familiar working with open source technologies like Cassandra, queuing system RabbitMQ, Image Moderation using Opencv. My earlier experience includes Web Development in PHP, MySQL along with PHP cms and framework; UI technologies HTML5, CSS3, JQUERY, BOOTSTRAP and Responsive Design.

Hypervisor: Virtual Box
Hypervisor Version: 5.2.22r126460 (Qt5.6.2)
Centos installation: CentOS-7-x86_64-Minimal-1810
Centos version: CentOS Linux release 7.6.1810 (core)

Code: Select all

[root@centos ~]# hostnamectl
   Static hostname: centos.localhost
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 205a932fb8c744ccb46f07f2f344c15e
           Boot ID: 87713adb17774f558897935c00619583
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-957.el7.x86_64
      Architecture: x86-64

VIDEO WALKTRHOUGH OF PROBLEM:
https://www.youtube.com/watch?v=iwz4vfA … e=youtu.be

Problem:
Unable to update yum package manager with working DNS?

Code: Select all

[root@centos ~]# yum -v update
Loading "fastestmirror" plugin
Config time: 0.011
Yum version: 3.4.3
rpmdb time: 0.000
Updating Everything
Building updates object
Setting up Package Sacks
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7.6.1810releasever&arch=x86_64basearch&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"
Trying other mirror.


 One of the configured repositories failed (CentOS-7 - Base),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=base ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable base
        or
            subscription-manager repos --disable=base

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirror.centos.org/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirror.centos.org; Unknown error"

ping works?

Code: Select all

[root@centos ~]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=53.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=119 time=49.0 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=119 time=47.7 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=119 time=47.0 ms
64 bytes from 8.8.8.8: icmp_seq=5 ttl=119 time=44.9 ms
64 bytes from 8.8.8.8: icmp_seq=6 ttl=119 time=40.1 ms
^C
--- 8.8.8.8 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5173ms
rtt min/avg/max/mdev = 40.146/47.004/53.126/3.945 ms

Code: Select all

[root@centos ~]# ping google.com
PING google.com (172.217.21.142) 56(84) bytes of data.
64 bytes from arn11s02-in-f14.1e100.net (172.217.21.142): icmp_seq=1 ttl=52 time=44.3 ms
64 bytes from arn11s02-in-f14.1e100.net (172.217.21.142): icmp_seq=2 ttl=52 time=42.3 ms
64 bytes from arn11s02-in-f14.1e100.net (172.217.21.142): icmp_seq=3 ttl=52 time=35.0 ms
64 bytes from arn11s02-in-f14.1e100.net (172.217.21.142): icmp_seq=4 ttl=52 time=53.4 ms
^C
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 35.056/43.808/53.488/6.576 ms

System has DNS?

Code: Select all

cat /etc/resolv.conf
# Generated by NetworkManager
search localhost
nameserver 8.8.8.8

ip info, set statically with nmtui:

Code: Select all

root@centos ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:73:5f:30 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global noprefixroute enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe73:5f30/64 scope link
       valid_lft forever preferred_lft forever

repolist:

Code: Select all


# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7


any ideas??

— log —
201904192318: Added repolist to post

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Could not execute query error role does not exist
  • Dclxvi error mp3
  • Corrigo regin ошибки
  • Coretelephony trace file error что значит
  • Davinci resolve the gpu failed to perform image processing because of an error

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии