Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RVM package fails to configure on fresh Ubuntu 18.04 server install #37

Closed
sakego opened this issue Jul 18, 2019 · 42 comments · Fixed by rvm/rvm#4742
Closed

RVM package fails to configure on fresh Ubuntu 18.04 server install #37

sakego opened this issue Jul 18, 2019 · 42 comments · Fixed by rvm/rvm#4742

Comments

@sakego
Copy link

sakego commented Jul 18, 2019

RVM package fails to configure during install.

Steps to reproduce

• apt-add-repository -y ppa:rael-gc/rvm
• apt-get update
• apt-get install rvm

Expected behavior

For the package to install and rvm command be able to run.

Actual behavior

apt-get install rvm
Do you want to continue? [Y/n]
Setting up rvm (1.29.9-1) ...
Upgrading the RVM installation in /usr/share/rvm/
Upgrade of RVM in /usr/share/rvm/ is complete.

  • Please do NOT forget to add your users to the rvm group.
    The installer no longer auto-adds root or users to the rvm group. Admins must do this.
    Also, please note that group memberships are ONLY evaluated at login time.
    This means that users must log out then back in before group membership takes effect!

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉 Donate: https://opencollective.com/rvm/donate

Creating local gemsets for USER
-su: rvm: command not found
dpkg: error processing package rvm (--configure):
installed rvm package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
rvm
E: Sub-process /usr/bin/dpkg returned an error code (1)

rvm
-bash: rvm: command not found

Environment info

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"

@raelgc
Copy link
Contributor

raelgc commented Jul 18, 2019

Hi @sakego and thanks for reporting this issue.

I'll download a copy of 18.04 and install in a VM in order to test this.

@raelgc
Copy link
Contributor

raelgc commented Jul 18, 2019

@sakego Had you tried to install rvm previously?

@sakego
Copy link
Author

sakego commented Jul 18, 2019

@raelgc this is a fresh install with no previous install of RVM. The failure happened upon installing the first time. The message above indicating upgrading because whenever I try to install a new pkg it attempts to finish installing RVM and fails.

@marcolussetti
Copy link

Same issue in Ubuntu for WSL (18.04.2).

@azatdev
Copy link

azatdev commented Jul 19, 2019

I have the same issue in Ubuntu 14.04. I am trying to install the latest RVM, version 1.29.9-1. Should I try to install the previous release?

@raelgc
Copy link
Contributor

raelgc commented Jul 19, 2019

I'm investigating this right now.

@raelgc
Copy link
Contributor

raelgc commented Jul 19, 2019

Root cause is in line https://github.com/rvm/ubuntu_rvm/blob/master/debian/postinst#L47

For some reason, /etc/profile.d/rvm.sh is no more automatically loaded.

@sidahmed-malaoui
Copy link

If your dpkg just broke because of the error, and you can't install anything because of it, you can use this temporary fix to remove rvm (until it gets fixed) :

sudo -s
source /etc/profile.d/rvm.sh
apt-get install -f
apt-get autoremove --purge rvm

@raelgc
Copy link
Contributor

raelgc commented Jul 22, 2019

I published the PR sent by @jikamens and appears it worked. Can someone on 18.04 test it too?

@SuperSandro2000
Copy link

Installs without errors on 19.04.

@raelgc
Copy link
Contributor

raelgc commented Jul 22, 2019

Thanks for the feedback, @SuperSandro2000. I'm publishing the updated package for other releases.

@amonea
Copy link

amonea commented Jul 23, 2019

I found the same issue on 18.04. Basically, the issue was an obsolete (?) script in /etc/profile.d/rvm.sh

Compared to the same script installed by the "any other system" install (the one with curl / bash), this one has the block with
# Load user rvmrc configuration, if exist
moved after the
#Load RVM if it is installed
which attempt to use variables set by the former block. Simply move that block up to line 13.

Not sure if this makes any sense, I'll also try with a screenshot. Simply move the highlighed block up, on line 13, before the # Load RVM if it is installed line.

image

[Edited for clarity, formatting]

@amonea
Copy link

amonea commented Jul 23, 2019

For some reason, /etc/profile.d/rvm.sh is no more automatically loaded.

It is being loaded, but the script itself seems incorrect, as explained in my comment above.

@raelgc
Copy link
Contributor

raelgc commented Jul 23, 2019

@amonea Do you mind to open a pull request with this change?

@ckrailo
Copy link

ckrailo commented Jul 23, 2019

I can test changes to this for y'all in WSL Ubuntu 18.04 this evening, I worked around it a couple days ago by commenting those lines out of the postinst script.

@amonea
Copy link

amonea commented Jul 23, 2019

@raelgc Sure, I will do a PR with this within the next few hours. Thanks!

