I'm always having trouble with RVM installs and non-interactive vs. interactive shell sessions. If the session isn't interactive I'm usually getting the command not found
error on different programs/functions in the RVM/Ruby toolchain (i.e. gem
, rvm
, ruby
etc.). There are three solutions to the issue I'm aware of:
- Add/remove some lines from
.bashrc
for each user. The changes depend on the version of Ubuntu - Typing
bash --login
before working with RVM to get a interactive shell - Changing the 'Run command as login shell' option in gnome-terminal
All those solutions aren't exactly what I'm looking for because I have a couple of hosts with different versions of Ubuntu and for some applications the solutions outlined above don't work (i.e. daemonized Chef configuration management suite). As far as I could trace the problem down this is based on the fact that shell scripts in /etc/profile.d
are only run if the user logs into a interactive shell session. Which seems not to be the case if a daemonized process runs or if I or an application logs in trough ssh.
What I'm basically searching for is a way to unify all different kinds of shell sessions to execute scripts in /etc/profile.d
. Ideally this solution should work for all users that are able to login, and for different versions of Ubuntu (atm in use: 10.4, 11.10). It would also be good if it could be easily be set up using automated scripts or Chef recipes.
As a note: I don't know if not-running scripts in /etc/profile.d
is the sole problem I'm facing, I know tough that doing a bash --login
usually fixes my issues.
Your issue is gnome-terminal not using
--login
for bash by default: https://rvm.io/integration/gnome-terminal/For scripting with RVM choose one of the methods described here: https://rvm.io/integration/cron/
There is more information on user rc files here: https://rvm.io/support/faq/#shell_login