Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 611018 - =dev-ruby/facter-3.6.2 - /usr/lib64/ruby/site_ruby/$(ruby_version)/facter.rb has invalid require
Summary: =dev-ruby/facter-3.6.2 - /usr/lib64/ruby/site_ruby/$(ruby_version)/facter.rb ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Matthew Thode ( prometheanfire )
URL:
Whiteboard:
Keywords:
: 613680 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-02-26 18:16 UTC by gentoobugzilla
Modified: 2017-04-19 16:07 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info app-admin/puppet (emergeinfo.txt,6.10 KB, text/plain)
2017-02-26 18:16 UTC, gentoobugzilla
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gentoobugzilla 2017-02-26 18:16:18 UTC
Created attachment 465318 [details]
emerge --info app-admin/puppet

After installing app-admin/puppet-4.9.1 and trying to execute `puppet -V` I get the following error: 

libfacter was not found. Please make sure it was installed to the expected location.

Interesingly the command works correctly after I do `sudo -i` and execute it as root (`sudo puppet -V` and `sudo su` and then `puppet -V` results in error).
A hack that I've found to work is to do:

sudo mkdir /usr/lib64/lib64/
sudo ln -s /usr/lib64/libfacter.so /usr/lib64/lib64/

Result of `emerge --info app-admin/puppet` is attached to this report. I'll be happy to give any information that might be of help, but I'm not sure exactly what to look for.
Comment 1 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-03-04 20:04:44 UTC
That is definitely an odd hack to have to do, what are the permissions of facter? perhaps it's not finding it because of that.
Comment 2 gentoobugzilla 2017-03-04 20:12:13 UTC
The permissions are as follows:

ls -lah /usr/lib64/ | grep libfacter
lrwxrwxrwx  1 root root    18 Feb 26 01:27 libfacter.so -> libfacter.so.3.5.1
-rwxr-xr-x  1 root root  3.4M Feb 26 01:27 libfacter.so.3.5.1
Comment 3 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-03-04 20:15:36 UTC
Ok, so that doesn't look to be it.  So maybe an ldd on the puppet binary?  Not seeing anything in the ebuild that'd cause this on the puppet side.
Comment 4 gentoobugzilla 2017-03-04 20:24:18 UTC
Do you mean /usr/bin/puppet? It's a ruby script, so:

ldd /usr/bin/puppet 
        not a dynamic executable
Comment 5 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-03-04 20:41:28 UTC
ya, not that, there should be a file puppet installs that trys to link against it.

qlist app-admin/puppet | grep libfacter

that might find it
Comment 6 gentoobugzilla 2017-03-04 20:45:25 UTC
The output of the command you provided is empty. I think it loads the .so dynamically by some ruby's FFI voodoo.
Comment 7 Marek Szuba archtester gentoo-dev 2017-03-06 10:24:59 UTC
I've just run into the same problem and it seems to be caused by a bug in dev-ruby/facter-3.1.8: following the setting of facter_dir in line 30 of /usr/lib/ruby/site_ruby/<ver>/facter.rb , line 36 of same attempts to load /usr/lib64/lib64/libfacter.so. Needs one more level of ../ .
Comment 8 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-03-09 19:25:03 UTC
That's odd, facter is installed correctly here (tested 3.6.2)

image/usr
image/usr/lib64
image/usr/lib64/libfacter.so
image/usr/lib64/ruby
image/usr/lib64/ruby/site_ruby
image/usr/lib64/ruby/site_ruby/2.1.0
image/usr/lib64/ruby/site_ruby/2.1.0/facter.rb
image/usr/lib64/libfacter.so.3.6.2
Comment 9 Alan Hodgson 2017-03-23 20:14:28 UTC
I'm getting this with puppet 4.9.1-r1 and facter 3.6.2.

I confirm that adding an extra ../ to line 30 of /usr/lib64/ruby/site_ruby/2.1.0/facter.rb fixes it.

This appears to be a facter bug, it happens just from loading facter.rb from irb, too.
Comment 10 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-03-24 04:23:48 UTC
Ya, see the problem now

    begin
      facter_dir = ENV['FACTERDIR'] || File.join(File.expand_path("#{File.dirname(__FILE__)}"), '../../../')
      #
      # This is a cmake pre-processor check. On *nix it will end up '' == '1'
      # On windows, where we want the changes it will be '1' == '1'
      #
      # Facter requires the extra inclusion of puppet/bin as the libfacter.so
      # lib requires libraries and executables from that directory
      if '' == '1'
        ENV['PATH'] = "#{File.join(facter_dir, 'bin')}#{File::PATH_SEPARATOR}#{File.join(facter_dir, '../puppet/bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
      end
      require "#{facter_dir}/lib64/libfacter.so"

The directory is fine, as that's /usr/lib64 (on my system).  the facter_dir variable is also used in the PATH section.  So it probably shouldn't change.  The problem actually seems to come from the actual require hardcoding whatever the libdir ends up being.

sed -i 's/\${LIBFACTER_INSTALL_DESTINATION}\///g' lib/facter.rb.in || die
in src_prepare seems to fix it  will be fixed in r1
Comment 11 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-04-08 18:10:27 UTC
*** Bug 613680 has been marked as a duplicate of this bug. ***
Comment 12 Fabian Groffen gentoo-dev 2017-04-18 20:14:14 UTC
After a rebuild due to new gcc, this broke for me (again).

What I don't understand is that /etc/env.d/00facterdir defines:

FACTERDIR=/usr

and that makes

facter_dir = ENV['FACTERDIR'] || File.join(File.expand_path("#{File.dirname(__FILE__)}"), '../../../')

resolve to /usr

and in my copy of the code, the next thing is

      require "#{facter_dir}/libfacter.so"

obviously /usr/libfacter.so doesn't exist.
Comment 13 Matthew Thode ( prometheanfire ) archtester Gentoo Infrastructure gentoo-dev Security 2017-04-19 16:07:10 UTC
fixed in 3.6.3-r1

some unneeded libdir things should be fixed now too