sudo: rvm: command not found - RVM MultiUser install on Ubuntu 12.04 server

15,518

Solution 1

Maybe this bug affects you.
Instead of waiting for a fixed release you might install an older version of rvm:

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

See https://rvm.io/rvm/install/ for details.

EDIT: This issue is now solved. rvmsudo is working for me (Ubuntu 12.04).

Solution 2

I was having this same problem today too, and instead of waiting for the fix or installing an older version of rvm, I patched my rvmsudo file back to 1.16.x and left the rest of rvm alone.

first double check where rvmsudo is located on your system:

> which rvmsudo
/usr/local/rvm/bin/rvmsudo

then replace it with the version from 1.16.x

curl https://raw.github.com/wayneeseguin/rvm/eef67d80409ee3291de83ec4f070bed5aaca6d41/binscripts/rvmsudo > /path/to/rvmsudo

Note: I actually tried first updating to the latest version of rvm, since the issue that @trobter links to above in rvm's github account is marked as fixed, but the fix doesn't fully resolve the issue, so then I searched through their github account for the version of rvmsudo from 1.16.x, which did work.

Solution 3

I think it may be because you did not add yourself to the rvm group. You said:

usermod -a -G me rvm

What it should be is:

usermod -a -G rvm me

In addition, I needed to add the following line to the end of my .bashrc:

[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"  # This loads RVM into a shell session.

After that, just log into your shell again.

Share:
15,518
dark_ruby
Author by

dark_ruby

javascript coder. gym, coffee and functional programming addict

Updated on June 04, 2022

Comments

  • dark_ruby
    dark_ruby almost 2 years

    I'm setting up a server, it's an Ubuntu 12.04

    first I installed RVM multi-user:

    me@ubuntu$ \curl -L https://get.rvm.io | sudo bash -s stable

    then after RVM installed, as the installation suggests I added myself to RVM group

    usermod -a -G me rvm

    installed ruby rvm insall 1.9.3 --default

    then I tried to install system wide gem passenger and I get this:

    me@ubuntu:~$ rvmsudo gem install passenger
    sudo: gem: command not found
    

    In fact any command run with rvmsudo just says sudo : {command}: not found

    I need gems to be installed system wide, because it's a production server setup, also installing passenger-install-nginx-module requires root permissions as it installs int to /opt/nginx/

    any thoughts?

  • dark_ruby
    dark_ruby over 11 years
    This is more like a workaround, I want to know why is it doing that, and how to make it work without full paths?
  • hd1
    hd1 over 11 years
    Because rvmsudo sanitises your environment to avoid problems. If you still want to make it work, you can try "env PATH=$PATH_TO_GEM rvmsudo gem install foo" and see what happens?
  • Bee
    Bee over 11 years
    I was having this same problem today too. It's definitely the issue linked above, which is not fully fixed in rvm head (as of right now).