Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tons of environment variables #53

Open
fnikolai opened this issue Dec 22, 2022 · 1 comment
Open

tons of environment variables #53

fnikolai opened this issue Dec 22, 2022 · 1 comment

Comments

@fnikolai
Copy link
Member

HPK generates tons of environmental variables.

In Docker:

SHLVL=1
TERM=xterm
_=/usr/bin/env
K_MPI_JOB_ROLE=worker

HOME=/root
HOSTNAME=pi-worker-0
PWD=/home/mpiuser
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

KUBERNETES_PORT_443_TCP_ADDR=10.152.183.1
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP=tcp://10.152.183.1:443
KUBERNETES_PORT=tcp://10.152.183.1:443
KUBERNETES_SERVICE_HOST=10.152.183.1
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_PORT_HTTPS=443

In HPK (Manually grouped):

K_MPI_JOB_ROLE=worker
IFS=
LANG=C
LOGNAME=mpiuser
OPTIND=1
SHELL=/bin/sh
TERM=screen-256color
USER=mpiuser
PROMPT_COMMAND=PS1="Apptainer> "; unset PROMPT_COMMAND
PS1=Apptainer>

PWD=/root
HOME=/home/mpiuser
LD_LIBRARY_PATH=:/.singularity.d/libs
LD_PRELOAD=/.singularity.d/libs/libfakeroot.so
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

APPTAINER_APPNAME=
APPTAINER_BIND=/home/mpiuser/.ssh,.hpk/default/pi-worker-0/.virtualenv/kube-api-access-688cm:/home/mpiuser/.ssh,.hpk/default/pi-worker-0/.virtualenv/kube-api-access-688cm:/var/run/secrets/kubernetes.io/serviceao
APPTAINER_COMMAND=exec
APPTAINER_CONTAINER=/root/.apptainer/cache/oci-tmp/87bb28d964b0c1fc28438552e85e7a6236060cba31ac1996bc3b9376e1855a79
APPTAINER_ENVIRONMENT=/.singularity.d/env/91-environment.sh
APPTAINER_NAME=87bb28d964b0c1fc28438552e85e7a6236060cba31ac1996bc3b9376e1855a79
APPTAINER_NO_EVAL=1

FAKED_MODE=unknown-is-root
FAKEROOTDONTTRYCHOWN=1
FAKEROOTEGID=1000
FAKEROOTEUID=1000
FAKEROOTFGID=1000
FAKEROOTFUID=1000
FAKEROOTGID=1000
FAKEROOTKEY=674349507
FAKEROOTSGID=1000
FAKEROOTSUID=1000
FAKEROOTUID=1000

KUBERNETES_PORT_443_TCP_ADDR=10.244.5.56
KUBERNETES_PORT_443_TCP_PORT=443
KUBERNETES_PORT_443_TCP_PROTO=tcp
KUBERNETES_PORT_443_TCP=tcp://10.244.5.56:443
KUBERNETES_PORT=tcp://10.244.5.56:443
KUBERNETES_SERVICE_HOST=10.244.5.56
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_PORT_HTTPS=443

SINGULARITY_BIND=/home/mpiuser/.ssh,.hpk/default/pi-worker-0/.virtualenv/kube-api-access-688cm:/home/mpiuser/.ssh,.hpk/default/pi-worker-0/.virtualenv/kube-api-access-688cm:/var/run/secrets/kubernetes.io/servico
SINGULARITY_CONTAINER=/root/.apptainer/cache/oci-tmp/87bb28d964b0c1fc28438552e85e7a6236060cba31ac1996bc3b9376e1855a79
SINGULARITY_ENVIRONMENT=/.singularity.d/env/91-environment.sh
SINGULARITY_NAME=87bb28d964b0c1fc28438552e85e7a6236060cba31ac1996bc3b9376e1855a79
SINGULARITY_NO_EVAL=1
@fnikolai
Copy link
Member Author

When running with runuser it needs the --login flag.

-, -l, --login
           Start the shell as a login shell with an environment similar
           to a real login:

           •   clears all the environment variables except for TERM and
               variables specified by --whitelist-environment

           •   initializes the environment variables HOME, SHELL, USER,
               LOGNAME, and PATH

           •   changes to the target user’s home directory

           •   sets argv[0] of the shell to '-' in order to make the
               shell a login shell

If we do so, the env variables become:

TERM=screen-256color
USER=mpiuser
HOME=/home/mpiuser
LOGNAME=mpiuser 
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SHELL=/bin/sh   
PWD=/home/mpiuser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant