How does facter get ipaddress?

829 views
Skip to first unread message

Bret Wortman

unread,
Nov 29, 2012, 3:16:54 PM11/29/12
to puppet...@googlegroups.com
I think the problem I'm having with not being able to run puppet for up to 90 minutes after a reboot is related to this error, which goes away some time in that time period:

# puppet agent -t
Info: Retrieving plugin
Timed out seeking value for ipaddress
Timed out seeking value for ipaddress

What exactly is facter doing that doesn't work immediately after the boot, but does start working at some point after? Is there a package that isn't getting installed except as a dependency somewhere once things start creeping forward?


Peter Bukowinski

unread,
Nov 29, 2012, 3:29:51 PM11/29/12
to puppet...@googlegroups.com
That depends on your operating system. Perusing https://github.com/puppetlabs/facter/blob/master/lib/facter/ipaddress.rb will show you exactly what it's doing. If you're using a *nix variant, facter uses ifconfig. If windows, it uses the socket library.

--
Peter

Bret Wortman

unread,
Nov 30, 2012, 6:59:42 AM11/30/12
to puppet...@googlegroups.com
Aha! The problem is that "ifconfig" doesn't return anything containing "inet addr:" in Fedora 17. The output looks like this:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.13  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::d6be:d9ff:fe92:1df5  prefixlen 64  scopeid 0x20<link>
        inet6 2001:470:1d:429:d6be:d9ff:fe92:1df5  prefixlen 64  scopeid 0x0<global>
        ether d4:be:d9:92:1d:f5  txqueuelen 1000  (Ethernet)
        RX packets 15939189  bytes 11636881674 (10.8 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14236195  bytes 2245276793 (2.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  

So it falls through to "host `hostname`", which isn't available because I need Puppet to configure freeipa-client for me, which it struggles to do. So I guess I have to hardcode the DNS server into my kickstart and then let puppet take care of the resolv.conf after that.

What about F17 sites that don't use DNS and instead rely on host tables? This will fail completely, won't it?

--
Peter

Ashley Penney

unread,
Nov 30, 2012, 7:19:28 AM11/30/12
to puppet-users

On Fri, Nov 30, 2012 at 6:59 AM, Bret Wortman <br...@thewortmans.org> wrote:
Aha! The problem is that "ifconfig" doesn't return anything containing "inet addr:" in Fedora 17. The output looks like this:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.13  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::d6be:d9ff:fe92:1df5  prefixlen 64  scopeid 0x20<link>
        inet6 2001:470:1d:429:d6be:d9ff:fe92:1df5  prefixlen 64  scopeid 0x0<global>
        ether d4:be:d9:92:1d:f5  txqueuelen 1000  (Ethernet)
        RX packets 15939189  bytes 11636881674 (10.8 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14236195  bytes 2245276793 (2.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  

So it falls through to "host `hostname`", which isn't available because I need Puppet to configure freeipa-client for me, which it struggles to do. So I guess I have to hardcode the DNS server into my kickstart and then let puppet take care of the resolv.conf after that.

I have no idea if it cleanly merges but if you're feeling brave you could grab https://github.com/puppetlabs/facter/pull/267 and see if that magically does the right thing for F17.  It uses /sbin/ip in preference to ifconfig, so it should work a lot better.  I couldn't get it merged so it's just sat and gotten a little stale but hopefully does 99% of what you need still if you can merge it for testing. 

Bret Wortman

unread,
Nov 30, 2012, 7:23:59 AM11/30/12
to puppet...@googlegroups.com
Awesome! I'll give it a try and report back. Happy to help test.

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To post to this group, send email to puppet...@googlegroups.com.
To unsubscribe from this group, send email to puppet-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Ashley Penney

unread,
Dec 30, 2012, 6:51:34 PM12/30/12
to puppet-users
On Sun, Dec 30, 2012 at 12:08 PM, Mandla Mbuli <lm.m...@gmail.com> wrote:

Hi

I am running a version 'facterversion => 2.0.0-rc4' do you know if this uses /sbin/ip?
does it adapt for ArchLinux which uses puts it in /usr/sbin/ip (judgin from `which ip`)
`facter ipaddress` and `facter fqdn` don't work for me. I don't know how to troubleshoot.
I just started really reading/playing about puppet today.

I also tried the latest version available from rubygems and it still can't find the ipadress
or fqdn.

What could be the possible problems?

The pull request hasn't been merged so I believe it still only uses ifconfig.  You'll have to either find a way to install that on arch or try and manually merge the pull request in I'm afraid!

Mandla Mbuli

unread,
Dec 31, 2012, 4:55:49 AM12/31/12
to puppet...@googlegroups.com

Im considering just continue working on the tutorial, hopefully this gets sorted by the time I need it.
I tried merging (https://github.com/Elwell/facter.git ifconfig_refactor into a clone
https://github.com/puppetlabs/facter.git master and fixed the merge conflict. I then tried
installing and this need ruby knowledge and I have 0 ruby knowledge.

Quick guess I did 'gem build facter.gemspec' then 'gem install facter-1.6.11.gem' then tried
'facter ipaddress' and I get an error:

/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- facter/application (LoadError)
        from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /usr/bin/facter:69:in `<main>'

Should I just wait for the pull to be merged into the puppet branch?

Jared Curtis

unread,
Dec 31, 2012, 7:28:58 PM12/31/12
to puppet...@googlegroups.com
Facter 1.6.17 has a fix for the ip address issue for distros that use newer versions of net-tools.

Mandla Mbuli

unread,
Jan 2, 2013, 5:08:46 PM1/2/13
to puppet...@googlegroups.com
I found ruby-facter-1.6.17 on AUR and `facter ipaddress` still does not work. 
(I have NO ruby experience)
I looked at the facter.rb file and it seems to import the util/ip file and I think
those use the /sbin/ip

What could be the problem?
Reply all
Reply to author
Forward
0 new messages