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 8996039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:42:01+00:00 2026-06-15T23:42:01+00:00

I’m trying to setup Apache/Thin to power my Rails 3.2.9 application, which means setting

  • 0

I’m trying to setup Apache/Thin to power my Rails 3.2.9 application, which means setting up both Apache and Thin as daemons. I’m using RVM/gemset that runs Ruby 1.9.3-p286, however, my daemons don’t seem to want to use it, instead, opting for some non-RVM system installed Ruby 1.8.7.

When I go to start thin, this is the error I receive:

ubuntu@ip-1-1-1-1:~/www/mydomain/mysite$ /etc/init.d/thin start
/usr/local/rvm/gems/ruby-1.9.3-p286@mysite/gems/eventmachine-1.0.0/lib/rubyeventmachine.so: [BUG] Segmentation fault
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Aborted (core dumped)

Similarly, using the same command with sudo yields:

ubuntu@ip-1-1-1-1:~$ sudo /etc/init.d/thin start
[start] /etc/thin/mysite.yml ...
Starting server on 127.0.0.1:5000 ... 

# However, it refuses connections and crashes, evidenced by:
ubuntu@ip-1-1-1-1:~/www/mydomain/mysite/log$ cat thin.5000.log
>> Writing PID to tmp/pids/thin.5000.pid
>> Using rack adapter
>> Exiting!
/usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- bundler/setup  (LoadError)
from /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:36:in `require'
...

I think the segmentation fault is due to the wrong version of Ruby. Clearly, it is using 1.8.7, which isn’t the Ruby I want. However, checking the ruby version otherwise seems to look OK:

ubuntu@ip-1-1-1-1:~$ which ruby
/usr/local/rvm/rubies/ruby-1.9.3-p286/bin/ruby
ubuntu@ip-1-1-1-1:~$ ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [x86_64-linux]

And here it is again run under sudo:

ubuntu@ip-1-1-1-1:~$ sudo which ruby
/usr/bin/ruby
ubuntu@ip-1-1-1-1:~$ sudo ruby -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

How do I get my system to use Ruby 1.9.3 when I run Thin as a daemon, and avoid these nasty errors?

EDIT:

Here’s what my /etc/init.d/thin file looks like (it’s auto-generated using thin install, I believe):

#!/bin/sh
### BEGIN INIT INFO
# Provides:          thin
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: thin initscript
# Description:       thin
### END INIT INFO

# Original author: Forrest Robertson

# Do NOT "set -e"

DAEMON=/usr/local/bin/thin
SCRIPT_NAME=/etc/init.d/thin
CONFIG_PATH=/etc/thin

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

case "$1" in
  start)
        $DAEMON start --all $CONFIG_PATH
        ;;
  stop)
        $DAEMON stop --all $CONFIG_PATH
        ;;
  restart)
        $DAEMON restart --all $CONFIG_PATH
        ;;
  *)
        echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
        exit 3
        ;;
esac
  • Dave
  • 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-15T23:42:01+00:00Added an answer on June 15, 2026 at 11:42 pm

    Figured it out (or at least, I got it working one way…)

    Using this suggestion on the RVM site…

    1. Make sure your service (in my case, thin) is installed in one of your RVM gemsets.
    2. Generate a wrapper using: rvm wrapper ruby-1.9.3@mygemset bootup thin, replacing parameters as appropriate to your installation. It will make a script /usr/local/rvm/bin/bootup_thin. This wrapper will load thin with the gemset you specified in your call.
    3. Edit the /etc/init.d/thin script. Make the script call the generated Ruby wrapper by setting DAEMON=/usr/local/bin/thin to DAEMON=/usr/local/rvm/bin/bootup_thin
    4. Run your daemon; it should use the correct Ruby environment now.
    5. An unrelated ‘gotcha’ I ran into immediately after getting over this hurdle had to do with missing gems needed by my application. I think it has to do with different gemsets being used between my application folder and the daemon. You might have to do what I did; navigate to the application root, explicitly change to the gemset used by the daemon with rvm gemset use, then run bundle install to install the necessary gems into the gemset used by the daemon.

    With that, I got my server running with Apache/Thin. For those looking to do the same, use these pages.

    1st: http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby

    2nd: http://articles.slicehost.com/2008/5/6/ubuntu-hardy-apache-rails-and-thin

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
We're building an app, our first using Rails 3, and we're having to build
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I am trying to render a haml file in a javascript response like so:

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.