I have a Red Hat Enterprise Linux Server release 6.5 (Santiago) machine. When ever I try to switch user from root, I get the following error:
[root@server ~]# su - test1
/app/modules/0/bin/modulecmd: error while loading shared libraries: libtcl.so.0: cannot open shared object file: No such file or directory
/app/modules/0/bin/modulecmd: error while loading shared libraries: libtcl.so.0: cannot open shared object file: No such file or directory
server [3:03pm] [/home/test1] -> exit
My guess is that something the PAM stack on your host is excuting modulecmd (a tcl program) and that it has a depending on a library name that is "off" from the the library you have installed. I would check with your systems administrator.
Either that or you need a 'ld' linker supporting variable like $LD_LIBRARY_PATH or $LD_RUN_PATH or $DT_RUNPATH updated to point also to the dir where your lib resides. See man ld:
-rpath=dir
Add a directory to the runtime library search path. This is used when linking an ELF
executable with shared objects. All -rpath arguments are concatenated and passed to
the runtime linker, which uses them to locate shared objects at runtime. The -rpath
option is also used when locating shared objects which are needed by shared objects
explicitly included in the link; see the description of the -rpath-link option. If
-rpath is not used when linking an ELF executable, the contents of the environment
variable "LD_RUN_PATH" will be used if it is defined.
The -rpath option may also be used on SunOS. By default, on SunOS, the linker will
form a runtime search patch out of all the -L options it is given. If a -rpath option
is used, the runtime search path will be formed exclusively using the -rpath options,
ignoring the -L options. This can be useful when using gcc, which adds many -L
options which may be on NFS mounted file systems.
For compatibility with other ELF linkers, if the -R option is followed by a directory
name, rather than a file name, it is treated as the -rpath option.
-rpath-link=dir
When using ELF or SunOS, one shared library may require another. This happens when an
"ld -shared" link includes a shared library as one of the input files.
When the linker encounters such a dependency when doing a non-shared, non-relocatable
link, it will automatically try to locate the required shared library and include it
in the link, if it is not included explicitly. In such a case, the -rpath-link option
specifies the first set of directories to search. The -rpath-link option may specify
a sequence of directory names either by specifying a list of names separated by
colons, or by appearing multiple times.
This option should be used with caution as it overrides the search path that may have
been hard compiled into a shared library. In such a case it is possible to use
unintentionally a different search path than the runtime linker would do.
The linker uses the following search paths to locate required shared libraries:
1. Any directories specified by -rpath-link options.
2. Any directories specified by -rpath options. The difference between -rpath and
-rpath-link is that directories specified by -rpath options are included in the
executable and used at runtime, whereas the -rpath-link option is only effective
at link time. Searching -rpath in this way is only supported by native linkers and
cross linkers which have been configured with the --with-sysroot option.
3. On an ELF system, for native linkers, if the -rpath and -rpath-link options were
not used, search the contents of the environment variable "LD_RUN_PATH".
4. On SunOS, if the -rpath option was not used, search any directories specified
using -L options.
5. For a native linker, the search the contents of the environment variable
"LD_LIBRARY_PATH".
6. For a native ELF linker, the directories in "DT_RUNPATH" or "DT_RPATH" of a shared
library are searched for shared libraries needed by it. The "DT_RPATH" entries are
ignored if "DT_RUNPATH" entries exist.
7. The default directories, normally /lib and /usr/lib.
8. For a native linker on an ELF system, if the file /etc/ld.so.conf exists, the list
of directories found in that file.
If the required shared library is not found, the linker will issue a warning and
continue with the link.