Is there any reason for a successful yum update to cause a subsequent wget to fail?

好久不见. 提交于 2019-12-25 06:05:29

问题


I'm working on a bash setup script for CentOS 6.4 machines. On a brand new install I'm running into an issue that seems to be reproducible, but the scenario is unusual.

The setup script is run with root. The first step is to run yum update with no options:

yum update

This completes successfully with a zero exit code. The next step is to retrieve the EPEL rpm using wget:

wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

However, this is consistently failing when resolving the host name every time this is run from a clean CentOS install:

wget: unable to resolve host address “dl.fedoraproject.org”

When executing these commands in succession from the command line however, no issues are encountered and wget is able to retrieve the EPEL rpm:

sudo yum update
sudo wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

Is there anything that happens during the yum update that could cause the DNS lookup to fail without exiting the script first? If I rerun the script after the first failure, it passes on the second time around.


回答1:


It's possible when the Time to Live of the domain name expires on the system or on a cache DNS server before the next instance of wget and the next attempt to resolve the domain name from the authorative server fails. See http://en.wikipedia.org/wiki/Time_to_live#DNS_records. Of course it's also possible that the cache DNS server becomes inaccessible.



来源:https://stackoverflow.com/questions/25320088/is-there-any-reason-for-a-successful-yum-update-to-cause-a-subsequent-wget-to-fa

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!