Today I upgraded from Ubuntu 16.04 to 18.04 to 20.04
After Login I get the error
Error found when loading /etc/profile:
/etc/profile.d/modules.sh: line 6: usr/share/modules/init/sh: no such file or dicrectory
As a result the session will not be configured correctly.
You should fix the problem as soon as feasible
The code in etc/profile.d/modules.sh
is:
shell=$(/usr/bin/basename $(/bin/ps -p $$ -ocomm=))
if [ -f /usr/share/modules/init/$shell ]; then
. /usr/share/modules/init/$shell
else
. /usr/share/modules/init/sh
fi
But
The path /usr/share/modules
does not exist
How to adapt the script?
I did a fresh install of ubuntu 20.04 on VirtualBox and noticed that the file
etc/profile.d/modules.sh
does not exist in a fresh installation.So I renamed the file
etc/profile.d/modules.sh
toetc/profile.d/modules.sh.ubuntu16.04
in order not to be executed(pattern
/etc/profile.d/*.sh
within the/etc/profile
does not match any more)After that the error message does not appear any more.
Delete it
The
/etc/profile.d/modules.sh
script is a remnant of previous Ubuntu LTS releases. It may safely be deleted.After doing so, the error message will no longer appear.