Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rvmsudo command not working properly

I am trying to get an updated version of a RoR environment.

I am running Ubuntu 12.04, and I have this setup:

$ groups
user adm cdrom sudo dip plugdev lpadmin sambashare rvm
$ rvm -v
rvm 1.17.2 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/]
$ rvm list

rvm rubies

=* ruby-1.9.3-p327 [ x86_64 ]

# => - current
# =* - current && default
#  * - default
$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]
$ gem -v
1.8.24
$ rails -v
Rails 3.2.9

All work fine. But now I am trying to install Thin and I found out that my rvmsudo command in pretty much useless:

$ rvmsudo echo 1
1
$ rvmsudo ruby -v
sudo: ruby: command not found
$ rvmsudo gem -v
sudo: gem: command not found
$ rvmsudo rails -v
sudo: rails: command not found

The same error when I run "rvmsudo thin install".

I am completely stuck. In Ubuntu 10.04 it worked fine and even my first test in 12.04 I got rvmsudo working perfect. I followed the exact same steps this time, but nothing seems to work.

I installed RVM using "curl -L https://get.rvm.io | sudo bash -s stable", I added myself to the rvm group, restarted the machine, used "source /etc/profile.d/rvm.sh" and installed my stuff normally.

Am I missing something here?

Thanks!

like image 983
Apollo Avatar asked Dec 07 '12 14:12

Apollo


3 Answers

Add export rvmsudo_secure_path=1 at the very end of your ~/.bashrc file and restart your Terminal.

This worked for me (Ubuntu 12.10 running bash)

like image 81
Mariano Cavallo Avatar answered Nov 06 '22 11:11

Mariano Cavallo


It is because the secure_path option has been set in your /etc/sudoers and the option's value is different to your current shell $PATH.

Solutions:

  1. Add the following command to your shell init script (for bash sell it is .bashrc for *nix, and .bash_profile for mac os x)

    export rvmsudo_secure_path=0  # means don't use the value in rvmsudo
    
  2. add rvm and Ruby's paths to the secure_path value.

From my point of view, the first is preferable.

like image 2
Sergey Avatar answered Nov 06 '22 11:11

Sergey


I managed to get it working.

I saw this serverfault page and I thought the problem was similar, so I gave it a try.

It seems there is something broken in version 1.17 of RVM. I installed a previous version using the command:

\curl -L https://get.rvm.io | sudo bash -s -- --version 1.16.13

But note that RVM 1.17 installs ruby-1.9.3-p327 and RVM 1.16.13 installs ruby-1.9.3-p286.

Updating from 1.16.13 doesn't work either, so lets hope they fix it soon.

like image 1
Apollo Avatar answered Nov 06 '22 10:11

Apollo