4

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?

1
  • Is this also possible without usermod?
    – Cadoiz
    Jul 27, 2022 at 10:12

4 Answers 4

4

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).

1
  • 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).
    – Bee
    Dec 12, 2012 at 0:54
4

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.

2

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.

0
0

Give rvmsudo the full path to your gem command?

2
  • This is more like a workaround, I want to know why is it doing that, and how to make it work without full paths?
    – dark_ruby
    Nov 24, 2012 at 20:13
  • 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?
    – hd1
    Nov 24, 2012 at 20:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.