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

Handle unset MANPATH more gracefully to avoid overwriting system man pages #758

Open
Amrithasuresh opened this issue Mar 27, 2025 · 1 comment

Comments

@Amrithasuresh
Copy link

Hi Lmod team,

I recently contributed a fix a bug where many module files unintentionally override the system MANPATH openhpc/ohpc#2095. I was redirected here to start a conversation about this issue. I'm new to these repositories, so I’d really appreciate any guidance or pointers on how I can contribute effectively.

The issue

This is my understanding. In Rocky Linux 9, the MANPATH environment variable is not set by default.

When Lmod loads a module that includes a line like:

prepend-path MANPATH /opt/moduleX/share/man

it replaces the MANPATH entirely — making man pages like man bash, man ls, etc., disappear unless a colon prefix is manually added:

prepend-path MANPATH :/opt/moduleX/share/man

@rtmclay
Copy link
Member

rtmclay commented Mar 27, 2025

This issue is handled by the Lmod startup scripts. Your system needs to have the following. This is found lmod/profile

  #
  # If MANPATH is empty, Lmod is adding a trailing ":" so that
  # the system MANPATH will be found
  if [ -z "${MANPATH:-}" ]; then
    export MANPATH=:
  fi

As this is discussed in the lmod documentation: https://lmod.readthedocs.io/en/latest/030_installing.html

On this web page the documentation recommends that sites do:

ln -s /opt/apps/lmod/lmod/init/profile        /etc/profile.d/z00_lmod.sh

Where /opt/apps/lmod/lmod is where Lmod is installed.

It looks like your installation of openhpc has issues. You should look at how Lmod is installed on your system and that the lmod/profile is linked to /etc/profile.d.

Also since you are on a Rocky 9 system, you much have

if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

at the top of your ~/.bashrc. This guarantees that the system bashrc is source in interactive non-login shells.

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

2 participants