The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #18205

Ruby libraries are broken under osx mountain lion

Added by Ben Ford over 3 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:3.4.0
Affected Puppet version:2.7.20 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

See https://ask.puppetlabs.com/question/67/unable-to-run-puppet-on-osx-mountain-lion/

Puppet opensource cannot require libraries because the rubylib has apparently changed. Any puppet scripts exit with: /usr/bin/puppet:3:inrequire': no such file to load — puppet/util/command_line (LoadError) from /usr/bin/puppet:3`

As a hacky workaround, I made symlinks, like

sudo ln -s /usr/lib/ruby/site_ruby/1.8/puppet /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/site_ruby/1.8/puppet
sudo ln -s /usr/lib/ruby/site_ruby/1.8/puppet.rb /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/site_ruby/1.8/puppet.rb
sudo ln -s /usr/lib/ruby/site_ruby/1.8/semver.rb /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/site_ruby/1.8/semver.rb

History

#1 Updated by Ben Ford over 3 years ago

I should point out that this is with the official puppetlabs package

#2 Updated by Gary Larizza over 3 years ago

I wasn’t able to reproduce this by installing Puppet version 2.7.20 or 3.0.2 and Facter 1.6.16 using the Puppet provided packages at http://downloads.puppetlabs.com/mac/ on 10.8.2 using my Macbook Pro.

Note that this symlink should ALREADY exist:

$ ls -la /usr/lib/ruby
lrwxr-xr-x  1 root  wheel  76 Oct 14 10:35 /usr/lib/ruby -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby

$ls -la /usr/lib/ruby/site_ruby 
lrwxr-xr-x  1 root  wheel  47 Oct 14 10:35 /usr/lib/ruby/site_ruby -> ../../../../../../../../../../Library/Ruby/Site

$ls -la /usr/lib/ruby/site_ruby/1.8 
total 32
drwxr-xr-x   8 root  wheel   272 Dec 26 19:12 .
drwxr-xr-x   3 root  wheel   102 Oct 14 10:35 ..
drwxr-xr-x  58 root  wheel  1972 Nov 30 16:41 facter
-rw-r--r--   1 root  wheel  5398 Nov 30 16:41 facter.rb
drwxr-xr-x  68 root  wheel  2312 Nov 19 16:41 puppet
-rw-r--r--   1 root  wheel  2831 Nov 19 16:41 puppet.rb
-rw-r--r--   1 root  wheel  3929 Nov 19 16:41 semver.rb
drwxr-xr-x   2 root  wheel    68 Jun 20  2012 universal-darwin12.0

I’m suspecting the symlinks were blown away somehow. Were you able to reproduce this on another machine?

#3 Updated by Ben Ford over 3 years ago

I haven’t tried. This was on my mbp, OSX 10.8.2 and the POSS 2.7.20 installer from our site. Others have had the problems though, as evidenced by the question posted on ask.

On Wed, Dec 26, 2012 at 7:16 PM, tickets@puppetlabs.com wrote:

Issue #18205 has been updated by Gary Larizza.

I wasn’t able to reproduce this by installing Puppet version 2.7.20 or 3.0.2 and Facter 1.6.16 using the Puppet provided packages at http://downloads.puppetlabs.com/mac/ on 10.8.2 using my Macbook Pro.

Note that this symlink should ALREADY exist:

$ ls -la /usr/lib/ruby lrwxr-xr-x 1 root wheel 76 Oct 14 10:35 /usr/lib/ruby –> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby

$ls -la /usr/lib/ruby/site_ruby lrwxr-xr-x 1 root wheel 47 Oct 14 10:35 /usr/lib/ruby/site_ruby –> ../../../../../../../../../../Library/Ruby/Site

