Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning after upgrading to v3.1.0 #79

Closed
vchepkov opened this issue Feb 5, 2022 · 20 comments · Fixed by #81
Closed

Warning after upgrading to v3.1.0 #79

vchepkov opened this issue Feb 5, 2022 · 20 comments · Fixed by #81

Comments

@vchepkov
Copy link

vchepkov commented Feb 5, 2022

After upgrading to v3.1.0, puppet started issuing warning each run

Warning: Facter: Operation not permitted @ io_fread - /sys/module/kdb_main/parameters/enable_nmi
Warning: Facter: Permission denied @ rb_sysopen - /sys/module/md_mod/parameters/new_array
Warning: Facter: Permission denied @ rb_sysopen - /sys/module/ipmi_si/parameters/hotmod

Puppet 6.25.1
Checked on CentOS 7, RHEL 8 and Fedora 35

@vchepkov
Copy link
Author

vchepkov commented Feb 7, 2022

@jcpunk , @bastelfreak , v3.1.1 reduced warning count, but didn't eliminate them

Observe this on RHEL8

Warning: Facter: Operation not permitted @ io_fread - /sys/module/kdb/parameters/enable_nmi

This on CentOS 7

Warning: Facter: Operation not permitted @ io_fread - /sys/module/kdb_main/parameters/enable_nmi

@smoeding
Copy link

smoeding commented Feb 7, 2022

I can confirm this issue. It happens because the file looks readable when in fact it isn't:

# ls -l /sys/module/kdb/parameters/enable_nmi
-rw-------. 1 root root 4096 Feb 7 14:09 /sys/module/kdb/parameters/enable_nmi

# cat /sys/module/kdb/parameters/enable_nmi
cat: /sys/module/kdb/parameters/enable_nmi: Operation not permitted

@kenyon
Copy link
Member

kenyon commented Feb 7, 2022

We tried to fix this in #78, but I didn't test the final update. :( Edit: Turns out that I wouldn't have seen the kdb warning on the systems I was testing on anyway. I do see it on Ubuntu 18.04 VMs with v3.1.1 though.

@tenajsystems
Copy link

I can confirm this issue as well on Ubuntu 20.04 after moving to 3.1.1. Any thoughts on when a fix will be available for this issue?

@jcpunk
Copy link
Contributor

jcpunk commented Mar 1, 2022

Does the patch from #81 fix this for you?

@vchepkov
Copy link
Author

vchepkov commented Mar 1, 2022

May I suggest to make this fact possible to blacklist?

 facter --list-block-groups
AZ
  - az_metadata
EC2
  - ec2_metadata
  - ec2_userdata
file system
  - mountpoints
  - filesystems
  - partitions
hypervisors
  - hypervisors

@hggh
Copy link

hggh commented Mar 15, 2022

@vchepkov you can block any fact by its name:
File: /etc/puppetlabs/facter/facter.conf

facts : {
  blocklist: [
 "kmods",

  ]
}

@vchepkov
Copy link
Author

That doesn't help, unfortunately,

# cat /etc/puppetlabs/facter/facter.conf 
facts : {
  blocklist: [
    "kmods",
  ]
}
# puppet agent -t --environment kmod 
Info: Using environment 'kmod'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Notice: /File[/opt/puppetlabs/puppet/cache/lib/facter/kmod.rb]/ensure: defined content as '{md5}f8de287fe030a71616b4e0d9fb4238a0'
Info: Retrieving locales
Info: Loading facts
Warning: Facter: Operation not permitted @ io_fread - /sys/module/kdb_main/parameters/enable_nmi

I was under impression only limited set of facts can be blocklisted:

# facter --list-block-groups
AZ
  - az_metadata
EC2
  - ec2_metadata
  - ec2_userdata
file system
  - mountpoints
  - filesystems
  - partitions
hypervisors
  - hypervisors

@hggh
Copy link

hggh commented Mar 15, 2022

Version 7.x is able to block facts by name, perhaps your Puppet/Facter version is too old.

@vchepkov
Copy link
Author

It's actually 'current' with PE LTS, which is 6.26.0

@tenajsystems
Copy link

Does the patch from #81 fix this for you?

How would I test the referenced patch? I am not sure which release branch you branched off to create that patch.

@jcpunk
Copy link
Contributor

jcpunk commented Mar 15, 2022

That patch should be based off of 3.1.1. You can manually perform the changes listed on your environment to test it, copy the whole file out of my fork, or apply the diff directly to your tree. The process varies a bit depending on how you're managing your environments.

I'll confess I'm hopeful it will be merged soon. @bastelfreak is there anything else you need on that PR?

@aclarkee
Copy link

aclarkee commented Mar 28, 2022

Worth noting that #81 doesn't fix this, just hides the error.

imo the fact should still be adjusted to cater to this. Maybe a blacklist of parameters exposed via hiera? Just hiding the errors is pointless.. If this module is attempting to read kernel parameters that aren't designed to be read, then it shouldn't be doing that.

@vchepkov
Copy link
Author

I agree, this fact is intrusive and should be refactored using lsmod command

@arnonerba
Copy link

It would be really great to have this fixed. It's been a constant annoyance on our RHEL 8 and Ubuntu 20.04 machines.

@bastelfreak
Copy link
Member

@arnonerba can you provide a PR with a proper fix?

@arnonerba
Copy link

Here is my suggestion: #88

@smoeding
Copy link

As far as I understand the internals a blacklist would have to be implemented in the ruby code of the facter code.
I'm afraid nobody is willing to keep up with updating this module and providing new releases when just another exception is found.

@bastelfreak
Copy link
Member

I don't think we need to work with a filter list. Can you please test #81 ? That works at least in my environment.

@arnonerba
Copy link

I like this new version of #81 much better and can confirm it gets rid of the error on RHEL 8 and Ubuntu 20.04. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants