Jira (FACT-2928) Error: Facter: statvfs() function failed: No such file or directory

35 views
Skip to first unread message

Peter Meier (Jira)

unread,
Jan 28, 2021, 4:45:03 AM1/28/21
to puppe...@googlegroups.com
Peter Meier created an issue
 
Facter / Bug FACT-2928
Error: Facter: statvfs() function failed: No such file or directory
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2021/01/28 1:44 AM
Priority: Normal Normal
Reporter: Peter Meier
  1. puppet --version
    7.3.0

on CentOS 7 with up2date system.

When running puppet or gathering facts, I had the following error:

# puppet facts show
[...]
Debug: Facter: Executing command: which blkid
Error: Facter: statvfs() function failed: No such file or directory
Debug: Facter: Executing command: /bin/cat /proc/uptime
[...]

After poking around in the vendored ruby, I figured out this error is raised in `/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/sys-filesystem-1.3.2/lib/sys/unix/sys/filesystem.rb` on line 205.

After instrumenting the code with:

      if statvfs(path, fs) < 0
puts path
puts fs.inspect
puts caller
        raise Error, 'statvfs() function failed: ' + strerror(FFI.errno)
      end

I got the following:

# puppet facts show
[...]
/var/named/chroot/etc/localtime (deleted)
#<Sys::Filesystem::Structs::Statvfs:0x00000000030e92e8>
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/util/resolvers/filesystem_helper.rb:20:in `read_mountpoint_stats'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/mountpoints.rb:70:in `get_mount_sizes'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/mountpoints.rb:54:in `block in read_mounts'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/mountpoints.rb:48:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/mountpoints.rb:48:in `read_mounts'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/mountpoints.rb:16:in `block in post_resolve'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/mountpoints.rb:16:in `fetch'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/mountpoints.rb:16:in `post_resolve'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/base_resolver.rb:26:in `block in resolve'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/base_resolver.rb:24:in `synchronize'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/base_resolver.rb:24:in `resolve'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/facts/linux/partitions.rb:14:in `partitions'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/facts/linux/partitions.rb:9:in `call_the_resolver'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/core_fact.rb:16:in `block in create'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/benchmarking/timer.rb:18:in `measure'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/core_fact.rb:15:in `create'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:47:in `block in resolve_sequentially'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:44:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:44:in `resolve_sequentially'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact/internal/internal_fact_manager.rb:12:in `resolve_facts'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/core/fact_manager.rb:24:in `resolve_facts'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:385:in `values'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/framework/cli/cli.rb:126:in `arg_parser'
/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:116:in `invoke'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter.rb:43:in `resolve'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/facts/facter.rb:107:in `find_with_options'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/facts/facter.rb:37:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/indirector/indirection.rb:223:in `find'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/face/facts.rb:148:in `block (3 levels) in <top (required)>'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/interface/action.rb+eval[wrapper]:261:in `show'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application/face_base.rb:254:in `main'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:437:in `run_command'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `block in run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util.rb:735:in `exit_on_fail'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/application.rb:421:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:143:in `run'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/command_line.rb:77:in `execute'
/opt/puppetlabs/puppet/bin/puppet:5:in `<main>'
Error: Facter: statvfs() function failed: No such file or directory

So I looked at my mounts:

# mount
[...]
/dev/mapper/vg-root on /var/named/chroot/etc/localtime type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/named.root.key type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/named.conf type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/named.rfc1912.zones type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/rndc.key type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/named.iscdlv.key type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/protocols type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/services type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/etc/named type ext4 (rw,relatime,seclabel,data=ordered)
/dev/mapper/vg-root on /var/named/chroot/usr/lib64/bind type ext4 (rw,relatime,seclabel,data=ordered)
tmpfs on /var/named/chroot/run/named type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
/dev/mapper/vg-root on /var/named/chroot/var/named type ext4 (rw,relatime,seclabel,data=ordered)

Ok, this seems to be the chroot from named, what about the file:

# ls -l /var/named/chroot/etc/localtime
-rw-r--r--. 0 root root 1892 Nov  4 22:14 /var/named/chroot/etc/localtime

Looks like the file got replaced and thus deleted.

Restarting named-chroot, re-setup the chroot AND the file has a size again:

# ls -l /var/named/chroot/etc/localtime
-rw-r--r--. 3 root root 1892 Jan 26 22:55 /var/named/chroot/etc/localtime

And now also the error is gone.

So there seem to have been an update that deleted the file in the chroot and thus the service needed to be restarted.

However facter just tries to blindly get file stats from even deleted files. So maybe this should be checked before passing it down to the filesystem lib. At least it does not seem very descriptive if the error appears.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Mihai Buzgau (Jira)

unread,
Mar 2, 2021, 7:33:56 PM3/2/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Mar 2, 2021, 7:33:56 PM3/2/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Mar 2, 2021, 7:33:56 PM3/2/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Apr 13, 2021, 9:55:02 AM4/13/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: Triaged tickets NW-2021-04-28
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Apr 14, 2021, 5:53:02 AM4/14/21
to puppe...@googlegroups.com

Ciprian Badescu (Jira)

unread,
Apr 14, 2021, 6:01:04 AM4/14/21
to puppe...@googlegroups.com

Dorin Pleava (Jira)

unread,
Apr 23, 2021, 7:54:04 AM4/23/21
to puppe...@googlegroups.com

Mihai Buzgau (Jira)

unread,
Apr 28, 2021, 5:51:04 AM4/28/21
to puppe...@googlegroups.com
Mihai Buzgau updated an issue
Change By: Mihai Buzgau
Sprint: NW-2021-04-28 , NW-2021-05-19

Dorin Pleava (Jira)

unread,
May 11, 2021, 4:50:04 AM5/11/21
to puppe...@googlegroups.com
Dorin Pleava updated an issue
Change By: Dorin Pleava
Release Notes: Bug Fix
Release Notes Summary: When a mountpoint file cannot be read, or is missing, it will throw
an error, but will not specify what mountpoint/file has failed.
Now, the error will show what file is caused the error.

Gabriel Nagy (Jira)

unread,
May 19, 2021, 7:57:01 AM5/19/21
to puppe...@googlegroups.com

Gabriel Nagy (Jira)

unread,
May 19, 2021, 8:00:04 AM5/19/21
to puppe...@googlegroups.com
Gabriel Nagy updated an issue
Change By: Gabriel Nagy
Release Notes Summary: When a mountpoint file cannot be read, or is missing, it will Facter would throw
an error,
but will not specify without specifying what mountpoint/file has failed.
Now, the The error will show what file is caused the now silent, allowing Facter to continue resolving facts. The detailed error is still shown when running Facter with debug logging enabled .

Claire Cadman (Jira)

unread,
May 20, 2021, 8:27:02 AM5/20/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages