crysfel
By:
crysfel

Unicorn not starting

January 28, 2014 6.7k views
Hi Guys. I have installed the one-click ruby-rails droplet following the tutorial, but I have to use ruby-1.9.3 because it's an old project that I want to migrate from heroku. After installing the correct ruby and all the gems for my project I changed the paths for the ruby in the file /etc/default/unicorn as follow: PATH=/usr/local/rvm/rubies/ruby-1.9.3-p484/bin:/usr/local/rvm/gems/ruby-1.9.3-p484/bin/:/home/unicorn/.rvm/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:$ I have just defined the correct paths for ruby-1.9.3. But when starting the unicorn server Im getting this error: $service unicorn start * Starting Unicorn web server unicorn /usr/local/rvm/gems/ruby-2.0.0-p353/gems/kgio-2.8.1/lib/kgio_ext.so: [BUG] Segmentation fault ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux] -- Control frame information ----------------------------------------------- c:0025 p:---- s:0103 b:0103 l:000102 d:000102 CFUNC :method_defined? c:0024 p:-1922520 s:0101 b:0101 l:000100 d:000100 TOP c:0023 p:---- s:0099 b:0099 l:000098 d:000098 CFUNC :require c:0022 p:0159 s:0095 b:0095 l:000094 d:000094 METHOD /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55 c:0021 p:0033 s:0085 b:0085 l:000084 d:000084 TOP /usr/local/rvm/gems/ruby-2.0.0-p353/gems/kgio-2.8.1/lib/kgio.rb:21 c:0020 p:---- s:0083 b:0083 l:000082 d:000082 FINISH c:0019 p:---- s:0081 b:0081 l:000080 d:000080 CFUNC :require c:0018 p:0159 s:0077 b:0077 l:000076 d:000076 METHOD /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55 c:0017 p:0059 s:0067 b:0067 l:000066 d:000066 TOP /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn.rb:6 c:0016 p:---- s:0065 b:0065 l:000064 d:000064 FINISH c:0015 p:---- s:0063 b:0063 l:000062 d:000062 CFUNC :require c:0014 p:0270 s:0059 b:0059 l:000058 d:000058 METHOD /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73 c:0013 p:0069 s:0049 b:0049 l:000048 d:000048 TOP /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/launcher.rb:9 c:0012 p:---- s:0047 b:0047 l:000046 d:000046 FINISH c:0011 p:---- s:0045 b:0045 l:000044 d:000044 CFUNC :require c:0010 p:0270 s:0041 b:0041 l:000040 d:000040 METHOD /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73 c:0009 p:0011 s:0031 b:0031 l:000030 d:000030 TOP /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/bin/unicorn:3 c:0008 p:---- s:0025 b:0025 l:000024 d:000024 FINISH c:0007 p:---- s:0023 b:0023 l:000022 d:000022 CFUNC :load c:0006 p:0167 s:0019 b:0019 l:0011e8 d:001bd8 EVAL /usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23 c:0005 p:---- s:0015 b:0015 l:000014 d:000014 FINISH c:0004 p:---- s:0013 b:0013 l:000012 d:000012 CFUNC :eval c:0003 p:0160 s:0007 b:0007 l:0011e8 d:001830 EVAL /usr/local/rvm/gems/ruby-1.9.3-p484/bin//ruby_executable_hooks:15 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH c:0001 p:0000 s:0002 b:0002 l:0011e8 d:0011e8 TOP -- Ruby level backtrace information ---------------------------------------- /usr/local/rvm/gems/ruby-1.9.3-p484/bin//ruby_executable_hooks:15:in `' /usr/local/rvm/gems/ruby-1.9.3-p484/bin//ruby_executable_hooks:15:in `eval' /usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in `' /usr/local/rvm/gems/ruby-2.0.0-p353/bin/unicorn:23:in `load' /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/bin/unicorn:3:in `' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73:in `require' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73:in `require' /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn/launcher.rb:9:in `' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73:in `require' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:73:in `require' /usr/local/rvm/gems/ruby-2.0.0-p353/gems/unicorn-4.7.0/lib/unicorn.rb:6:in `' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' /usr/local/rvm/gems/ruby-2.0.0-p353/gems/kgio-2.8.1/lib/kgio.rb:21:in `' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require' /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `method_defined?' -- C level backtrace information ------------------------------------------- Segmentation fault Seems like unicorn is trying to use ruby-2.0.0 and 1.9.3 at the same time? any help would be appreciate. Regards
4 Answers
I found the solution!

It's also necessary to change the PATH in the /etc/init.d/unicorn file, by default is pointing to ruby-2.0.0, by changing those paths the unicorn server will start without an issue.

Regards
Thanks, this works. Have searched for different articles and this one finally helps.

Hi
I'm having the same problem running my app from a init.d script but wrong ruby version is loaded!

=* ruby-1.9.3-p545 [ x86_64 ]
I, [2016-10-07T11:17:21.290766 #4917]  INFO -- : Refreshing Gem list
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- personnummer (LoadError)
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/payway/releases/20161007073202/lib/lib.rb:4:in `<top (required)>'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from config.ru:4:in `block in <main>'
        from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in `instance_eval'
        from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in `initialize'
        from config.ru:1:in `new'
        from config.ru:1:in `<main>'
        from /usr/lib/ruby/vendor_ruby/unicorn.rb:48:in `eval'
        from /usr/lib/ruby/vendor_ruby/unicorn.rb:48:in `block in builder'
        from /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:764:in `call'
        from /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:764:in `build_app!'
        from /usr/lib/ruby/vendor_ruby/unicorn/http_server.rb:137:in `start'
        from /usr/bin/unicorn:126:in `<main>'

I have no idea of how to change this via the PATH. Anyone able to describe it for me?

Have another answer? Share your knowledge.