$ls -la /usr/lib/ruby/site_ruby/1.8 total 32 drwxr-xr-x 8 root wheel 272 Dec 26 19:12 . drwxr-xr-x 3 root wheel 102 Oct 14 10:35 .. drwxr-xr-x 58 root wheel 1972 Nov 30 16:41 facter -rw-r—r— 1 root wheel 5398 Nov 30 16:41 facter.rb drwxr-xr-x 68 root wheel 2312 Nov 19 16:41 puppet -rw-r—r— 1 root wheel 2831 Nov 19 16:41 puppet.rb -rw-r—r— 1 root wheel 3929 Nov 19 16:41 semver.rb drwxr-xr-x 2 root wheel 68 Jun 20 2012 universal-darwin12.0

I’m suspecting the symlinks were blown away somehow. Were you able to

reproduce this on another machine?

Bug #18205: Ruby libraries are broken under osx mountain lionhttps://projects.puppetlabs.com/issues/18205#change-79478

  • Author: Ben Ford
  • Status: Unreviewed
  • Priority: Normal
  • Assignee:
  • Category:
  • Target version:
  • Affected Puppet version: 2.7.20
  • Keywords:
  • Branch:

See https://ask.puppetlabs.com/question/67/unable-to-run-puppet-on-osx-mountain-lion/

Puppet opensource cannot require libraries because the rubylib has apparently changed. Any puppet scripts exit with: /usr/bin/puppet:3:inrequire': no such file to load — puppet/util/command_line (LoadError) from /usr/bin/puppet:3`

As a hacky workaround, I made symlinks, like

sudo ln -s /usr/lib/ruby/site_ruby/1.8/puppet /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/site_ruby/1.8/puppet sudo ln -s /usr/lib/ruby/site_ruby/1.8/puppet.rb /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/site_ruby/1.8/puppet.rb sudo ln -s /usr/lib/ruby/site_ruby/1.8/semver.rb /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/site_ruby/1.8/semver.rb


You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account

#4 Updated by eric sorenson about 3 years ago

  • Status changed from Unreviewed to Closed

Can’t repro at will; original user got their problem solved. I think gary identified the root of the problem, we just don’t understand how the system got into that state.

#5 Updated by Jesse Endahl about 3 years ago

Unfortunately I’m still unclear on why it’s happening, but I wanted to say that I’ve run into this as well, only on certain machines. OS version and machine model don’t seem to matter. Not sure what the common thread is yet. My workaround (until I have more time to figure out what’s causing it) was to add this hacky goodness to my puppet boostrapping preinstall script:

thetime=`date +%Y-%m-%d--%H%M%S`
rubydir="/usr/lib/ruby"

echo "Making sure the ruby dir is symlinked correctly..."

if [ -L "${rubydir}" ]; then
  echo "Ruby dir is symlinked correctly"
    else
        if [[ -d "${rubydir}" && ! -L "${rubydir}" ]] ; then
            echo "It's a directory. Ruby dir is not symlinked. Backing up existing directory and creating symlink to /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby"
            mv /usr/lib/ruby /usr/lib/ruby-${thetime}
            ln -s /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/ruby /usr/lib/ruby
        fi
fi

#6 Updated by Jesse Endahl almost 3 years ago

  • Status changed from Closed to Re-opened

So I did more research on this, and found this thread from 2010 where Gary and Nigel, among others, discussed this very issue. Here’s the thread:

https://groups.google.com/forum/?fromgroups=#!topic/instadmg-dev/gJqaiQ9duJk

Here’s the smoking gun post from a user named larkost: https://groups.google.com/d/msg/instadmg-dev/gJqaiQ9duJk/Y8Ruikq3rggJ

He explains that this is actually due to an Apple bug regarding symlinks, which he filed as Radar 7758836. I also found an Open Radar for it here: http://openradar.appspot.com/9202152. The bug, as he explains it:

We have all been chasing around the symlinks, and it turns out one of them is wrong, so this is a bug on Apple’s part. The problem child is:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/site_ruby

(note: the 1.8 is usually done as “Current”, but this symlink resolves to “1.8” in the same directory on 10.6)

