pjd
pjd

Reputation: 1173

rvm problems after changing user name with usermod

I changed my user name, home directory, and group name with the following commands:

usermod -l newname oldname
usermod -d /home/newname -m newname
groupmod -n newname oldname

There was a bit of fallout from making this change, but the (seemingly) final problem is with Ruby, which I installed through rvm. Specifically, none of my Ruby code will run now because various needed resources cannot be located. Example error message:

/home/newname/.rvm/rubies/ruby-2.4.1/bin/ruby: error while loading shared libraries: libruby.so.2.4: cannot open shared object file: No such file or directory

Grepping inside /home/newname/.rvm for oldname, there are many, many (10,000+) results.

Is there a safe way (some rvm command, perhaps) to update all the file paths that are listed inside the various files (e.g., .installed.list has quite a few occurrences of oldname) within my .rvm directory to reflect newname instead of oldname? Or do I just need to uninstall/reinstall everything?

I'm afraid to try fixing this with sed because grep returned results like

Binary file src/ruby-2.4.1/regerror.o matches

but I can't see oldname anywhere inside this binary file. So, I think sed might just put me in a worse position than I am currently in.

I am using Linux Mint 18.3, rvm 1.29.3, and Ruby 2.4.1.

Upvotes: 0

Views: 261

Answers (1)

Keith Bennett
Keith Bennett

Reputation: 4940

I would suggest reinstalling rvm.

You can wipe out your rvm data with rvm implode. Or you could just rename your ~/.rvm directory to another name so rvm can't see it, then install rvm and your rubies.

In any given rvm ruby installation, you might be able to get away with doing a recursive copy of your $GEM_HOME directory to the new location so you don't have to reinstall your gems (or remember which ones to install).

Upvotes: 1

Related Questions