Unable to start unicorn as a service

  • Posted on October 29, 2014
  • fnllcAsked by fnllc

I used the 1-Click Ruby on Rails on Ubuntu 14.04 Image and this guide to setup my rails app: .

However, I downgraded to ruby 1.9.3 using rvm. I also removed the other ruby versions as they appeared to give me some issues.

I’m able to to manually start unicorn using the following command in my rails app root directory:

bundle exec unicorn -D -E “production”

However, when I try to start the unicorn service I receive this error:

service unicorn start

 * Starting Unicorn web server unicorn           
    /usr/bin/env: ruby_executable_hooks: No such file or directory

I’m logged in as root.

I would like to be able to get the service to work so that unicorn starts on reboot.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hey @asb @nurelm @V9lerie @fnllc - in my upgrade from ruby 2.0.0 to 2.3.3, I lost the file that was at /usr/local/rvm/gems/[ruby-#.#.#]/bin/unicorn.

My current issue is that my /etc/default/unicorn file references that file in the DAEMON=/usr/local/rvm/gems/ruby-#-#-#/bin/unicorn line.

Could I ask one of you to paste yours?

In case it helps, we had the same issue after downgrading Ruby (and changing /etc/default/unicorn appropriately). Never figured out why this was a problem, but editing the first line of the unicorn executable to include the full path to ruby_executable_hooks fixed it.

In our case, change the first line of /usr/local/rvm/gems/ruby-2.1.0/bin/unicorn from this:

#!/usr/bin/env ruby_executable_hooks

to this:

#!/usr/bin/env /usr/local/rvm/gems/ruby-2.1.0/bin/ruby_executable_hooks

Since you downgraded your version of Ruby, you’ll need to update the Unicorn configuration as well. Edit the file /etc/default/unicorn and change the values for the environmental variables to match the path found by running which ruby:

export GEM_HOME=/usr/local/rvm/gems/ruby-2.1.3
export GEM_PATH=/usr/local/rvm/gems/ruby-2.1.3:/usr/local/rvm/gems/ruby-2.1.3