Obtendo o “comando não encontrado” ao tentar executar o comando rvm como sudo

0

Estou tentando reinstalar o Ruby na minha máquina Ubuntu 14.04, mas estou confuso sobre como preciso configurar minha variável PATH ou outras coisas. Quando eu tento como usuário normal, recebo todos os tipos de erros de permissão negada ...

myuser@myproject:~$ rvm reinstall ruby-2.4.0
mkdir: cannot create directory ‘/usr/local/rvm/log/1496156193_ruby-2.4.0’: Permission denied
tee: /usr/local/rvm/log/1496156193_ruby-2.4.0/remove.rubies.log: No such file or directory
ruby-2.4.0 - #removing rubies/ruby-2.4.0....
Error running '__rvm_rm_rf /usr/local/rvm/rubies/ruby-2.4.0',
showing last 15 lines of /usr/local/rvm/log/1496156193_ruby-2.4.0/remove.rubies.log
tail: cannot open ‘/usr/local/rvm/log/1496156193_ruby-2.4.0/remove.rubies.log’ for reading: No such file or directory
mkdir: cannot create directory ‘/usr/local/rvm/log/1496156193_ruby-2.4.0’: Permission denied
tee: /usr/local/rvm/log/1496156193_ruby-2.4.0/remove.rubies.log: No such file or directory
ruby-2.4.0 - #removing rubies/ruby-2.4.0....
Error running '__rvm_rm_rf /usr/local/rvm/rubies/ruby-2.4.0',
showing last 15 lines of /usr/local/rvm/log/1496156193_ruby-2.4.0/remove.rubies.log
tail: cannot open ‘/usr/local/rvm/log/1496156193_ruby-2.4.0/remove.rubies.log’ for reading: No such file or directory
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.4.0.tar.bz2
Checking requirements for ubuntu.
Requirements installation successful.
ruby-2.4.0 - #configure
ruby-2.4.0 - #download
ruby-2.4.0 - #validate archive
ruby-2.4.0 - #extract
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/README.md’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/.travis.yml’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/test/dtf/rubygems_comment_test.sh’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/test/dtf/binary_comment_test.sh’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/test/dtf/bundler_comment_test.sh’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/test/dtf/rails_and_gemfile_comment_test.sh’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/CHANGELOG.md’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/LICENSE’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/rubygems-bundler.gemspec’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/lib/rubygems_executable_plugin.rb’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/lib/rubygems-bundler/version.rb’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/lib/rubygems-bundler/noexec.rb’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/Gemfile’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/.noexec.yaml’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/.gem.config’: Permission denied
rm: cannot remove ‘/usr/local/rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/rubygems-bundler-1.4.4/.gitignore’: Permission denied
mktemp: failed to create directory via template ‘/usr/local/rvm/tmp/rvm-tmp.XXXXXXXXX’: Permission denied
mkdir: cannot create directory ‘’: No such file or directory
tar: : Cannot open: No such file or directory

mas quando eu tento e instalo como sudo, recebo o erro "comando não encontrado"

myuser@myproject:~$ sudo rvm reinstall ruby-2.4.0
sudo: rvm: command not found

Como configuro meu sudo para que ele encontre meu executável rvm da mesma forma que meu usuário normal pode?

    
por Dave 30.05.2017 / 17:01

1 resposta

1

Experimente sudo -E rvm reinstall ruby-2.4.0 .

De man sudo :

-E, --preserve-env

Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the user does not have permission to preserve the environment.

    
por 30.05.2017 / 17:28