Re: [Puppet Users] Having trouble with facter - "invalid argument"

444 views
Skip to first unread message

Stefan Schulte

unread,
May 6, 2013, 6:30:10 PM5/6/13
to puppet...@googlegroups.com
On Mon, 6 May 2013 10:26:38 -0700 (PDT)
Charlie Brune <goo...@bruneworld.com> wrote:

> I'm trying to install Puppet on a Fedora 17 box.
>
> The "puppet agent --test" command fails with this error message:
>
> Could not retrieve virtual: Invalid argument -
> > /sys/firmware/dmi/entries/1-0/raw
> >
>
> I get the same error message if I type the command "facter virtual".

can you please provide the output of

facter -v

(this should return the version you are using) and

facter --debug --trace virtual

When running the last command, you'll hopefully see a strack trace
so we can see where the error actually happens.

-Stefan

Charlie Brune

unread,
May 7, 2013, 1:01:03 PM5/7/13
to puppet...@googlegroups.com
I did discover that Puppet appears to be running just fine.  I think the problem may be isolated to facter and puppet appears to forgive the problem.  8-)

Here's the output you requested.  (I don't see a trace.)

[root@hogwarts log]# facter -v
1.7.0
[root@hogwarts log]# facter --debug --trace virtual

Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
value for lsbdistid is still nil
physical
[root@hogwarts log]#



Stefan Schulte

unread,
May 7, 2013, 3:29:01 PM5/7/13
to puppet...@googlegroups.com
Ok can you then please run `facter --debug --timing virtual`. This
should give you something like

% facter --debug --timing virtual
kernel: 2.94ms
virtual: 0.06ms
virtual: 0.44ms
lsbdistid: 20.66ms
operatingsystem: 22.72ms
hardwaremodel: 2.37ms
architecture: 30.14ms
virtual: 57.26ms
physical

So the `--timing` option has the neat benefit that we see what other
facts facter has to resolve to get to the `virtual` fact. If you
could provide the values for these facts as well I should be able to
follow the actual code path and see where facter may have problems.

-Stefan

Charlie Brune

unread,
May 7, 2013, 4:00:53 PM5/7/13
to puppet...@googlegroups.com
[root@hogwarts ~]# facter --debug --timing virtual
kernel: 2.97ms

Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
virtual: 50.26ms
lsbdistid: 0.53ms

value for lsbdistid is still nil
operatingsystem: 2.00ms
hardwaremodel: 3.36ms
architecture: 10.61ms
virtual: 34.97ms
physical


Charlie

Stefan Schulte

unread,
May 7, 2013, 5:14:25 PM5/7/13
to puppet...@googlegroups.com
Still not sure what is going on here. I guess the "Invalid argument"
is the output of an external command that is failing. So if you
could make the following modification in `util/resolution.rb` (the
exact path may be different on your machine, on mine it
is
`/usr/lib/ruby/gems/1.9.1/gems/facter-1.7.0/lib/facter/util/resolution.rb`)

goto line 171 and change