This resolves to:

../../../../../../../../../../Library/Ruby/Site

If you count the back-references you will get 10, but there are only 9 levels in the absolute path. When you are booted the extra level gets swallowed as a non-fatal (and non warning) error (try: “cd /; cd..”). However, if the filesystem is mounted anywhere other than root (as it is in InstaDMG) this will cause a problem since you can ../ one more directory out, but then there is no /Library/Ruby/Site in that outer folder.

So this is all a bug on Apple’s part in the symlinks, and it looks like it has been a problem since 10.5 (I just checked . I am going to report it right now. But the Puppet package is probably going to have to work around this for now by not trying to have the package follow the torturous list of softlinks, but install stuff straight to /Library/Ruby/Site.

larkost explains that the workaround that Puppet could do is to install straight to /Library/Ruby/Site instead of trying to follow the symlinks.

To which Nigel said:

Well done Karl. I really should have thought of actually counting the damn levels :)

This brings me back to having to produce different packages for 10.4 and 10.5+ though :(

What do you all think of the option of fixing the symlink in a preinstall if on 10.5/6 ?

And that’s where the thread died.

#7 Updated by Gary Larizza almost 3 years ago

I remember this issue, it was terribly annoying. It was all because of the broken symlink paths initial OS install that were somehow repaired by OS X on First-boot. The problem is that if you take a machine in a previously-unbooted-state and try to install something on it to that path, you’ll have issues. Incidentally, this symlink remains broken before first-boot all the way to 10.8 (so maybe someone can test out 10.9 for us?).

Anyways, the problem was that the alternative path doesn’t exist in 10.4 and possibly (though memory fails) 10.5. With the release of 10.9, I presume we will only ‘support’ back to 10.7, so we should probably change our packaging to target the recommended path instead of /usr/lib/ruby/…

#8 Updated by Moses Mendoza over 2 years ago

  • Status changed from Re-opened to Merged - Pending Release
  • Target version set to 3.4.0

The master branches of puppet, facter, and hiera should now target /Library/Ruby/Site. We currently drop their library files in /usr/lib/ruby/site_ruby/1.8 on OSX, which is a symlink to /Library/Ruby/Site/1.8. As some have discovered, the varying state of the symlinks seems to break puppet occasionally. Also, on 10.9, 1.8 will not be in the load path, because it will be ruby 2.0.0. The fix that has been merged is to just install into /Library/Ruby/Site (the equivalent of /usr/lib/ruby/site_ruby). This is in the load path of the standard ruby on every OS from 10.6 (and I think 10.5?) on up. Since puppet, facter and hiera will work on all rubies shipped with supported versions of OSX, this will “just work”.

The related PRs are:
for preflight:
https://github.com/puppetlabs/packaging/pull/174
https://github.com/puppetlabs/puppet/pull/1830
https://github.com/puppetlabs/facter/pull/512
https://github.com/puppetlabs/hiera/pull/144

for new install target:
https://github.com/puppetlabs/hiera/pull/148
https://github.com/puppetlabs/facter/pull/527
https://github.com/puppetlabs/puppet/pull/1856

These have all been merged into master branches, which means the next releases off of master from the projects should include these changes.

#9 Updated by Melissa Stone over 2 years ago

  • Status changed from Merged - Pending Release to Closed

Released in Puppet 3.4.0-rc1

#10 Updated by Melissa Stone over 2 years ago

Released in Puppet 3.4.0-rc1

#11 Updated by Melissa Stone over 2 years ago

Released in Puppet 3.4.0-rc1

#12 Updated by Melissa Stone over 2 years ago

Released in Puppet 3.4.0-rc1

#13 Updated by Melissa Stone over 2 years ago

Released in Puppet 3.4.0-rc1

#14 Updated by Melissa Stone over 2 years ago

Released in Puppet 3.4.0-rc1

Also available in: Atom PDF