@amonea
Copy link

amonea commented Jul 23, 2019

@raelgc As far as I can tell, that script is actually generated by a function in the scripts/functions/installer script of the original rvm/rvm repository. There's a commit 14 days ago that introduced this behaviour. I strongly suspect that change in script was wrong. Here's the commit:

rvm/rvm@f070ee0

I am not sure if I can fix anything in this project, until that function in the installer script gets fixed. (unless there is a way to say "use this previous version of the installer file in the package", but I don't know how to do that)

Hope this helps.

@raelgc
Copy link
Contributor

raelgc commented Jul 23, 2019

@amonea This explains why this suddenly started to happen only on this release.

@pkuczynski
Copy link
Member

Apologies, it was my fault. I will revert that change for now. Any suggestion how to fix rvm/rvm#3410?

@pkuczynski pkuczynski changed the title rvm package fails to configure on fresh up to date 18.04 server install RVM package fails to configure on fresh Ubuntu 18.04 server install Jul 23, 2019
@jmarrec
Copy link

jmarrec commented Jul 24, 2019

I just tried agian today sudo apt update && sudo apt install rvm. The installation seems pretty broken, I can't install any rubies due to permissions issues, and trying to remove rvm fails

$ sudo apt remove rvm
[...]
After this operation, 4,426 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 375195 files and directories currently installed.)
Removing rvm (1.29.9-2) ...
bash: rvm: command not found
dpkg: error processing package rvm (--remove):
 installed rvm package pre-removal script subprocess returned error exit status 127
Errors were encountered while processing:
 rvm
E: Sub-process /usr/bin/dpkg returned an error code (1)

I removed everything I could find on my system that related to rvm, did a reboot to ensure my PATH and stuff was clean, and I tried another install:

$ sudo apt install rvm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  rvm
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 947 kB of archives.
After this operation, 4,426 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/rael-gc/rvm/ubuntu bionic/main amd64 rvm all 1.29.9-2 [947 kB]
Fetched 947 kB in 0s (3,838 kB/s)
Selecting previously unselected package rvm.
(Reading database ... 372221 files and directories currently installed.)
Preparing to unpack .../archives/rvm_1.29.9-2_all.deb ...
Unpacking rvm (1.29.9-2) ...
Setting up rvm (1.29.9-2) ...
Creating group 'rvm'
Installing RVM to /usr/share/rvm/
test -f /etc/profile.d/rvm.sh && source /etc/profile.d/rvm.sh
Installation of RVM in /usr/share/rvm/ is almost complete:

  * First you need to logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
  * Please do NOT forget to add your users to the rvm group.
     The installer no longer auto-adds root or users to the rvm group. Admins must do this.
     Also, please note that group memberships are ONLY evaluated at login time.
     This means that users must log out then back in before group membership takes effect!
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: https://opencollective.com/rvm/donate


Creating local gemsets for julien
Upgrading the RVM installation in /usr/share/rvm/
    Can not update 'scripts/extras/completion.zsh/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
    Can not update 'scripts/zsh/Completion/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
touch: cannot touch '/usr/share/rvm/config/displayed-notes.txt': Permission denied
    Found 3 files with mode different than '664' or '775',
use `--debug` to see the list, run `rvmsudo rvm get stable` to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Upgrade of RVM in /usr/share/rvm/ is complete.
touch: cannot touch '/usr/share/rvm/config/displayed-notes.txt': Permission denied

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉  Donate: https://opencollective.com/rvm/donate

I'm not sure what's going on. After another full reboot, the rvm command isn't found, I have to manually source /etc/profile.d/rvm.sh, which wasn't the case on my other 16.04 machine.

After running:

sudo su
source /etc/profile.d/rvm.sh
rvm get latest
exit # return to user shell

It seems I can now do "rvm install ruby-2.5.5" and it works.

@jmarrec
Copy link

jmarrec commented Jul 24, 2019

Ok I see I have the same problem as @amonea, I read his comment too quickly before, but came to the same conclusion.

Not sure if this makes any sense, I'll also try with a screenshot. Simply move the highlighed block up, on line 13, before the # Load RVM if it is installed line.

Simply move that block up to line 12, right after the "then" and before export rvm_stored_umask=$(umask), since umask is stored also in /etc/rvmrc.

@chrishowejones
Copy link

None of these 'fixes' worked for me on Ubuntu 18.04. I still get:

Creating local gemsets for chris
-su: rvm: command not found
dpkg: error processing package rvm (--configure):
 installed rvm package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
 rvm
E: Sub-process /usr/bin/dpkg returned an error code (1)

on install. Before tryin gto install I have completely uninstalled rvm, checked I removed it from all profiles and paths etc. searched my path for any references to it and removed them all.

@amonea
Copy link

amonea commented Jul 24, 2019

None of these 'fixes' worked for me on Ubuntu 18.04. I still get:

If you do not want to edit files manually (and normally you should not have to), install the rpm and then

  1. make sure you are in the 'rvm' group (if not: usermod -a -G rvm chris)
  2. source /etc/rvmrc and /etc/profile.d/rvm.sh (order is important)
. /etc/rvmrc
. /etc/profile.d/rvm.sh

(that is a dot, space, and then the file name in the above commands)

and then attempt to use rvm

@raelgc
Copy link
Contributor

raelgc commented Jul 24, 2019

I just published a new package with the fix provided by RVM.

So, if you're still facing this issue, first uninstall the broken package with:

sudo -s
source /etc/profile.d/rvm.sh
apt-get install -f
apt-get autoremove --purge rvm

If you edited /etc/profile.d/rvm.sh, probably you'll need to remove it and try the above commands again.

Then, update and upgrade:

sudo apt update && sudo apt dist-upgrade
sudo apt install rvm

Check if package version is now 1.29.9-3.

@chrishowejones
Copy link

apt-get autoremove --purge rvm

After following these instructions from @raelgc I get the fo9llowing error:

apt-get autoremove --purge rvm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  rvm*
0 to upgrade, 0 to newly install, 1 to remove and 0 not to upgrade.
After this operation, 4,426 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 659299 files and directories currently installed.)
Removing rvm (1.29.9-3) ...
bash: rvm: command not found
dpkg: error processing package rvm (--remove):
 installed rvm package pre-removal script subprocess returned error exit status 127
Errors were encountered while processing:
 rvm
E: Sub-process /usr/bin/dpkg returned an error code (1)

@raelgc
Copy link
Contributor

raelgc commented Jul 26, 2019

Can someone report if it worked after the latest package update?

@amonea
Copy link

amonea commented Jul 26, 2019

@raelgc -- I have just tested it and everything seems fine. Removed the previous version, double-checked all files and references to rvm were no longer existing, installed the new version and everything worked for me without any issues. (the rvm command was present in the path after logging out and back in, and a test install with rvm install "ruby-2.3.2" worked flawlessly.

Tested on Ubuntu 18.04.2 LTS with all packages up to date.
rmv version: 1.29.9-3

@rakvium
Copy link

rakvium commented Aug 13, 2019

@raelgc it seems like it's still 1.29.9-2 for Ubuntu 18.10. May you please update that package too?

@raelgc
Copy link
Contributor

raelgc commented Aug 13, 2019

@rakvium Sorry, but unfortunately the Launchpad interface don't allow me to start a build for no more supported releases (18.10 ended at July, 18).

@rakvium
Copy link

rakvium commented Aug 13, 2019

@raelgc thank you for the information! Will advise to migrate to a supported release.

@kuzyo
Copy link

kuzyo commented Aug 21, 2019

Getting the same issue @chrishowejones. How i can purge rvm and reinstall ?

@raelgc
Copy link
Contributor

raelgc commented Aug 21, 2019

@kuzyo Please, which Ubuntu version are you using? Which is the package version and output when you try to install?

@kuzyo
Copy link

kuzyo commented Aug 22, 2019

@raelgc I did get this message on Ubuntu 18.04

apt-get autoremove --purge rvm
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED
  rvm*
0 to upgrade, 0 to newly install, 1 to remove and 0 not to upgrade.
After this operation, 4,426 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 659299 files and directories currently installed.)
Removing rvm (1.29.9-3) ...
bash: rvm: command not found
dpkg: error processing package rvm (--remove):
 installed rvm package pre-removal script subprocess returned error exit status 127
Errors were encountered while processing:
 rvm
E: Sub-process /usr/bin/dpkg returned an error code (1)

But after trying several time, i will remove every trace of rvm using this advice https://stackoverflow.com/a/15286533, after that Installation went well for me.
Thanks.

@raelgc
Copy link
Contributor

raelgc commented Aug 22, 2019

@kuzyo Thanks for the feedback with link to the solution. I'm glad you solved!

@slyn4ice
Copy link

I am still having the same problem with behavior exactly as reported by @jmarrec . I am unable to create local gemsets. I can use rvm after logout, but after a complete reboot rvm is no longer found.

Steps to reproduce

sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm

Behaviour

