Setting default $PATH for openPBS jobs

Hello,

I have a question about how environment variables are set when running pbs jobs with openPBS. On one of my clusters it seems that my $PATH and $LD_LIBRARY_PATH are set correctly on the nodes, but are not available when I run a job with PBS.

On this cluster, my .pbs file is able to run at the command line after sshing to a compute node, but it will not run when I submit with qsub from the head node because the job cannot find the correct library. Upon further examination, I found that the $PATH and $LD_LIBRARY_PATH variables have different values when I echo them from a compute node terminal vs. outputting the values of those variables from a running pbs job.

My question is: how does openPBS set the $PATH and $LD_LIBRARY_PATH variables for pbs jobs? I understand that I can set these values manually within my .pbs file or pass them with ‘qsub -v’ but I would like to understand where to configure the default values or where PBS pulls them from (mostly for standardization across my clusters). Did I miss something during openPBS configuration to specify these?

Thank you,
Eric

Please try this, on one of the nodes of your cluster , say node01

  1. ssh root@node01 and edit /etc/profile and add the below line to the end of the file
    export TEST=/bin/false

  2. as a user run a interactive job as below
    qsub -I -l select=1:ncpus=1:host=node01
    [qsub capital I for icecream -l (for lotus) select=1:ncpus=1:host=node01]
    you get a prompt on that node (node01)
    echo $TEST

Hi adarsh,
Thank you for the response. This cluster passes the test you described: from an interactive job on the node, <<echo $TEST>> output is <</bin/false>>.
So it seems that /etc/profile is executed when I login to the nodes. I also see no differences between /etc/profile on this cluster vs. a properly working cluster (LD_LIBRARY_PATH set correctly) or on the node versions of /etc/profile on the two clusters. Any other ideas?

Thanks,
Eric

Thank you Eric on the interactive job / login - spot on

You can use the pbs_environment file as well
a. source /etc/pbs.conf ; edit $PBS_HOME/pbs_environment and set the variables and restart the pbs services on the compute node
Refer : 8.9 Paths and Environment Variables in the https://www.altair.com/pdfs/pbsworks/PBSAdminGuide2021.1.pdf

b. if you have common home directory across the cluster, then the .bashrc would also help , if the variables are populated there

c. some users also use module load ( to change the enviorment )