[Beowulf] Confusion about login, non-interactive, interactive shells
Jonathan Barber
jonathan.barber at gmail.com
Wed Sep 26 02:35:51 PDT 2012
On 26 September 2012 09:49, Jörg Saßmannshausen
<j.sassmannshausen at ucl.ac.uk> wrote:
> Dear all,
>
> whilst I was debugging a MPI problem the other night, I got highly frustrated
> that the program could not find the orted command despite being in the PATH.
>
> A bit of further digging lead to these observations:
>
> $ ssh node4 env | grep PATH
> PATH=/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
This runs the "env" command on node4, and then greps the output.
> $ ssh node4 echo $PATH
> /home/sassy/bin:/usr/local/sge6.2u5/bin/lx24-
> amd64:/opt/openmpi/gfortran/1.4.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sod/exe
This doesn't return the $PATH on node4. The $PATH will be expanded by
your shell before executing the command, so you're actually running
the command:
$ ssh node4 echo
/home/sassy/bin:/usr/local/sge6.2u5/bin/lx24-amd64:/opt/openmpi/gfortran/1.4.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sod/exe
To stop this you need to stop the shell from interpreting the variable
via quoting (with single quotes!):
$ ssh node4 'echo $PATH'
or:
$ ssh node4 echo \$PATH
> $ ssh node4 which mpirun
> $
So mpirun isn't in your $PATH on node4.
> $ ssh node4 echo $PATH; which mpirun
> /home/sassy/bin:/usr/local/sge6.2u5/bin/lx24-
> amd64:/opt/openmpi/gfortran/1.4.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sod/exe
> /opt/openmpi/gfortran/1.4.5/bin/mpirun
Ditto WRT $PATH expansion above. You're effectively running (on the local host):
$ echo $PATH
$ which mpirun
> What I cannot work out is:
> a) where does the :/usr/bin/X11 come from? I done a grep in /etc and I could
> not find it (but for the PAM but that was commented out)
I don't know of the top of my head, and I don't have access to a
debian system with X installed, but I'd guess it's probably one of the
files under /etc/profiles.d or (if your using bash) one of
~/.bash{rc,_profile}.
Check out the INVOCATION section of the bash man page to find all of
the places it could be hiding.
> b) how come there is a difference between echo $PATH and which mpirun ? It
> appears to me that there are different processes involved here which give
> different answers. My question is why?
--
Jonathan Barber <jonathan.barber at gmail.com>
More information about the Beowulf
mailing list