Solaris FAQ
This page tries to cover some FAQ I stumbled over -- either by myself, or by people asking me -- not or badly covered in other mainstream FAQ. Though I might add things you can easily find in other documentation I'll mainly focus on things not mentioned everywhere.
Symlinks for elementary system directories
I received a comment noting that it would be worth mentioning that /lib is a symlink to /usr/lib on many Solaris systems. To be honest, I've never seen it on Solaris. I did it on Linux and BSD for really small systems, but not on any of my Solaris boxes.
I'll try to explain this a bit. It's not an accident that there are some directories (most important /sbin, /bin and /lib) in the root directory. They contain stuff needed to bring the system up. On modern UNIX systems stuff like mount tends to be dynamically linked, so you'll have to put the dynamic libraries needed for running mount -- as well as mount itself, of course -- on the one partition which gets mounted without action from userspace -- the root filesystem.
Now lets put everything from /lib to /usr/lib and create a symlink to /lib and restart the system. Whoops, it did not boot? As a rule of thumb, if you install in separate partitions /usr is one of the first filesystems you put in a separate partition. Therefore you have the stuff needed to mount /usr on -- /usr. Great act.
Now for the `I don't know why I should mention it here' part -- if you're thinking about doing this I assume that you got a pretty good understanding of your system, then you don't need me to write something about it. I think it's a pretty bad idea -- for the reasons mentioned above, for keeping elementary system libraries and fatter userland stuff more separate. Of course there are systems where doing this makes sense -- embedded systems, for example. But, honestly, who would try to do an embedded Solaris?
Configuring the dynamic linker
If you're used to Linux you might be used to add paths where librarys reside to /etc/ld.so.conf and run ldconfig afterwards. Under Solaris there's a similar way to configure paths for the dynamic linker. Please note that it's only slightly better than setting LD_LIBRARY_PATH -- you can break things if you don't know exactly what you're doing.
Configuration files for the dynamic linker reside under /var/ld/. Unlike under Linux you're not meant to edit those with your favourite editor. Simply running crle without arguments will give you something like this:
# crle
Default configuration file (/var/ld/ld.config) not found
Default Library Path (ELF): /lib:/usr/lib (system default)
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)
Now you can add a new path -- for example /usr/local/lib -- with crle -l 'path'. This might look like this:
# crle -l /lib:/usr/lib:/usr/local/lib
# crle
Configuration file [version 4]: /var/ld/ld.config
Default Library Path (ELF): /lib:/usr/lib:/usr/local/lib
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)
Command line:
crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib
Please note that you have to specify all directories you want in the search path unless you use the -u (update) switch:
# crle -l /usr/local/lib -u
# crle
Configuration file [version 4]: /var/ld/ld.config
Default Library Path (ELF): /lib:/usr/lib:/usr/local/lib
Trusted Directories (ELF): /lib/secure:/usr/lib/secure (system default)
Command line:
crle -c /var/ld/ld.config -l /lib:/usr/lib:/usr/local/lib
Setting the default editor
Commands like crontab -e will use ed per default. If you'd like to use some
better editor (like vi) you can use the environment variable EDITOR:
# EDITOR=vi; crontab -e]-
will open the users crontab in vi. Of course you can set this variable permanently.
Copying the VTOC from one drive to another
For creating mirrored drives with md you usually want both drives to use the same VTOC. You can use prtvtoc to display one drives VTOC, and fmthard to update it.
Using the -h parameter for prtvtoc to skip outputting headers and the -s parameter for fmthard to specify a datafile we can combine those two commands to directly copy the VTOC from one drive to another:
# prtvtoc -h /dev/dsk/c1t0d0s2 | fmthard -s - /dev/rdsk/c1t1d0s2
Setting a default keymap for X11
Problem with keymaps under Solaris/SPARC: Which keymap to use gets told by the hardware, the user is given no choice of selecting another keymap. For X11 is quite easy to use a different keymap once loggedin -- loading an appropriate file using xmodmap.
At first create the directory /etc/dt. Copy all the files you want to modify from /usr/dt/config to /etc/dt. For our keymap tweaking we only need Xsetup, and a keymap file (like dvorak.sun). Now just put the following line at the very end of Xsetup:
/usr/openwin/bin/xmodmap /etc/dt/config/dvorak.sun