Setting up rvm (1.29.9-3) ...
Creating group 'rvm'
Installing RVM to /usr/share/rvm/
test -f /etc/profile.d/rvm.sh && source /etc/profile.d/rvm.sh
Installation of RVM in /usr/share/rvm/ is almost complete:

  • First you need to logout - login again, anyone using rvm will be operating with umask u=rwx,g=rwx,o=rx.
  • Please do NOT forget to add your users to the rvm group.
    The installer no longer auto-adds root or users to the rvm group. Admins must do this.
    Also, please note that group memberships are ONLY evaluated at login time.
    This means that users must log out then back in before group membership takes effect!
    Thanks for installing RVM 🙏
    Please consider donating to our open collective to help us maintain RVM.

👉 Donate: https://opencollective.com/rvm/donate

Creating local gemsets for [removed-username]
Upgrading the RVM installation in /usr/share/rvm/
Can not update 'scripts/zsh/Completion/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
Can not update 'scripts/extras/completion.zsh/_rvm', it's a conflict between Zsh and multiuser installation, prefix the command with 'rvmsudo' to update this file.
touch: cannot touch '/usr/share/rvm/config/displayed-notes.txt': Permission denied
Found 3 files with mode different than '664' or '775',
use --debug to see the list, run rvmsudo rvm get stable to fix it., prefix the command with 'rvmsudo' to fix it, if the situation persist report a bug.
Upgrade of RVM in /usr/share/rvm/ is complete.
touch: cannot touch '/usr/share/rvm/config/displayed-notes.txt': Permission denied

Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.

👉 Donate: https://opencollective.com/rvm/donate

Processing triggers for install-info (6.5.0.dfsg.1-2) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

Environment

Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic

@slyn4ice
Copy link

Update: Just as I posted this I did a last ditch attempt at the purge rvm/ reinstall rvm process and somehow it worked. I can install ruby. There is something fubar either in the installation process or the provided instructions - not sure which. I purged an reinstalled after complete reboots probably 7-8 times. On the 9th it worked.

@raelgc
Copy link
Contributor

raelgc commented Feb 19, 2020

@slyn4ice I tested the fresh install few days ago on an AWS server, worked fine. Of course I believe you've found issues, so we need to investigate the reasons.

Did you try install rvm before the package? (I mean, using rvm.io?)

@ryudice
Copy link

ryudice commented Mar 29, 2020

this installer is really broken and completely useless, maybe you should reconsider having it as the recommended way to install on ubuntu in the documentation?

@raelgc
Copy link
Contributor

raelgc commented Mar 29, 2020

@ryudice Please, can you provide more details?

@raelgc
Copy link
Contributor

raelgc commented Mar 29, 2020

@ryudice Just to share: in order to investigate, I've downloaded an 18.04.4 and installed in a Virtualbox instance. Rebooted. Worked fine.

I mean: I need more steps and details to try to reproduce your issue.

Feel free to create a new issue reporting your problem. It'll be a pleasure to help.

If you don't want to use this package, you can install rvm as usual: just follow the rvm.io instructions.

@mcgarrah
Copy link

mcgarrah commented Jun 12, 2020

I'm building systems with multiple ruby apps using AWS CloudFormation user-data startup scripts on a current Ubuntu 18.04 LTS.

I've tried variations on the install but it just doesn't work unless I manually do it from a command line and only after a couple attempts. To fix a broken install I can do a "dpkg --configure rvm" as root from a command line to clean up the issues but nothing works for a noninteractive install.

Here is an extract of my UserData startup script from CF.

      UserData: !Base64
          Fn::Join:
            - ''
            - - "#!/bin/bash\n\n"
              - "export DEBIAN_FRONTEND=noninteractive\n"
             - "apt-get -y install software-properties-common\n"
              - "apt-add-repository -y ppa:rael-gc/rvm\n"
              - "apt-get update\n"
              - "DEBIAN_FRONTEND=noninteractive apt-get -y install rvm\n"
              - "DEBIAN_FRONTEND=noninteractive dpkg --configure rvm\n"
              - "\n"
              - "source /etc/profile.d/rvm.sh\n"
              - "rvm requirements\n"
              - "su - rubyuser bash -c \"rvm install 2.4.4\"\n"

This is what the startup script looks like:

#!/bin/bash

export DEBIAN_FRONTEND=noninteractive
apt-get -y install software-properties-common
apt-add-repository -y ppa:rael-gc/rvm
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y install rvm
DEBIAN_FRONTEND=noninteractive dpkg --configure rvm

source /etc/profile.d/rvm.sh
rvm requirements
su - rubyuser bash -c "rvm install 2.4.4"

The repo is the recommended method for install but useless to me since I cannot be done thru automation. I'm guessing this is not important because you can manually fix it and that helps most users.

@martijnhoekstra
Copy link

I don't know what went wrong with my install, but the following led to a working rvm installation for me:

sudo apt-get autoremove --purge rvm
sudo apt-get remove ruby
sudo apt-get install rvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.