4

There is rvm 1.19.6 installed on ubuntu 12.04 with ruby 2.0.0. Just receive permission denied when doing rvm get stable. Here is the error:

$rvm get stable
######################################################################## 100.0%
bash: line 535: /home/ubuntu/.rvm/RELEASE: Permission denied
Could not update RVM, get some help at #rvm IRC channel at freenode servers.

When we are trying to installing readline on the server, the rvm remove 2.0.0 creates the permission deny error:

$rvm remove 2.0.0
tee: /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720906_remove.src.log: Permission denied
tee: /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720906_remove.src.log: Permission denied
Removing /home/ubuntu/.rvm/src/ruby-2.0.0-p0...........
.........
Error running '__rvm_rm_rf /home/ubuntu/.rvm/rubies/ruby-2.0.0-p0',
please read /home/ubuntu/.rvm/log/ruby-2.0.0-p0/1367720907_remove.rubies.log
rm: cannot remove `/home/ubuntu/.rvm/bin/ruby-2.0.0-p0': Permission denied
Removing ruby-2.0.0-p0 aliases...
Removing ruby-2.0.0-p0 wrappers...
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/ruby': Permission denied
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/rake': Permission denied
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/erb': Permission denied
rm: cannot remove `/home/ubuntu/.rvm/wrappers/ruby-2.0.0-p0/gem': Permission denied

We tried to delete ~/.gem/ and assign the right to ~/.gem/specs following this post, it did not work. What's wrong with the rvm? Thanks for help.

Community
  • 1
  • 1
user938363
  • 9,990
  • 38
  • 137
  • 303
  • 1
    looks like you install rvm as 1 user (maybe root?) and your are trying to remove it as another? what are the permissions and ownership on .rvm? `ls -ld .rvm` will show. as well as the files it cannot remove. – Doon May 05 '13 at 03:01
  • Here is the output: drwxrwsr-x 24 root rvm 4096 May 2 04:12 .rvm The user should be ubuntu instead of root. Is there a way we can change the ownership? – user938363 May 05 '13 at 03:05
  • There is some strange behavior with our rails app(http://stackoverflow.com/questions/16379385/rails-server-return-404-not-found-after-login). Does it have something to do with this rvm problem? – user938363 May 05 '13 at 03:06
  • The rvm was install under /home/ubuntu/.rvm. Not sure how it was assigned to root. – user938363 May 05 '13 at 03:18
  • Now the owner was changed to ubuntu as: drwxrwsr-x 24 ubuntu rvm 4096 May 2 04:12 .rvm . The error is the same when rvm get stable. – user938363 May 05 '13 at 03:43
  • did you chown -R ubuntu .rvm ? or did you just chown the directory. you need to make sure that all directories are owned by the same user. Also probably doesn't have to do with your rails issue. – Doon May 05 '13 at 20:59
  • @Doon, I think I did. Used: $rvmsudo chown -R ubuntu ~/.rvm. There is a ruby 2.0.0@global under .rvm besides to ruby 2.0.0. Is this global for root user and should be removed? – user938363 May 05 '13 at 21:54
  • @Doon, did $sudo chown -R ubuntu ~/.rvm again and rvm get stable works without permission error. I will mark it as answer if you have a formal reply. Thanks. – user938363 May 05 '13 at 22:16

1 Answers1

8

pulling from comments.

rvm was installed as root, and needs to be owned by the ubuntu user (or you need to run all commands as root)

sudo chown -R ubuntu .rvm will fix the permissions errors

as for the ruby 2.0.0@global it doesn't need to be removed. if you look at the rvm documents that is used as a place to install gems that should be across all gemsets for that particular version of ruby for instance I have bond, hirb, wirb, awesomeprint all in my global as they are referenced in my .irbrc. So as I create per project gemsets I always have them available to me (things like bundler are also handy there)

Doon
  • 19,719
  • 3
  • 40
  • 44