Ohai bombs out on start in fresh (VM) install


#1

ohai

/usr/lib/ruby/1.8/ohai/system.rb:120:in join': can't convert nil into String (TypeError) from /usr/lib/ruby/1.8/ohai/system.rb:120:inall_plugins’
from /usr/lib/ruby/1.8/ohai/system.rb:117:in each' from /usr/lib/ruby/1.8/ohai/system.rb:117:inall_plugins’
from /usr/lib/ruby/1.8/ohai/application.rb:89:in run_application' from /usr/lib/ruby/1.8/ohai/application.rb:67:inrun’
from /usr/bin/ohai:40

The nil in question is @data[:os]. I don’t know why it’s nil because I
can’t find where it gets set (invisible class initialisation for the
win!). Presumably it should be ‘linux’.

I am using the ohai in plain ol’ squeeze.

Matthew


I must take issue with the term “a mere child”, for it has been my
invariable experience that the company of a mere child is infinitely
preferable to that of a mere adult.
– Fran Lebowitz


#2

hrm, odd. The data gets set in lib/plugins/os.rb

Can you file a ticket at tickets.opscode.com, and include the output
of ohai -l debug?

Meanwhile, we’ll check it out on squeeze.

Thanks!

Sent from my iPhone

On Mar 20, 2010, at 6:10 AM, Matthew King matthew.king@monnsta.net
wrote:

ohai

/usr/lib/ruby/1.8/ohai/system.rb:120:in join': can't convert nil into String (TypeError) from /usr/lib/ruby/1.8/ohai/system.rb:120:inall_plugins’
from /usr/lib/ruby/1.8/ohai/system.rb:117:in each' from /usr/lib/ruby/1.8/ohai/system.rb:117:inall_plugins’
from /usr/lib/ruby/1.8/ohai/application.rb:89:in run_application' from /usr/lib/ruby/1.8/ohai/application.rb:67:inrun’
from /usr/bin/ohai:40

The nil in question is @data[:os]. I don’t know why it’s nil because I
can’t find where it gets set (invisible class initialisation for the
win!). Presumably it should be ‘linux’.

I am using the ohai in plain ol’ squeeze.

Matthew


I must take issue with the term “a mere child”, for it has been my
invariable experience that the company of a mere child is infinitely
preferable to that of a mere adult.
– Fran Lebowitz


#3

Adam Jacob adam@opscode.com writes:

hrm, odd. The data gets set in lib/plugins/os.rb

Can you file a ticket at tickets.opscode.com, and include the output of
ohai -l debug?

Meanwhile, we’ll check it out on squeeze.

I’ve found the problem. It’s much (embarrassingly) less than I thought
but still a bug. A small dependency bug - ruby1.8 was pulled in through
the chain of packages but ruby itself wasn’t, so the ruby -> ruby1.8
link didn’t get created and

ruby -e “require ‘rbconfig’; puts “host_os:#{::Config::CONFIG[‘host_os’]},target_cpu:#{::Config::CONFIG[‘target_cpu’]},host_vendor:#{::Config::CONFIG[‘host_vendor’]},target_vendor:#{::Config::CONFIG[‘target_vendor’]},target:#{::Config::CONFIG[‘target’]},bin_dir:#{::Config::CONFIG[‘bindir’]},target_os:#{::Config::CONFIG[‘target_os’]},ruby_bin:#{::File.join(::Config::CONFIG[‘bindir’], ::Config::CONFIG[‘ruby_install_name’])},host:#{::Config::CONFIG[‘host’]},platform:#{RUBY_PLATFORM},host_cpu:#{::Config::CONFIG[‘host_cpu’]},version:#{RUBY_VERSION},release_date:#{RUBY_RELEASE_DATE},””

ran successfully … on another VM with a similar name, so I didn’t
catch it.

Looked through the debug output (again) and noted the auspicious, but
well hidden:

[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG: sh: ruby: not found

So to fix it:

  • Add ruby to the Debian package dependencies.

  • Not run ruby from within ruby, except I assume there’s a good reason
    for it doing this that I don’t know about.

  • Make debugging output easier to read:

[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG: ---- Begin ruby -e “require ‘rbconfig’; puts “host_vendor:#{::Config::CONFIG[‘host_vendor’]},release_date:#{RUBY_RELEASE_DATE},bin_dir:#{::Config::CONFIG[‘bindir’]},platform:#{RUBY_PLATFORM},target_cpu:#{::Config::CONFIG[‘target_cpu’]},ruby_bin:#{::File.join(::Config::CONFIG[‘bindir’], ::Config::CONFIG[‘ruby_install_name’])},host_os:#{::Config::CONFIG[‘host_os’]},target:#{::Config::CONFIG[‘target’]},target_vendor:#{::Config::CONFIG[‘target_vendor’]},host:#{::Config::CONFIG[‘host’]},version:#{RUBY_VERSION},target_os:#{::Config::CONFIG[‘target_os’]},host_cpu:#{::Config::CONFIG[‘host_cpu’]},”” STDOUT ----
[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG:
[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG: ---- End ruby -e “require ‘rbconfig’; puts “host_vendor:#{::Config::CONFIG[‘host_vendor’]},release_date:#{RUBY_RELEASE_DATE},bin_dir:#{::Config::CONFIG[‘bindir’]},platform:#{RUBY_PLATFORM},target_cpu:#{::Config::CONFIG[‘target_cpu’]},ruby_bin:#{::File.join(::Config::CONFIG[‘bindir’], ::Config::CONFIG[‘ruby_install_name’])},host_os:#{::Config::CONFIG[‘host_os’]},target:#{::Config::CONFIG[‘target’]},target_vendor:#{::Config::CONFIG[‘target_vendor’]},host:#{::Config::CONFIG[‘host’]},version:#{RUBY_VERSION},target_os:#{::Config::CONFIG[‘target_os’]},host_cpu:#{::Config::CONFIG[‘host_cpu’]},”” STDOUT ----
[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG: ---- Begin ruby -e “require ‘rbconfig’; puts “host_vendor:#{::Config::CONFIG[‘host_vendor’]},release_date:#{RUBY_RELEASE_DATE},bin_dir:#{::Config::CONFIG[‘bindir’]},platform:#{RUBY_PLATFORM},target_cpu:#{::Config::CONFIG[‘target_cpu’]},ruby_bin:#{::File.join(::Config::CONFIG[‘bindir’], ::Config::CONFIG[‘ruby_install_name’])},host_os:#{::Config::CONFIG[‘host_os’]},target:#{::Config::CONFIG[‘target’]},target_vendor:#{::Config::CONFIG[‘target_vendor’]},host:#{::Config::CONFIG[‘host’]},version:#{RUBY_VERSION},target_os:#{::Config::CONFIG[‘target_os’]},host_cpu:#{::Config::CONFIG[‘host_cpu’]},”” STDERR ----
[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG: sh: ruby: not found
[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG: ---- End ruby -e “require ‘rbconfig’; puts “host_vendor:#{::Config::CONFIG[‘host_vendor’]},release_date:#{RUBY_RELEASE_DATE},bin_dir:#{::Config::CONFIG[‘bindir’]},platform:#{RUBY_PLATFORM},target_cpu:#{::Config::CONFIG[‘target_cpu’]},ruby_bin:#{::File.join(::Config::CONFIG[‘bindir’], ::Config::CONFIG[‘ruby_install_name’])},host_os:#{::Config::CONFIG[‘host_os’]},target:#{::Config::CONFIG[‘target’]},target_vendor:#{::Config::CONFIG[‘target_vendor’]},host:#{::Config::CONFIG[‘host’]},version:#{RUBY_VERSION},target_os:#{::Config::CONFIG[‘target_os’]},host_cpu:#{::Config::CONFIG[‘host_cpu’]},”” STDERR ----
[Sat, 20 Mar 2010 16:21:31 +0000] DEBUG: Ran (ruby -e “require ‘rbconfig’; puts “host_vendor:#{::Config::CONFIG[‘host_vendor’]},release_date:#{RUBY_RELEASE_DATE},bin_dir:#{::Config::CONFIG[‘bindir’]},platform:#{RUBY_PLATFORM},target_cpu:#{::Config::CONFIG[‘target_cpu’]},ruby_bin:#{::File.join(::Config::CONFIG[‘bindir’], ::Config::CONFIG[‘ruby_install_name’])},host_os:#{::Config::CONFIG[‘host_os’]},target:#{::Config::CONFIG[‘target’]},target_vendor:#{::Config::CONFIG[‘target_vendor’]},host:#{::Config::CONFIG[‘host’]},version:#{RUBY_VERSION},target_os:#{::Config::CONFIG[‘target_os’]},host_cpu:#{::Config::CONFIG[‘host_cpu’]},””) returned 127

Matthew


I must take issue with the term “a mere child”, for it has been my
invariable experience that the company of a mere child is infinitely
preferable to that of a mere adult.
– Fran Lebowitz