Bug 1894870
| Summary: | "module: command not found" when running shell script with non-login shell | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Dennixx <voetelink> |
| Component: | environment-modules | Assignee: | Lukáš Zaoral <lzaoral> |
| Status: | CLOSED ERRATA | QA Contact: | Vojtech Eichler <veichler> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 8.3 | CC: | byodlows, lzaoral, veichler, voetelink, xavier.delaruelle |
| Target Milestone: | rc | Flags: | pm-rhel:
mirror+
|
| Target Release: | 8.0 | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | environment-modules-4.5.2-2.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-11-08 10:52:59 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
Dennixx
2020-11-05 10:26:24 UTC
I suspect that this issue is due to the disablement of the `set_shell_startup` configuration which is now the default with this environment-modules update. When `set_shell_startup` configuration is enabled, `ENV` and `BASH_ENV` environment variables are defined when module command is initialized to ensure module initialization script is run every-time a subshell is spawned. `set_shell_startup` has been disabled by default as it is not desired to run such script every-time a subshell is spawned unless if it is specifically wanted. You have the ability to enable this configuration by adding the following line to module's initialization configuration file (/etc/environment-modules/initrc) module config set_shell_startup 1 After restarting your environment, you should recover the behavior you got on previous module version (v4.1.4). Thanks for your response Xavier I added the line to the initrc file as you mentioned, and this made no difference, even after a new login session (or even reboot of the system). Also when I run 'module config' the set_shell_startup option is still 0 So I set it manually by running 'module config set_shell_startup 1', but the bash testscript still returns the same error. Only after manually sourcing /etc/profile.d/modules.csh the testscript runs correctly. So it seems you are on to something here, but the config probably has to be done somewhere else. /etc/environment-modules/initrc is not evaluated if another configuration file is on the way. If /etc/environment-modules/modulespath or /usr/share/Modules/init/.modulespath exist and define some modulepath the /etc/environment-modules/initrc configuration will not be processed. The modulepath defined in those "modulespath" configuration file should set in /etc/environment-modules/initrc, then /etc/environment-modules/modulespath and /usr/share/Modules/init/.modulespath should be removed. This way /etc/environment-modules/initrc will be evaluated and you should get the set_shell_startup option enabled. Yes the /etc/environment-modules/modulespath file exists. However since it is part of the rpm file, removing it isn't really an option since the next rpm update will just return it. However I commented out the line in the modulespath file (since all paths are already appended in initrc) and that seems to work. So concluding, to get this working: - add "module config set_shell_startup 1" to /etc/environment-modules/initrc - Comment out all lines in /etc/environment-modules/modulespath This is a possibility, but a bit of a hack tbh Is there any update on this issue? Is there a proper solution in the making? Or is this hack something we have to live with? Thanks On the upstream side, version 5.0.0 was released in September with this specific point in mind. The following change was made: "When initializing Modules, evaluate the initrc configuration file in addition to the the modulespath configuration file and not instead of this file. initrc is evaluated after modulespath file." Hello, my apologies for a late reply. Would a backport of the change from 5.0.0 mentioned by Xavier in Comment 8 be sufficient? Thus, with this change you will only have to add "module config set_shell_startup 1" to /etc/environment-modules/initrc and /etc/environment-modules/modulespath will not need to be modified at all. Thank you! Lukas Yes that would be a sufficient solution, thanks! Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (environment-modules bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:7754 |