Apollo
Apollo

Reputation: 1986

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!

Upvotes: 5

Views: 7460

Answers (5)

skojin
skojin

Reputation: 33

I have same problem after update rvm and ruby, and rvmsudo_secure_path=1 helps me, as was described in http://www.snowcrash.eu/rvmsudo_secure_path/

Upvotes: 0

Sergey
Sergey

Reputation: 79

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.

Upvotes: 2

Mariano Cavallo
Mariano Cavallo

Reputation: 959

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)

Upvotes: 3

Mario Olivio Flores
Mario Olivio Flores

Reputation: 2795

This looks like it's been fixed in the latest 1.18.x versions. I upgraded to version 1.18.5 and this issue went away.

Upvotes: 0

Apollo
Apollo

Reputation: 1986

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.

Upvotes: 1

Related Questions