voxpupuli / puppet-selinux

Puppet Module to manage SELinux on RHEL machines
https://forge.puppet.com/puppet/selinux
Apache License 2.0
48 stars 147 forks source link

Error: Could not prefetch selinux_fcontext provider 'semanage': uninitialized constant Selinux #367

Open sohooo opened 1 year ago

sohooo commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

This seems to be a problem with Puppet Agent, not this module. Related:

What are you seeing

Error: Could not prefetch selinux_fcontext provider 'semanage': uninitialized constant Selinux

rhel8 7.25 working :heavy_check_mark:

% /opt/puppetlabs/puppet/bin/irb
irb(main):001:0> require "puppet"
=> true
irb(main):002:0> require "selinux"
=> true
irb(main):003:0> Puppet.version
=> "7.25.0"
irb(main):004:0> Puppet.features.selinux?
=> true
irb(main):005:0>  File.read "/etc/redhat-release"
=> "Red Hat Enterprise Linux release 8.7 (Ootpa)\n"
irb(main):006:0>

rhel9 7.24 working :heavy_check_mark:

% /opt/puppetlabs/puppet/bin/irb
irb(main):001:0> require "puppet"
=> true
irb(main):002:0> require "selinux"
=> true
irb(main):003:0> Puppet.version
=> "7.24.0"
irb(main):004:0> Puppet.features.selinux?
=> true
irb(main):005:0> File.read "/etc/redhat-release"
=> "Red Hat Enterprise Linux release 9.1 (Plow)\n"

rhel9 7.25 fail :x:

% /opt/puppetlabs/puppet/bin/irb
irb(main):001:0> require "puppet"
=> true
irb(main):002:0> require "selinux"
Traceback (most recent call last):
        6: from /opt/puppetlabs/puppet/bin/irb:23:in `<main>'
        5: from /opt/puppetlabs/puppet/bin/irb:23:in `load'
        4: from /opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        3: from (irb):2
        2: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
        1: from /opt/puppetlabs/puppet/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:83:in `require'
LoadError (/lib64/libselinux.so.1: version `LIBSELINUX_3.5' not found (required by /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/selinux.so)
- /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/2.7.0/x86_64-linux/selinux.so)
irb(main):003:0> Puppet.version
=> "7.25.0"
irb(main):004:0> Puppet.features.selinux?
=> false
irb(main):005:0> File.read "/etc/redhat-release"
=> "Red Hat Enterprise Linux release 9.1 (Plow)\n"
sohooo commented 1 year ago

Registered to also post issue @ ticket.puppetlabs.com: https://tickets.puppetlabs.com/browse/PA-5632 :)

cmd-ntrf commented 1 year ago

I experienced the same issue with Rocky Linux release 9.1. The fix was to upgrade libselinux i.e: sudo yum upgrade libselinux.

Puppet expects version libselinux 3.5 and RHEL9 originally shipped with libselinux 3.4 hence the error message LIBSELINUX_3.5' not found.

ekohl commented 1 year ago

Sounds like missing/incorrect requirement in the Puppet RPM.