4

I am trying to use the chef community cookbook opsworks_ruby to deploy a rails app. I am currently running into an issue with one of my gems, tiny_tds version 0.9.5.beta.10.

When trying to migrate the database with the following command:

/usr/local/bin/bundle exec rake db:migrate

I am getting this error:

STDERR: rake aborted!
LoadError: libruby.so.2.1: cannot open shared object file: No such file or directory - /srv/www/api/shared/vendor/bundle/ruby/2.2/extensions/x86_64-linux/2.2/tiny_tds-0.9.5.beta.10/tiny_tds/tiny_tds.so
/srv/www/api/shared/vendor/bundle/ruby/2.2/gems/tiny_tds-0.9.5.beta.10/lib/tiny_tds.rb:36:in `require'
/srv/www/api/shared/vendor/bundle/ruby/2.2/gems/tiny_tds-0.9.5.beta.10/lib/tiny_tds.rb:36:in `<top (required)>'
/usr/local/share/ruby/gems/2.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
/usr/local/share/ruby/gems/2.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/usr/local/share/ruby/gems/2.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
/usr/local/share/ruby/gems/2.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
/usr/local/share/ruby/gems/2.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
/usr/local/share/ruby/gems/2.2/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
/usr/local/share/ruby/gems/2.2/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'

However when I ssh into the server and

file /srv/www/api/shared/vendor/bundle/ruby/2.2/extensions/x86_64-linux/2.2/tiny_tds-0.9.5.beta.10/tiny_tds/tiny_tds.so

I get this as a response:

[...]tiny_tds.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=cce05b6143516778339554cb7b1e2db232bb155e, not stripped

So the file is clearly there, why can't it be found?

I currently have ruby 2.2.4 installed.

Calling

ldd /srv/www/api/shared/vendor/bundle/ruby/2.2/extensions/x86_64-linux/2.2/tiny_tds-0.9.5.beta.10/tiny_tds/tiny_tds.so

Gives me this:

linux-vdso.so.1 =>  (0x00007ffe73dcf000)
libruby.so.2.1 => not found
libct.so.4 => not found
libsybdb.so.5 => not found
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fee58fe0000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007fee58ddb000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007fee58ba4000)
libm.so.6 => /lib64/libm.so.6 (0x00007fee588a2000)
libc.so.6 => /lib64/libc.so.6 (0x00007fee584df000)
/lib64/ld-linux-x86-64.so.2 (0x0000556740bd7000)
libfreebl3.so => /lib64/libfreebl3.so (0x00007fee582dd000)

Also, looking into paths and whatnot:

$ echo $PATH
> /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/.local/bin:/home/ec2-user/bin

$ echo $GEM_HOME
>

$ echo $GEM_PATH
> 

$ which ruby
> /usr/bin/ruby

$ /usr/bin/ruby -v
> ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux-gnu]

I notice I have no GEM_HOME or GEM_PATH, but my ruby looks correct?

Can anyone help me resolve this issue?

Aristata
  • 610
  • 2
  • 9
  • 18
  • 2
    It shouldn't use `libruby.so.2.1` if you have ruby 2.2.4. You have environment mixed up somehow - multiple ruby versions with incorrect PATH/GEM_HOME/GEM_PATH. – Szymon Dec 14 '16 at 06:33
  • Why do you say that, and what should it be using? Any idea how I should proceed to begin looking into this? – Aristata Dec 14 '16 at 15:18
  • Use `ldd` to check the dynamic linkages – coderanger Dec 14 '16 at 17:14
  • I have updated the question with the results of calling ldd on the file, and I see that libruby.so.2.1 is not found, but I am not sure what that is telling me. – Aristata Dec 14 '16 at 17:54
  • I'm not sure how did you put ruby2.1 .so in 2.2, but you can try `bundle exec gem pristine` you may need to add `--path /srv/www/api/shared/vendor/bundle/` but it shouldn't be needed if you run command from `current` directory. – Szymon Dec 15 '16 at 07:57
  • I didn't put any ruby anywhere. I have tried your gem pristine, that does not work. I am feeling a little defeated here, I need an explanation about what might be going wrong but all I seem to be getting are fragments of things with no reason described behind them. Why do you think I have multiple ruby versions. What is the libruby file in the fist place? What would cause the wrong one to load -- those are the answers I need. – Aristata Dec 15 '16 at 23:54
  • @Aristata, Did you find get the solution to it or not? I'm also facing the same error. It would be great if you can share the solution. Thanks! – Prateek Gupta Feb 18 '20 at 10:27
  • @PrateekGupta I wish I could share it - I am having a hard time even remembering the problem! If I had to guess I would say I ended up ensuring I only had one ruby version. I wish I could be more helpful, this was a lot of projects ago!! – Aristata Feb 19 '20 at 16:41
  • Hi @Aristata, thanks for replying. I got it fixed by reinstalling ruby, somehow the ruby installation was messed up. – Prateek Gupta Feb 20 '20 at 08:55

0 Answers0