Thursday, August 26, 2010

solaris10 your environment is gone. say what?

What do you do if someone decides to run crle and boofs your Solaris system's runtime environment?

Easy!

First, here's a nice write up of crle...
To configure runtime linking environment in Sun Solaris:

# crle [-64] [-a name] [-c conf] [-e env] [-E env] [-f flags] [-i name] [-I name] [-g name] [-G name] [-l dir] [-o dir] [-s dir] [-t [ ELF | AOUT] ] [-u] [-v]

Example to update a new default search path for ELF objects:

# crle -u -l /local/lib

Example to create a new default search path and new trusted directory for ELF objects:

# crle -l /local/lib -l /usr/lib -s /local/lib

Example to display search path:

# crle

Example of creation of a directory cache for ELF objects:

# crle -i /usr/dt/lib -i /usr/openwin/lib -i /usr/lib -c config

Example for creation of an alternative object cache for an ELF executable:

# crle -c /local/$HOST/.xterm/ld.config.xterm -f RTLD_REL_ALL -G /usr/openwin/bin/xterm

# ln -s /local/$HOST/.xterm/xterm /local/$HOST/xterm
# ldd /usr/local/$HOST/xterm

Example for setting replaceable and permanent environment variables:

# crle -e LD_LIBRARY_PATH=/local/lib -E LD_PRELOAD=preload.so.1

Here's the fix:

* Boot into Single User Maintenance Mode off of the install media. 
* cd into /var/ld
* remove ld.config
* Once the system is live, advise someone to update crle (crle -u -l) and not create a brand new link (crle -l)

No comments: