rvm / ubuntu_rvm

Ubuntu package for RVM
https://launchpad.net/~rael-gc/+archive/ubuntu/rvm
Apache License 2.0
694 stars 84 forks source link

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

Closed sakego closed 5 years ago

sakego commented 5 years ago

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.

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 commented 5 years ago

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 commented 5 years ago

@sakego Had you tried to install rvm previously?

sakego commented 5 years ago

@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 commented 5 years ago

Same issue in Ubuntu for WSL (18.04.2).

azatdev commented 5 years ago

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 commented 5 years ago

I'm investigating this right now.

raelgc commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

SuperSandro2000 commented 5 years ago

Installs without errors on 19.04.

raelgc commented 5 years ago

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

amonea commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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

ckrailo commented 5 years ago

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 commented 5 years ago

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

amonea commented 5 years ago

@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:

https://github.com/rvm/rvm/commit/f070ee007bd1c7bbc5fec22d033464a5452cdcbd

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 commented 5 years ago

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

pkuczynski commented 5 years ago

Apologies, it was my fault. I will revert that change for now. Any suggestion how to fix https://github.com/rvm/rvm/issues/3410?

jmarrec commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago
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 commented 5 years ago

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

amonea commented 5 years ago

@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 commented 5 years ago

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

raelgc commented 5 years ago

@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 commented 5 years ago

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

kuzyo commented 5 years ago

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

raelgc commented 5 years ago

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

kuzyo commented 5 years ago

@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 commented 5 years ago

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

slyn4ice commented 4 years ago

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:

👉 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 commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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 commented 4 years ago

@ryudice Please, can you provide more details?

raelgc commented 4 years ago

@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 commented 4 years ago

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 commented 3 years ago

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