begin
out = %x{#{code}}.chomp
[...]

to

begin
Facter.debug "about to execute #{code}"
out = %x{#{code}}.chomp
[...]

if you now run `facter --debug virtual` you should see the exact
external commands facter is executing. This migh be helpful when
finding the root cause of your problem here.

-Stefan

Angel Angelov

unread,
May 8, 2013, 4:50:46 AM5/8/13
to puppet...@googlegroups.com
I just want to provide some more information on this one. Recently it started to show the following output when doing puppet runs:
puppet agent --test
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
notice: Ignoring --listen on onetime run
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/libvirt_uuid.rb
Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
connect: No such file or directory
Please make sure that the zfs-fuse daemon is running.
internal error: failed to initialize ZFS library
connect: No such file or directory
Please make sure that the zfs-fuse daemon is running.
internal error: failed to initialize ZFS library
/usr/share/ruby/vendor_ruby/puppet/provider/service/bsd.rb:12: warning: class variable access from toplevel
/usr/share/ruby/vendor_ruby/puppet/provider/service/freebsd.rb:8: warning: class variable access from toplevel
/usr/share/ruby/vendor_ruby/puppet/provider/service/freebsd.rb:9: warning: class variable access from toplevel
/usr/share/ruby/vendor_ruby/puppet/provider/service/freebsd.rb:10: warning: class variable access from toplevel
info: Caching catalog for host26.lvs.cloudsigma.com
info: Applying configuration version '1368002053'
notice: Finished catalog run in 3.09 seconds

The strange thing is that I am installing fedora with kickstart using foreman and puppet and no ZFS. The repo has been "frozen" awhile ago and there aren't new packages there.

Here's the version output if needed.
On the agent:
puppet --version
/usr/share/rubygems/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
2.7.20
facter --version
1.7.0

On the master:
puppet --version
2.7.20
puppetmasterd --version
2.7.20
facter -v
1.7.0

Thanks for any help.

- Angel


On Wednesday, May 8, 2013 11:35:00 AM UTC+3, Angel Angelov wrote:
Hi all,

I am seeing the same error recently and here's the output after the last modification:

facter --debug --trace virtual
about to execute /bin/uname -s
Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
about to execute /sbin/virt-what 2>/dev/null
value for lsbdistid is still nil
about to execute /bin/uname -m
about to execute /sbin/lspci 2>/dev/null
physical

facter --debug --timing virtual
about to execute /bin/uname -s
kernel: 2.50ms
Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
about to execute /sbin/virt-what 2>/dev/null
virtual: 32.02ms
lsbdistid: 0.23ms
value for lsbdistid is still nil
operatingsystem: 0.85ms
about to execute /bin/uname -m
hardwaremodel: 2.33ms
architecture: 5.50ms
about to execute /sbin/lspci 2>/dev/null
virtual: 25.62ms
physical

Hopefully this helps 'cause I can't figure it out.

Thank you for your help.

jcbollinger

unread,
May 8, 2013, 9:49:32 AM5/8/13
to puppet...@googlegroups.com


This appears related to new code in Facter 1.7.0 that is intended to detect whether the node is running the Google compute engine, Facter issue #17612 (http://projects.puppetlabs.com/issues/17612).  You should be able to work around it by reverting to the Facter 1.6.x series.  Meanwhile, I encourage you to file a ticket.

Examining the code doesn't reveal any obvious error.  Facter uses this:

  def self.read_sysfs_dmi_entries(path="/sys/firmware/dmi/entries/1-0/raw")
    if File.exists?(path)
      File.read(path)
    end
  end

That /sys/firmware/... path does not appear anywhere else in Facter that I (and Google) can find. That suggest that either the exists? test or the read must be causing the error to be emitted in your environment, but it's not clear which, or why.  Does it happen when you run Facter with privilege (e.g. via sudo), with SELinux in permissive mode or disabled?  The error message doesn't appear to indicate a permission problem, but perhaps it's misleading.


John

Charlie Brune

unread,
May 8, 2013, 11:15:48 AM5/8/13
to puppet...@googlegroups.com
I also did the modification that Stefan requested and my output is the same as yours:

[root@hogwarts ~]# facter --debug virtual

about to execute /bin/uname -s
Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
about to execute /sbin/virt-what 2>/dev/null
value for lsbdistid is still nil
about to execute /bin/uname -m
about to execute /sbin/lspci 2>/dev/null
physical


Regards,
Charlie

Charlie Brune

unread,
May 8, 2013, 11:20:06 AM5/8/13
to puppet...@googlegroups.com
Sorry... I forgot to answer John's questions (above).

Facter produces the same error messages running under sudo.  Also, I have SELinux turned off.

[root@hogwarts ~]# facter virtual

Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
physical
[root@hogwarts ~]# sudo facter virtual

Could not retrieve virtual: Invalid argument - /sys/firmware/dmi/entries/1-0/raw
physical
[root@hogwarts ~]# grep ^SELINUX /etc/selinux/config
SELINUX=disabled
SELINUXTYPE=targeted


Charlie

Angel Angelov

unread,
May 8, 2013, 11:44:36 AM5/8/13
to puppet...@googlegroups.com
SELinux is disabled and the commands were ran as root.

Downgrading the facter to 1.6.18 version seems fixing the problem.

Thank you very much for the support guys.

Best Regards,
Angel Angelov



Charlie

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/Gs0d0Z4LjgI/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To post to this group, send email to puppet...@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--

Kind Regards,
Angel Angelov

CLOUDSIGMA AG

"Do you support Greener Cloud Computing?
Greenbyte.ch & CloudSigma appreciate your vote at http://cld.sg/ZoTIGx"

====================
This email is from CLOUDSIGMA AG. The contents of this email and any attachments are confidential to the intended recipient. They may not be disclosed to or used by or copied in any way by anyone other than the intended recipient. If this email is received in error, please contact CLOUDSIGMA AG on +41 (0)44 585 39 07 quoting the name of the sender and the email address to which it has been sent and then delete it. Please note that neither CLOUDSIGMA AG nor the sender accepts any responsibility for viruses and it is your responsibility to scan or otherwise check this email and any attachments. CLOUDSIGMA AG is a public limited company registered in Canton Zürich, Switzerland (registered number CH-020.3.034.422-0) with registered offices at Sägereistrasse 29, 8152 Glattbrugg, Switzerland. For further information, please refer to www.cloudsigma.com .
Create a cloud server in 2 minutes: http://cld.sg/CldSg
====================

Stefan Schulte

unread,
May 9, 2013, 4:23:33 PM5/9/13
to puppet...@googlegroups.com
On Wed, 8 May 2013 06:49:32 -0700 (PDT)
jcbollinger <John.Bo...@stJude.org> wrote:
> Examining the code doesn't reveal any obvious error. Facter uses
> this:
>
> def
> self.read_sysfs_dmi_entries(path="/sys/firmware/dmi/entries/1-0/raw")
> if File.exists?(path) File.read(path)
> end
> end
>
> That /sys/firmware/... path does not appear anywhere else in Facter
> that I (and Google) can find. That suggest that either the exists?
> test or the read must be causing the error to be emitted in your
> environment, but it's not clear which, or why.

So I guess the best would be to collect the following output

% ruby --version
% ls -l /sys/firmware/dmi/entries/1-0/raw
% stat /sys/firmware/dmi/entries/1-0/raw
% ruby -e 'puts :ok if File.exists?("/sys/firmware/dmi/entries/1-0/raw")'
% ruby -e 'puts :ok if File.read("/sys/firmware/dmi/entries/1-0/raw")'

-Stefan

Charlie Brune

unread,
May 9, 2013, 5:14:13 PM5/9/13
to puppet...@googlegroups.com
Here's the output for the commands you requested.  Thanks again for looking into it.


+ ruby --version
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
+ ls -l /sys/firmware/dmi/entries/1-0/raw
-r-------- 1 root root 0 May  6 10:39 /sys/firmware/dmi/entries/1-0/raw
+ stat /sys/firmware/dmi/entries/1-0/raw
  File: `/sys/firmware/dmi/entries/1-0/raw'
  Size: 0             Blocks: 0          IO Block: 4096   regular empty file
Device: eh/14d    Inode: 10901       Links: 1
Access: (0400/-r--------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-05-06 10:39:29.650499164 -0500
Modify: 2013-05-06 10:39:29.650499164 -0500
Change: 2013-05-06 10:39:29.650499164 -0500
 Birth: -
+ ruby -e 'puts :ok if File.exists?("/sys/firmware/dmi/entries/1-0/raw")'
ok
+ ruby -e 'puts :ok if File.read("/sys/firmware/dmi/entries/1-0/raw")'
-e:1:in `read': Invalid argument - /sys/firmware/dmi/entries/1-0/raw (Errno::EINVAL)
    from -e:1:in `<main>'


Reply all
Reply to author
Forward
0 new messages