Problems installing ruby with rvm install 2.6.1 - ruby

Whenever I try to install Ruby 2.6.1 on Ubuntu this error keeps coming up. Does anyone have any solutions?
$ rvm install 2.6.1
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.1.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
mkdir: cannot create directory ‘/usr/share/rvm/log/1624238816_ruby-2.6.1’: Permission denied
tee: /usr/share/rvm/log/1624238816_ruby-2.6.1/update_system.log: No such file or directory
Updating systemddsmith password required for 'apt-get --quiet --yes update': ..-
..
Error running 'requirements_debian_update_system ruby-2.6.1',
please read /usr/share/rvm/log/1624238816_ruby-2.6.1/update_system.log
Requirements installation failed with status: 1.`

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

File system permission error when installing Ruby using RVM on Ubuntu

I am currently unable to run rvm install through Ubuntu and I have an idea as to why, but have no idea how to fix it.
Here's what's happening
~$ rvm install 2.6.1
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.1.tar.bz2
Checking requirements for ubuntu.
Installing requirements for ubuntu.
mkdir: cannot create directory ‘/usr/share/rvm/log/1609714241_ruby-2.6.1’: Permission denied
tee: /usr/share/rvm/log/1609714241_ruby-2.6.1/update_system.log: No such file or directory
Updating system....
Error running 'requirements_debian_update_system ruby-2.6.1',
please read /usr/share/rvm/log/1609714241_ruby-2.6.1/update_system.log
Requirements installation failed with status: 1.
Any help would be very much appreciated.
I ended up changing my ability to edit the directory
/log/
and I am now being shown There was an error(23). Failed download There has been an error fetching the ruby interpreter. Halting the installation.
when I attempt to install
I found that I needed to add my Ubuntu user to rvm group using rvm group add rvm "$USER"
Issue resolved

Can't install ruby to /usr/local on Ubuntu 14.04 using rbenv

Have to re-install ruby on our server because our Rails installation is failing (some OpenSSL error).
I successfully uninstalled it by running $sudo rm -rf $(rbenv prefix 1.9.3-p194) Because the command rbenv uninstall failed. Then I couldn't $rbenv rehash because:
rbenv: cannot rehash: /usr/local/rbenv/shims/.rbenv-shim exists
But I'm not sure if that matters.
Anyways now when I try to run $rbenv install -v 1.9.3-p194 I get a permission denied error:
cannot create directory '/usr/local/rbenv/versions/1.9.3-p194': Permission denied
But when I run $sudo rbenv install -v 1.9.3-p194 the ruby is installed successfully in /home/anbranin/.rbenv/versions/1.9.3-p194, which is NOT where it's supposed to be, right? It's supposed to be in /usr/local.
Total newbie here trying to run a legacy rails application--our devops person is out--so I'm lacking in knowledge about Linux servers.
My only idea at this point is to just sudo mv the files to usr/local but will that work?

Missing the OpenSSL lib?

I have been trying to install ruby 2.1.1 but when I run it in the terminal, this is what i get:
$rbenv install 2.1.1
Downloading yaml-0.1.6.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/5fe00cda18ca5daeb43762b80c38e06e
Installing yaml-0.1.6...
Installed yaml-0.1.6 to /Users/nthulanemakgato/.rbenv/versions/2.1.1
Downloading ruby-2.1.1.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/e57fdbb8ed56e70c43f39c79da1654b2
Installing ruby-2.1.1...
BUILD FAILED
Inspect or clean up the working tree at /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby-build.20140427221824.34053
Results logged to /var/folders/tj/_bd6whds6lb7wtn2m8ylwx7h0000gp/T/ruby- build.20140427221824.34053.log
Last 10 log lines:
io-console 0.4.2
json 1.8.1
minitest 4.7.5
psych 2.0.3
rake 10.1.0
rdoc 4.1.0
test-unit 2.1.1.0
installing rdoc: /Users/nthulanemakgato/.rbenv/versions/2.1.1/share/ri/2.1.0/system
installing capi-docs: /Users/nthulanemakgato/.rbenv/versions/2.1.1/share/doc/ruby
The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
So I went on Google, searched and tried a few things like:
$brew link openssl --force
Linking /usr/local/Cellar/openssl/1.0.1f... Warning: Could not link openssl. Unlinking...
then i tried
$ brew update
error: unable to unlink old '.gitignore' (Permission denied) error: unable to create file CODEOFCONDUCT.md (Permission denied) error: unable to unlink old 'CONTRIBUTING.md' (Permission denied) error: unable to create file LICENSE.txt (Permission denied) error: unable to unlink old 'README.md' (Permission denied) error: unable to unlink old 'SUPPORTERS.md' (Permission denied) Checking out files: 100% (1995/1995), done. Error: Failure while executing: git pull - q origin refs/heads/master:refs/remotes/origin/master
$ brew upgrade ruby-build
Error: ruby-build not installed
and,
$brew install openssl
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl- 1.0.1g.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.1g.mavericks.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, so it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
The OpenSSL provided by OS X is too old for some software.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
Error: Failed to create: /usr/local/opt/openssl
Things that depend on openssl will probably not build.
==> Summary
🍺 /usr/local/Cellar/openssl/1.0.1g: 429 files, 15M
and lastly,
$sudo brew install openssl
Password:
Error: Cowardly refusing to `sudo brew install`
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.
and a couple of other things like(which details I won't go into unless you think its necessary):
$CONFIGURE_OPTS="--with-openssl-dir=/usr/local/opt/openssl" rbenv install 2.1.1
$CFLAGS='-g -O2' RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` rbenv install 2.1.1
and both haven't worked.
I have installed xcode
I have an OS X 10.9.2.
Homebrew is installed.
OpenSSL 0.9.8y 5 Feb 2013
I don't understand what's going on and I have been struggling with this for a long time, please help.
Let me know if there is more information that you need in order to help and i'll happily provide it.
I found the answer to this challenge in another site.
$rbenv install --patch 2.1.1
then
$curl https://gist.githubusercontent.com/andschwa/11334511/raw/563d5c2efb869cafb0c65404d12243822bba2817/ruby-2.1.1-readline.patch | rbenv install --patch 2.1.1
I got this information from this link:
https://schwartzmeyer.com/2014/04/26/building-ruby-2-0-0-and-2-1-1-on-os-x/

Unable to install ruby using rvm due to mac port issues

I am trying to install ruby 1.9.2 or latest to work with cupertino gems
In order to install ruby, i have install 3rd party tool(RVM)
I am able to install rvm, However to install ruby, i am getting macport errors
I tried to resolve it using existing stackoverflow question, but it does not aid me clearly in resolving the issue
Steps which i followed are:
Installed rvm from get.rvm.io
activated rvm using below command:
$ source ~/.rvm/scripts/rvm
Now i am trying to install ruby 1.9.2 using following command:
$ rvm install 1.9.2
it fails with following error
*BLR4AUTOMATION2:ruby-1.9.2-p320 admin$ rvm install 2.0.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p247.
Continuing with compilation.
Please read 'rvm help mount' to get more information on binary rubies. Installing requirements for osx, might require sudo password.
Password:
DEBUG: Copying /Users/admin/Library/Preferences/com.apple.dt.Xcode.plist to /opt/local/var/macports/home/Library/Preferences
DEBUG: MacPorts sources location: /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
---> Updating MacPorts base sources using rsync rsync: failed to connect to rsync.macports.org:
Connection refused (61) rsync error: error in socket IO (code 10) at /SourceCache/rsync/rsync-42/rsync/clientserver.c(105) [receiver=2.6.9]
Command failed: /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
Exit code: 10
DEBUG: Error synchronizing MacPorts sources: command execution failed
while executing "macports::selfupdate [array get global_options]
base_updated"
Error: /opt/local/bin/port: port selfupdate failed:
Error synchronizing MacPorts sources: command execution failed
Requirements installation failed with status: 1.*
I have tried to follow several thread related to it, but it did not work for me:
http://samkhan13.wordpress.com/2012/06/15/make-macports-work-behind-proxy
synching macports using tarballs and other sources
Tried to uninstall macports from my mac and reinstall, but that also make no use
Reinstall latest xcode with cli
I have uploaded the console logs at below location:
https://docs.google.com/document/d/1l_OFbE5d0tliKdnU_gF6Bil75Ek7wJb58h7Da_JTXdQ/edit?usp=sharing
At the same time i am able to install the ruby in my other mac machines but not on build machine
Can any one please help me in setting up ruby(1.9.2 or higher) using rvm or with other ways.
Thanks in advance!!
kishan
Check if the internet ports are available in your router, I tried in college (tons of ports closed) and got the same problem, try again in my house with less locked ports and worked just fine.
make sure you can run
sudo /usr/bin/rsync -rtzv --delete-after rsync://rsync.macports.org/release/tarballs/base.tar /opt/local/var/macports/sources/rsync.macports.org/release/tarballs
when you find proper flags (proxy!) then you can make sure macports will use them with rsync_options from macports.conf

Resources