we are running Deadline 10.0.12.1 on a renderfarm based on Centos 6.
We are using the Rendering Jobs as User configuration with the following options:
Use su instead of sudo
Simulate Login
Preserve Environment
We encountered two problems:
su complains that the Simulate login and Preserve environment options are mutually exclusive and that the Preserve environment option will be ignored.
The sandboxed process which is created to render doesn’t contain the expected login environment: USER, HOME, etc.
The second problem is important for us because we have some bash wrapper script which needs information about the user, including name and home folder, that is not running properly.
Running su --login in a bash terminal is correctly creating the necessary environment.
How can we get the corrected environment created in the sandboxed process?
That feature doesn’t affect the sandbox, but will affect the program the sandbox starts. Essentially what we’re doing is running the “Full command” you see in the log through su.
It’s possible to pull the username as “DEADLINE_USER”, but it’s also possible to emulate the feature yourself by modifying the command that we try and start up. I’ve asked the dev team where the docs for that are as I’m not able to find it at the moment.
thank you very much for your quick reply. I understand your suggestion, but I would like to understand if I am correctly guessing the process:
I suppose that su --login is called with the DEADLINE_USER value when the sandboxed process is launched.
The su documentation states that the --login option “make the shell a login shell, clears all envvars except for TERM, initializes HOME, SHELL, USER, LOGNAME and PATH”. So I would expect that the environment inside the sandboxed process contains HOME and USER, but after my test it doesn’t. Where am I wrong?
How are you testing for the environment variables? I may be wrong in how su is passing variables over.
It should be possible to pull not only the environment but also the flags passed to su by using the ‘/proc/[pid]/environ’ as well as ‘/proc/[pid]/cmdline’ files for the process id of the su command. You should be able to find that by running ps -ef | grep su on the command line.