Puppet/Facter “Could not retrieve fact fqdn”: How to fix or circumvent?

依然范特西╮ 提交于 2019-11-29 21:15:38

Since puppet uses the fqdn fact to determine which node it is running as, it may not be possible to run if it can't be determined. Given what you're describing, the simplest thing to debug is facter fqdn instead of your puppet command-line.

If the "several seconds" is very close to exactly 5 seconds, it's very likely that your DNS configuration is broken with a single bad DNS server listed. What's in /etc/resolv.conf? What happens if you run dig -x $HOSTIP $DNSSERVERIP with the first nameserver listed in resolv.conf?

If you look in facter/fqdn.rb you can see what exactly facter is trying to do to resolve the fqdn. In the version I have most handy it's using facter/hostname.rb and facter/domainname.rb which call code from facter/util/resolution.rb.

Exactly what happens will depend on what version of facter you have, what OS, and possibly also what exactly you have installed. Calling /bin/hostname, uname (etc) and doing DNS lookups are all quite likely. You can always use strace -t facter fqdn to see what is taking the time (look for the gap in timestamps)

From everything you've described, it does sound like the problem is that puppet/facter really wants to have a domain name and you don't have one, you just have a naked hostname.

Adding domain example.com to /etc/resolv.conf should do the trick. Running hostname foo.example.com should also do the trick (but will need to be re-applied). Permanent solutions depend on the exact OS setup.

I got the same error when running puppet on my home machine (Xubuntu). What worked for me was changing the second line of file /etc/hosts. The first two lines before the change:

127.0.0.1   localhost
127.0.1.1   box

And after the change:

127.0.0.1   localhost
127.0.1.1   box.example.com box

Now, the command hostname -f returns box.example.com instead of box, and puppet is happy.

Adding

  config.vm.hostname = "vagrant.example.com"

to my Vagrantfile fixed it for me.

FQDN stands for "fully qualified domain name". In a Windows domain (or other similar LDAP-based domain), for example, it would be the name of your network domain, such as "organization.internal" - the domain that your computers and servers are joined to, and the domain which contains your network groups and user accounts.

So, it probably had trouble getting the fqdn for some authentication needed to perform the rest of the configuration steps, would be my guess.

http://en.wikipedia.org/wiki/Fully_qualified_domain_name

It's possible that you'll get a better answer on ServerFault, since system/configuration management also crosses over into their realm.

append this line into /etc/resolv.conf

domain abc.com

run facter fqdn again

Fqdn requires domain name , which maybe missing in your freshly installed ubu12

Another possible way to circumvent is to override the fact.

http://www.puppetcookbook.com/posts/override-a-facter-fact.html

FACTER_fqdn=box.example.com facter

On Windows this would be

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