Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:29:02+00:00 2026-06-11T22:29:02+00:00

I’m using Chef with Vagrant and would like to build a rails stack with

  • 0

I’m using Chef with Vagrant and would like to build a rails stack with RVM.

Here’s a snippet of my Vagrantfile configuration so far:

...
config.vm.provision :chef_solo do |chef|
  chef.cookbooks_path = "cookbooks"

  chef.add_recipe "apt"
  chef.add_recipe "build-essential"
  chef.add_recipe "ntp"
  chef.add_recipe "openssl"
  chef.add_recipe "apache2"
  chef.add_recipe "mysql"
  chef.add_recipe "mysql::server"
  chef.add_recipe "redis"
  chef.add_recipe "git"
  chef.add_recipe "rvm::system"
  chef.add_recipe "rvm::gem_package"
  chef.add_recipe "passenger_apache2"

  chef.json = { 
    :mysql => { 
      :server_root_password => 'root',
      :bind_address => '127.0.0.1'
    },
    :redis => {
      :daemonize => 'yes',
      :port => '6379'
    },
    :rvm => {
      :rubies => 'ruby-1.9.3-p194',
      :global_gems => [
        {:name => 'bundler'},
        {:name => 'rake'},
        {:name => 'passenger',
         :version => '3.0.17'
        }
      ]
    },
    :passenger => {
      :version => '3.0.17'
    }
  }
end

Firing up vagrant, the provisioning works until it tries to install passenger, then I get this error:

...
ERROR: gem_package[passenger] (passenger_apache2::default line 48) has had an error
ERROR: gem_package[passenger] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/passenger_apache2/recipes/default.rb:48:in `from_file') had an error:
gem_package[passenger] (passenger_apache2::default line 48) had an error: NoMethodError: undefined method `join' for nil:NilClass
...

sshing into vagrant, I can see that RVM and the gems installed fine:

vagrant@lucid32:~$ rvm list

rvm rubies

=* ruby-1.9.3-p194 [ i686 ]

# => - current
# =* - current && default
#  * - default

vagrant@lucid32:~$ gem list

*** LOCAL GEMS ***

bundler (1.2.1)
daemon_controller (1.0.0)
fastthread (1.0.7)
passenger (3.0.17)
rack (1.4.1)
rake (0.9.2.2)
rubygems-bundler (1.1.0)
rvm (1.11.3.5)

And manually running rvmsudo passenger-install-apache2-module works fine

So I’m pretty sure the problem is chef running its commands without rvm loaded

here are the commands for cookbooks/passenger_apache2/recipes/default.rb: line 48-55

...
gem_package "passenger" do
  version node[:passenger][:version]
end

execute "passenger_module" do
  command 'passenger-install-apache2-module --auto'
  creates node[:passenger][:module_path]
end

The cookbooks I’m using for RVM and passaenger_apache, are:

  • https://github.com/fnichol/chef-rvm
  • https://github.com/opscode-cookbooks/passenger_apache2

I tried replacing passenger-install-apache2-module --auto with rvmsudo passenger-install-apache2-module --auto with no luck…

Does anybody know how to get rvm and rvmsudo working in chef?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:29:03+00:00Added an answer on June 11, 2026 at 10:29 pm

    I believe you are correct in thinking that Chef is executing commands without rvm loaded. Perhaps you can use the rvm_shell command from chef-rvm to install passenger. Something like this might work:

    rvm_shell "passenger_module" do
      ruby_string "ruby-1.9.3-p194"
      code        "passenger-install-apache2-module --auto"
      creates node[:passenger][:module_path]
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.