5

I have install CentOS 7 on hyper-v successfully, but when I try to update using yum update or try to install using the yum command I have the below error:

Loaded plugins: fastestmirror, langpacks Could not retrieve mirrorlist
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock
error was 12: Timeout on
http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock:
(28, 'Resolving timed out after 30425 milliseconds')


One of the configured repositories failed (Unknown),  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. Disable the repository, 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 <repoid>

      4. 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=<repoid>.skip_if_unavailable=true

 Cannot find a valid baseurl for repo: base/7/x86_64`
6

(28, 'Resolving timed out after 30425 milliseconds')

That means your VM probably lacks a working DNS server. Resolving here refers to resolving a domain name to an IP address.

Try pinging google.com or mirrorlist.centos.org to see if you have any DNS functionality. The currently used DNS servers are listed in /etc/resolv.conf like so:

nameserver 8.8.8.8
nameserver 8.8.4.4

If the /etc/resolv.conf file is empty, try first pinging the IP addresses above (Google's public DNS) and then add them to the /etc/resolv.conf file as above to start using Google DNS. To make this a permanent fix you may want to use the CentOS 7 network config tool to set up DNS servers properly. Here's a decent article on how to do it: http://www.krizna.com/centos/setup-network-centos-7/

  • the /etc/resolve.conf already using 8.8.8.8 adn 8.8.4.4 . the internet access working fine and i can ping to mirrorlist.centos.org. It is not the network access problem – fadabi Nawi Sep 19 '15 at 11:11
  • Please try running curl 'http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock' and see if you get a list of URLs. According to yum, this is the equivalent of the command it's trying to run and that command is timing out. This is why I'd like to test whether or not your DNS configuration can resolve mirrorlist.centos.org to its IPs, and later connect to that site to get the list of repos. – Rouben Sep 21 '15 at 6:47
  • curl 'mirrorlist.centos.org/…' curl: (6) Could not resolve host: mirrorlist.centos.org; Unknown error [root@ayope network-scripts]# curl mirrorlist.centos.org curl: (6) Could not resolve host: mirrorlist.centos.org; Unknown error – fadabi Nawi Sep 21 '15 at 7:07
  • Hmm... DNS is failing. How about host mirrorlist.centos.org? – Rouben Sep 21 '15 at 7:09
  • ping mirrorlist.centos.orgPING mirrorlist.centos.org (108.61.16.227) 56(84) bytes of data. 64 bytes from 108-61-16-227.constant.com (108.61.16.227): icmp_seq=1 ttl=56 time=264 ms 64 bytes from 108-61-16-227.constant.com (108.61.16.227): icmp_seq=2 ttl=56 time=266 ms – fadabi Nawi Sep 21 '15 at 7:09
0

Its the ipv6 problem. Disable the ipv6 from runnig.

lsmod | grep -i ipv6
sysctl --all
nslookup google.com
systemctl stop NetworkManager
systemctl disable NetworkManager
cd /etc/default

change line to : GRUB_CMDLINE_LINUX="ipv6.disable=1 rd.lvm.lv=centos/swap vconsole.font=latarcyrh

grub2-mkconfig -o /boot/grub2/grub.cfg
vi grub
ip addr

note : add disable commang on grub

0

Use ip route to see to which IP default route is going, if nothing get visible, then you need to get fresh IP which can be done by

sudo dhclient

This must resolve issue. Try yum update now.

0

Locate the "/etc/sysconfig/network-scripts/ifcfg-enp0s17" file. **File name may vary based on env. 1.Locate lines: BOOTPROTO=none ONBOOT=no

  1. change to BOOTPROTO=dhcp ONBOOT=yes save + exit

  2. run "systemctl restart network"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.