0

I am on a new debian 11 box need to reinstall ruby 2.7 because the configuration is borked. Ruby and bash aren't playing nice to recognize my executable folder. The bash terminal isn't recognizing ruby gem aliases despite following the advice in the aforementioned stack overflow post. So I've decided to just uninstall and reinstall ruby itself, and this time around manage everything with rvm.

I ran an internal ruby uninstall the individual gem command itself using instructions from this post Uninstalling Ruby gems.

Then I ranapt-get remove --purge ruby ruby-dev but my ruby folders (such as /var/lib/gems/ and /usr/lib/ruby) and all of their contents, including installed gems, are still there!

lo and behold it hasn't been uninstalled after all! at least not in the way that i need to be. what can i do moving forward to remedy this issue?

EDIT : I remembered later that I had attempted just simply uninstalling the individual gem from my existing ruby installation. with $> sudo gem uninstall gemname -i /var/lib/gems/2.7.0/

i believe the problem lies in hanging or conflicting configuration files. due to the difference in the file locations when executing from a user or sudo environment.

Andrew
  • 737
  • 2
  • 8
  • 24
  • 1
    If you're unable to explain exactly how you got into this situation, for example by looking at your shell history and posting it here, then it's incredibly difficult to tell you how to get out of it. We have no way of knowing what commands you ran and whether you used them with sudo or without. If it's a newly installed Debian server then wipe and start from scratch. – anothermh Jan 26 '23 at 23:36
  • `/var/lib/gems/` is not a directory directly handled by ruby package (ruby should have `/var/lib/ruby`). The same: `/usr/lib/ruby` can be used by other packages so it will not be purged. And do no remove it, if you do not know what you are doing. The package `ruby` is only one which can access to that directory, so the package should never remove files installed from others. – Giacomo Catenazzi Jan 27 '23 at 10:51
  • @anothermh that's the worst advice i've ever seen on stack overflow. you're suggesting that i wipe my entire system because of faulty aliasing on a non-system-essential package. what if the system weren't relatively new? – Andrew Jan 29 '23 at 13:09
  • https://dontusesystemruby.com/#/ – Andrew Jan 29 '23 at 13:31
  • I’m glad that you found my website’s advice useful. The advice I gave there is that you shouldn’t mess with system Ruby. The advice I’m giving here is that if you’ve messed with it in ways you can’t explain or reverse, especially if you’ve used sudo, then the OS may be damaged and the safe course of action is to wipe and reinstall. You can choose to take my advice or leave it, but it seems like you value it enough to leave it as the answer to your own question. – anothermh Jan 29 '23 at 23:53

1 Answers1

0

According to https://dontusesystemruby.com/#/ unless you're building a docker image you should not be using pre-installed system ruby or ruby installed from the default package manager. This site (https://dontusesystemruby.com/#/) gives myriad reasons for using rvm.

answer: install and compile ruby yourself with rvm. get it through curl with a gpg key from the mit keyserver (the others appear to be down). then reload the bashrc with . .bashrc

Andrew
  • 737
  • 2
  • 8
  • 24