Install Ruby via RVM without confirmation prompt - ruby

I use Puppet to install Ruby via RVM and was working fine until very recently (last few days or so).
I think its due to rvm wanting me to "press any key to continue". Is there anyway to force "yes" this, I've tried --force but no luck. Thanks
[root#local ~]# rvm install --binary --verify-downloads 1 ruby-1.9.3-p362
Searching for binary rubies, this might take some time.
Installing requirements for unknown, might require sudo password.
Always update your system first!
/bin/bash
/usr/bin/curl
which: no git in (/usr/local/rvm/gems/ruby-1.9.3-p362/bin:/usr/local/rvm/gems/ruby-1.9.3-p362#global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p362/bin:/usr/local/rvm/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin)
/usr/bin/patch
Install: git
Install: build-essential openssl libreadline zlib1g libyaml libsqlite3 sqlite3 libxml2 libxslt autoconf libc6 libgdbm ncurses automake libtool bison pkg-config
press any key to continue

Try:
$ yes | rvm install --binary --verify-downloads 1 ruby-1.9.3-p362
From yes's man page:
Repeatedly output a line with all specified STRING(s), or ‘y’.

this message is from the new autolibs feature of RVM, you can find docs of it here: https://rvm.io/rvm/autolibs
You can disable autolibs using:
rvm autolibs disable
and make sure to report back to RVM it did not recognize your system => https://github.com/wayneeseguin/rvm/issues ... make sure to include head -n 100 /etc/*release (run as user not root)

Related

cannot install ruby using rvm as an unprivileged user with no sudo privileges

According to the rvm documentation at
https://rvm.io/rvm/install
it should be possible to install rvm, and subsequently a ruby, as a non-privileged user.
Under troubleshooting at
https://rvm.io/support/troubleshooting
it states:
Any user in the rvm group can update RVM, rubies, and gemsets. There
is never a reason to use sudo post-install.
rvm installs fine as a non-privileged user (There is no rvm group):
nosudo-user#my-site.com:~$ bash ~/downloads/rvm_installer.sh stable
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
...
Installing RVM to /<user-home>/.rvm/
...
However, when I try to install a ruby version, it fails (I think) trying to do an apt-get because it needs sudo privileges:
nosudo-user#my-site.com:~$ rvm install 2.6.6
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.6.6.tar.bz2
...
Updating system... password required for 'apt-get --quiet --yes update':
.
Error running 'requirements_debian_update_system ruby-2.6.6',
please read /<user-home>/.rvm/log/1659735568_ruby-2.6.6/update_system.log
Requirements installation failed with status: 1.
From the log:
2022-08-05 21:39:28] requirements_debian_update_system
requirements_debian_update_system ()
{
__rvm_try_sudo apt-get --quiet --yes update || {
\typeset __ret=$?;
case ${__ret} in
100)
rvm_error "There has been an error while updating your system using \`apt-get\`.
It seems that there are some 404 Not Found errors for repositories listed in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
apt-get update (as a user with sudo privileges) shows no errors.
How is one supposed to install rvm so a non-privileged user can install a version of ruby?
My guess is your system is missing some basic system libraries for buiding Ruby from source. Hence RVM tries to fetch the build libraries for you. This will be a one-time update, and after your system has the proper libraries installed, RVM will not require sudo again.
However if you want you can disable apt updating completely with:
rvm autolibs disable
Note that if you have missing build requirements, then the build step of Ruby will quite likely fail. Only way to find out is to try.
In that case you can use the requirements command to help you install missing dependencies:
rvm requirements
Casper's answer above provided the missing information; there were some missing libraries. However, the steps required to be able to install as an unprivileged user were rather un-intuitive (to me, at least):
Install rvm using sudo; in that process it creates the "rvm" group.
Add the desired users to the rvm group
Note:
Attempting to install a ruby as an unprivileged user after this step still fails.
sudo to root to get the rvm magic paths installed for root, then start installing a ruby, but kill the process after the requirements installation is complete.
Log in as the desired unprivileged user and use rvm to install the desired ruby for that user.
Cmds:
sudo rvm_installer.sh stable
sudo usermod -a -G rvm the-user
sudo -i
rvm install 2.6.6
Searching for binary rubies, this might take some time.
Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.6.6.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system..
Installing required packages: g++, gcc, autoconf, automake, bison, libffi-dev, libgdbm-dev, libncurses5-dev, libsqlite3-dev, libtool, libyaml-dev, make, pkg-config, sqlite3, libgmp-dev, libreadline-dev......................|
Requirements installation successful.
^C
exit
sudo -i -u the-user
rvm install 2.6.6

Installing latest RUBY with rvm gives error on Ubuntu

Getting the following error when im trying to install ruby-2.1.2
rvm install ruby-2.1.2
Searching for binary rubies, this might take some time.
Found remote file https://rubies.travis-ci.org/ubuntu/12.04/x86_64/ruby-2.1.2.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
Updating system................
Error running 'requirements_debian_update_system ruby-2.1.2',
showing last 15 lines of /usr/local/rvm/log/1400060285_ruby-2.1.2/update_system.log
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'There has been error while updating '\''apt-get'\'', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
\n'
There has been error while updating 'apt-get', please give it some time and try again later.
For 404 errors check your sources configured in:
/etc/apt/sources.list
/etc/apt/sources.list.d/*.list
++ return 100
sudo apt-get install gawk g++ gcc make libc6-dev libreadline6-dev zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 autoconf libgdbm-dev libncurses5-dev automake libtool bison pkg-config libffi-dev
I think your rvm is older version,
Install the latest (v1.25.25) rvm using:
$ \curl -L https://get.rvm.io | bash -s stable --ruby
then check the rubies available with this version:
$ rvm list known
then install the latest:
$ rvm install ruby-2.1.2
Note: Even if it does not show up in rvm list known it will try to download with the following message:
Installing Ruby from source to: /home/<YOUR_USER_NAME>/.rvm/rubies/ruby-2.1.2, this may take a while depending on your cpu(s)...
This error in my case was cased because apt-get update gave a n error. After doing and manual sudo apt-get update I notices that one of the repos gave an error "W: Failed to fetch". After editing the repo list and removing the one that gave the error I was able to install.
Try to use this for install latest ruby
rvm mount -r https://rvm.io/binaries/ubuntu/12.04/x86_64/ruby-1.9.3-p194.tar.bz2
for more help
rvm help mount
I tried most of above answers but none works for me, so i just change server
If you are using rvm for ruby then this will work.
Goto directory etc/apt
click on Sources.list
Change the server to us or some else server
Reload (it will update your cache from that server)
Then run sudo apt-get update
Finally run rvm install 2.3.0

Error installing any ruby version with RVM on OSX

Guys I'm about to kill myself with this one!
I had some problems with RVM installing multiple versions of Ruby, and following a thread on Stackoverflow I decided to remove it completely. After reinstalling RVM, I am unable to install any Ruby version at all.
Mac OS X
RVM 1.20.10 stable
Homebrew 0.9.4
Here are some logs:
rvm install 2.0.0-p0
or:
rvm install 2.0.0-p195 --autolibs=enabled
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p0.
Continuing with compilation. Please read 'rvm mount' to get more information on binary rubies.
Installing requirements for osx, might require sudo password.
Already up-to-date.
Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libxml2, libxslt, libksba, openssl…
Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config libyaml readline libxml2 libxslt libksba openssl',
please read /Users/admin/.rvm/log/ruby-2.0.0-p0/1368903329_package_install_autoconf_automake_libtool_pkg-config_libyaml_readline_libxml2_libxslt_libksba_openssl.log
Logfile reads:
[2013-05-18 22:55:29] requirements_osx_brew_libs_install
Error: No such keg: /usr/local/Cellar/autoconf
There were package installation errors, make sure to read the log.
Check Homebrew requirements github.com/mxcl/homebrew/wiki/Installation
brew doctor
Your system is ready to brew.
brew cleanup
Removing: /Library/Caches/Homebrew/automake-1.13.1.tar.gz…
Error: Permission denied — /Library/Caches/Homebrew/automake-1.13.1.tar.gz
brew reinstall autoconf
Error: No such keg: /usr/local/Cellar/autoconf
Help!
I ran into the same issue, you need to manually install all the required packages using Brew. For me I had to run the following installs:
brew install autoconf
brew install automake
brew install libtool
brew install apple-gcc42
brew install libyaml
brew install libxslt
brew install libksba
brew install openssl
You just need to keep running "rvm requirements" and reading the log and installing the packages needed until there are no more errors.
After installing RVM, You'll want to run
rvm requirements
to see if anything else is required to install ruby and rails first.
here is the similar question asked rvm install ruby
This solved problem for me
sudo chown -R `whoami` /Library/Caches/Homebrew/
I had the same problem
brew install pkg-config
worked for me
I aswell ran into the permission problem. My /usr/local/opt where the packages are linked had permissions root:wheel. I changed permissions by doing
sudo chown -R <localuser>:staff /usr/local/opt
where of course "localuser" is your local user you used to install brew.
Then aswell I had to run
brew reinstall autoconf
and so on instead of just "install", since brew always kept on saying the lib already was installed (yet not linked). "reinstall" simply forces a new install of the package. that did the trick for me.
Hope this helps someone with similar problems.
User which is running brew should have write access to This entire directory path
/Library/Caches/Homebrew/Formula
No need to change ownership just write permission. then running rvm works
I was encountering similar issues, particular around the install of openssl098. I came across this Homebrew issue, tried rvm get head as suggested, and now rvm works perfectly.
I'd try to install Xcode Command Line Tools before.
Try
rvm reinstall ruby-2.3.1 --with-openssl-dir=`brew --prefix openssl`
rvm openssl on Mojave

Error in ruby: cannot load such file -- zlib

When I try to install rails in Ubuntu 12.10 I get this error:
$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
So I completely removed rvm:
rvm implode
sudo rm -rf ~/.rvm
removed the script calls in my .bashrc and .bash_profile
and checked if they're really removed:
env | grep rvm #no output, so rvm is removed
ruby -v #The program 'ruby' can be found in the following packages: blabla
I already have these via sudo apt-get install:
curl zlib1g-dev zlib1g libssl-dev build-essential openssl libreadline6 libreadline6-dev curl git-core libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
Then proceed to install from scratch
curl -L https://get.rvm.io | bash -s stable --ruby --auto-dotfiles
then run that line and restarted terminal regard to this message:
* To start using RVM you need to run `source /home/adige/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
Then rvm pkg install readline but completed with error:
...
Error running 'autoreconf -is --force', please read /home/adige/.rvm/log/readline/autoreconf.log
...
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
I think it's installed anyway, right? Before reinstall all rubies, I installed zlib of course:
# w/out verify, it gives checksum error
rvm pkg install zlib --verify-downloads 1
Then run rvm reinstall all --force and completed with error again:
...
Install of ruby-1.9.3-p374 - #complete
Making gemset ruby-1.9.3-p374 pristine.
Error running '' under ,
please read /home/adige/.rvm/log/ruby-1.9.3-p374/gemset.pristine.log
Making gemset ruby-1.9.3-p374#global pristine.
gemset.pristine.log
Then reinstall ruby with zlib support:
rvm reinstall 1.9.3-p374 --with-zlib-dir=$rvm_path/usr
which returned same error and same log but completed anyway.
Finally I tried to install rails gem again but cannot load such file -- zlib !
Here is the rvm info
What am I doing wrong?
You should not install readline / zlib on ubuntu, follow this steps:
rvm get head
rvm pkg remove
rvm requirements run force
rvm reinstall 1.9.3-p374
make sure to include output of the installation process if this fails, also include all mentioned log files

Readline not working in rvm - Ubuntu 11.10

I am using rvm on my ubyntu 11.10. My readline is not working, I tried ruby extconf.rb but it is not passed. Output is bellow:
$ ruby extconf.rb
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
I tried installing libncurses5-dev & libreadline5-dev
$ sudo apt-get install libncurses5-dev libreadline5-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libreadline5-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
libreadline-gplv2-dev:i386 lib64readline-gplv2-dev:i386 libreadline-gplv2-dev
E: Package 'libreadline5-dev' has no installation candidate
What is the problem here? Can anyone help?
Same issue as here Readline errors prevent me running rails console
Under ubuntu you can use the system readline installation.
rvm uninstall ${YOURUBYVERSION}
sudo apt-get install libreadline-dev
rvm install ${YOURUBYVERSION} --with-readline-dir=/usr/include/readline
Substitute ${YOURUBYVERSION} with your desired ruby version.
I got the solution:
Run the command
rvm requirements
It shows the requirements and dependencies. Install those and reinstall the ruby on rvm
rvm remove 1.9.2
rvm install 1.9.2
It works!
For some reason I can't comment on #zzeroo's answer, but I want to draw attention to the fact that he's using
--with-readline-dir=/usr/include/readline
instead of
--with-readline-dir=$rvm_path/usr
I was banging my head against the wall for a long time and changing this fixed it for me.
Have you tried:
rvm pkg install readline
Then install ruby through RVM --with-readline-dir=$rvm_path/usr?
http://beginrescueend.com/packages/readline/
FWIW, I'd suggest giving rbenv + ruby-build a go, if you've never considered it. A lot less headaches than with RVM.
I've googled for a couple days, but no answers helps me, so my solution was:
Fully remove rvm How to remove rvm
Remove all ruby packages. First, find out which packages do you have:
dpkg -l | grep ruby
then make
sudo apt-get purge {PACKAGE}
where {PACKAGE} is package you want to remove ( for me there were ruby ruby1.8 ruby1.9.1 )
Then I made fresh installation of RVM Install RVM and installed ruby 1.9.2 with
rvm install 1.9.2
Now it should work!
I tried everything, but it didn't work. I had to do rvm implode (after having all the requirements installed) and then rvm install 1.8.7; rvm install 1.9.3 and it wor

Resources