Results 1 to 9 of 9

Thread: Problems with ruby1.9.2

Hybrid View

  1. #1
    Just burned his ISO
    Join Date
    May 2011
    Posts
    3

    Question Problems with ruby1.9.2

    Hi all,
    I've seen that there are similar topic to this, but no one related to this issue.
    I've tried with both kde and ubuntu bt5 and is always the same.
    The problem.
    By default bt5 uses ruby1.9.2 the problem is that there is no way to install gems, or better, seems like that interpreter can't load it.
    I have metasploit 3.8 and i can't run it with ./msfconsole instead i must run it with ruby1.8 msfconsole and now i will explain why.
    If I install pg via gem
    gem install pg
    it installs in the folder of ruby 1.9.2 but when you try to load it via irb i get the error:
    #irb
    irb(main):001:0> require 'rubygems'
    => false
    irb(main):002:0> require 'pg'
    LoadError: no such file to load -- pg
    from (irb):2:in `require'
    from (irb):2
    from /usr/bin/irb:12:in `<main>'
    irb(main):003:0>

    So I've tried installing the driver with ruby1.8
    gem1.8 install pg everything works fine:
    #irb1.8
    irb(main):001:0> require 'rubygems'
    => true
    irb(main):002:0> require 'pg'
    => true
    irb(main):003:0>

    What drive me crazy ( and trust me I've spent 2 days before posting here ) is that the pg module is installed!

    root@bt:/pentest/exploits# gem list --local | grep pg
    pg (0.11.0)
    root@bt:/pentest/exploits#

    I don't know what the problem is, anyway I've tried reinstalling rubygems and I've got this error:

    update-alternatives: error: alternative gem can't be master: it is a slave of ruby
    dpkg: error processing rubygems1.9.2 (--configure):
    subprocess installed post-installation script returned error exit status 2
    Errors were encountered while processing:
    rubygems1.9.2
    E: Sub-process /usr/bin/dpkg returned an error code (1)


    By default of course I have ruby1.9.2.
    Thanks in advance.

  2. #2
    Developer muts's Avatar
    Join Date
    Jan 2006
    Posts
    272

    Default Re: Problems with ruby1.9.2

    Metasploit has it's own version of ruby which is independent of either ruby1.8 or ruby1.9.2.
    I am unclear how you managed to mingle the msf ruby and the BT5 ruby....

  3. #3
    Just burned his ISO
    Join Date
    May 2011
    Posts
    3

    Default Re: Problems with ruby1.9.2

    Quote Originally Posted by muts View Post
    Metasploit has it's own version of ruby which is independent of either ruby1.8 or ruby1.9.2.
    I am unclear how you managed to mingle the msf ruby and the BT5 ruby....
    I don't know, really, if you want i can make a short video
    Anyway how i can fix? i can't find other way for installing the postgresql module..

    edit:
    anyway i don't know what you mean with " has it's own version of ruby which is independent of either ruby1.8 or ruby1.9.2."
    As far as i know it uses the version of the enviroment....

  4. #4
    Just burned his ISO
    Join Date
    May 2011
    Posts
    1

    Default Re: Problems with ruby1.9.2

    I'm having similar issues, but Metasploit will run for me. I'm having issues as described here concerning the pcaprub gem embedded in Metasploit (and I have not gotten the "recompile" fix described here to work either), however my min concern is with the BT5 ruby implementation as I was having a hell of a time getting my gems to load into my scripts.

    The problem poizon describes here:
    #irb
    irb(main):001:0> require 'rubygems'
    => false
    irb(main):002:0> require 'pg'
    LoadError: no such file to load -- pg
    from (irb):2:in `require'
    from (irb):2
    from /usr/bin/irb:12:in `<main>'
    irb(main):003:0>
    Is what I'm talking about. I've install ruby gems and have not been able to use them in my scripts, they I can verify both through gem list and the install location that they are there. However, I stumbled upon a work around and a possible cause for this behavior. In my install, if you print the ruby Gem.path variable, you get an array of two directories. One is the local user location (/user/.gem/blah/blah?) and the other is a location in the /usr directory. However, checking gem env shows that the install path and the gem directory there are both in /var. If you install gems using the --user-install (I think this is the option, I might be off in syntax, but gem help install should clear it up), you can then include your gems as you would normally be able to do. I've tried finding where the Gem.path array is set, and I thought it was going to be in rubygems/defaults.rb, but I couldn't find anything definitive. It seems that at least part of this would work as expected if that value could be changed. Until then, install your gems locally and they should be able to be loaded. As far as the Metasploit issue goes, I'm unsure of how that's going.

  5. #5
    Just burned his ISO
    Join Date
    Jul 2011
    Posts
    1

    Default Re: Problems with ruby1.9.2

    Hi all,

    Just had this problem and came up with what looks like a fix to it.

    The problem is that the GEM_PATH isn't pointing to the location that ruby 1.9.2 is installing the gems into.

    you can see the gem path by doing

    ruby -r rubygems -e "p Gem.path"

    and the path that a gem is installed into by doing

    gem contents <gem name>

    For my installation the gems are getting installed into /var/lib/gems/1.9.2/gems/ and the path in GEM_PATH is /usr/lib/ruby/gems/1.9.2

    so my resolution was

    cd /usr/lib/ruby

    ln -s /var/lib/gems gems

    which seems to work

  6. #6
    Just burned his ISO
    Join Date
    Oct 2012
    Posts
    2

    Thumbs up Re: Problems with ruby1.9.2

    Quote Originally Posted by raesene View Post
    Hi all,

    Just had this problem and came up with what looks like a fix to it.

    The problem is that the GEM_PATH isn't pointing to the location that ruby 1.9.2 is installing the gems into.

    you can see the gem path by doing

    ruby -r rubygems -e "p Gem.path"

    and the path that a gem is installed into by doing

    gem contents <gem name>

    For my installation the gems are getting installed into /var/lib/gems/1.9.2/gems/ and the path in GEM_PATH is /usr/lib/ruby/gems/1.9.2

    so my resolution was

    cd /usr/lib/ruby

    ln -s /var/lib/gems gems

    which seems to work

    good job!I resolved this problem this way,thaks!

    cd /usr/lib/ruby

    ln -s /var/lib/gems gems

  7. #7
    Just burned his ISO
    Join Date
    Aug 2011
    Posts
    24

    Default Re: Problems with ruby1.9.2

    Have anyone tried to use RVM? (Ruby Version Manager) I just install it and at least for Rails it's cool.

    The versions from the Repositories (1.9.2) always end with configuration errors, like the one above.
    For what I have been reading that version it's very buggy.

Similar Threads

  1. Problems with mac
    By jabyrd3 in forum Beginners Forum
    Replies: 5
    Last Post: 12-12-2010, 12:00 AM
  2. Problems with X
    By Godfrey in forum Beginners Forum
    Replies: 0
    Last Post: 11-24-2010, 01:21 PM
  3. Replies: 2
    Last Post: 07-19-2010, 11:54 AM
  4. 2 Problems
    By Steel9 in forum OLD Newbie Area
    Replies: 0
    Last Post: 03-07-2009, 03:22 AM
  5. wpa problems
    By texasmeat in forum OLD Newbie Area
    Replies: 0
    Last Post: 04-11-2007, 11:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •