Solaris 11 Changes: Where is /usr/ucb ?

Submitted by Stefan Schneider on Thu, 01/20/2011 - 16:43

Solaris 11 Express as a predecessor to Solaris 11 ist out and a few things changed and improved...

The directory /usr/ucb isn't there anymore ...

The usage of the BSD commands in /usr/ucb has always been discouraged. The BSD commands have been provided as a backwards compatibility option for SunOS 4.1. People used them in Solaris 2 since they had interesting features. It has never been a good idea to rely on them in Solaris 2

The problem: /usr/ucb isn't available in the standard Solaris 11 (Express) installation!

The solution: Install an optionally available package with the following command to get them:

$ pkg add compatibility/ucb

You'll get the following commands after the installation:

sschneid@scalingbits:~$ ls -l /usr/ucb
total 433
drwxr-xr-x 2 root bin 3 2011-01-20 13:46 amd64
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 arch -> ../bin/arch
-rwxr-xr-x 1 root bin 7916 2011-01-20 13:46 basename
-rwxr-xr-x 1 root bin 8156 2011-01-20 13:46 biff
-rwxr-xr-x 1 root bin 13072 2011-01-20 13:46 chown
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 clear -> ../bin/clear
-rwxr-xr-x 1 root bin 1417 2011-01-20 13:46 df
-rwxr-xr-x 1 root bin 969 2011-01-20 13:46 du
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 e -> ../bin/edit
-rwxr-xr-x 1 root bin 7908 2011-01-20 13:46 echo
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 edit -> ../bin/edit
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 ex -> ../bin/edit
-rwxr-xr-x 1 root bin 22912 2011-01-20 13:46 expr
-r-xr-xr-x 1 root bin 1397 2011-01-20 13:46 fastboot
-r-xr-xr-x 1 root bin 1394 2011-01-20 13:46 fasthalt
-r-xr-xr-x 1 root bin 1412 2011-01-20 13:46 file
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 finger -> ../bin/finger
lrwxrwxrwx 1 root root 10 2011-01-20 13:46 fmt -> ../bin/fmt
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 fold -> ../bin/fold
-rwxr-xr-x 1 root bin 12704 2011-01-20 13:46 from
lrwxrwxrwx 1 root root 10 2011-01-20 13:46 ftp -> ../bin/ftp
-rwxr-xr-x 1 root bin 12640 2011-01-20 13:46 groups
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 head -> ../bin/head
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 hostid -> ../bin/hostid
lrwxrwxrwx 1 root root 15 2011-01-20 13:46 hostname -> ../bin/hostname
drwxr-xr-x 2 root bin 3 2011-01-20 13:46 i86
-rwxr-xr-x 1 root bin 17196 2011-01-20 13:46 install
-rwxr-xr-x 1 root bin 12508 2011-01-20 13:46 ln
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 logger -> ../bin/logger
-rwxr-xr-x 1 root bin 18732 2011-01-20 13:46 ls
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 mach -> ../bin/mach
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 mail -> ../bin/mailx
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 Mail -> ../bin/mailx
-r-xr-xr-x 1 root bin 13124 2011-01-20 13:46 mkstr
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 more -> ../bin/more
lrwxrwxrwx 1 root root 14 2011-01-20 13:46 netstat -> ../bin/netstat
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 page -> ../bin/more
lrwxrwxrwx 1 root root 15 2011-01-20 13:46 pagesize -> ../bin/pagesize
-rwxr-xr-x 1 root bin 7940 2011-01-20 13:46 printenv
-r-xr-xr-x 83 root bin 8420 2010-11-05 16:02 ps
lrwxrwxrwx 1 root root 19 2011-01-20 13:46 quota -> ../lib/fs/ufs/quota
lrwxrwxrwx 1 root root 10 2011-01-20 13:46 rcp -> ../bin/rcp
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 rdate -> ../bin/rdate
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 rdist -> ../bin/rdist
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 renice -> ../bin/renice
lrwxrwxrwx 1 root root 6 2011-01-20 13:46 reset -> ./tset
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 rlogin -> ../bin/rlogin
lrwxrwxrwx 1 root root 10 2011-01-20 13:46 rsh -> ../bin/rsh
lrwxrwxrwx 1 root root 14 2011-01-20 13:46 ruptime -> ../bin/ruptime
-rwxr-xr-x 1 root bin 12344 2011-01-20 13:46 rusage
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 rwho -> ../bin/rwho
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 script -> ../bin/script
-r-xr-xr-x 1 root bin 32632 2011-01-20 13:46 sed
-rwxr-xr-x 1 root bin 24724 2011-01-20 13:46 shutdown
-rwxr-xr-x 1 root bin 35444 2011-01-20 13:46 stty
-rwxr-xr-x 1 root bin 8144 2011-01-20 13:46 sum
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 tail -> ../bin/tail
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 talk -> ../bin/talk
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 tcopy -> ../bin/tcopy
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 telnet -> ../bin/telnet
-rwxr-xr-x 1 root bin 12812 2011-01-20 13:46 test
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 tftp -> ../bin/tftp
-rwxr-xr-x 1 root bin 12832 2011-01-20 13:46 touch
-rwxr-xr-x 1 root bin 12328 2011-01-20 13:46 tr
-rwxr-xr-x 1 root bin 24084 2011-01-20 13:46 tset
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 uptime -> ../bin/uptime
-rwxr-xr-x 1 root bin 8500 2011-01-20 13:46 users
lrwxrwxrwx 1 root root 15 2011-01-20 13:46 vacation -> ../bin/vacation
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 vedit -> ../bin/vedit
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 vi -> ../bin/edit
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 view -> ../bin/edit
-r-xr-xr-x 1 root bin 17396 2011-01-20 13:46 vipw
lrwxrwxrwx 1 root root 13 2011-01-20 13:46 vmstat -> ../bin/vmstat
lrwxrwxrwx 1 root root 8 2011-01-20 13:46 w -> ../bin/w
lrwxrwxrwx 1 root root 9 2011-01-20 13:46 wc -> ../bin/wc
-rwxr-xr-x 1 root bin 14512 2011-01-20 13:46 whereis
-rwxr-xr-x 1 root bin 8052 2011-01-20 13:46 whoami
lrwxrwxrwx 1 root root 12 2011-01-20 13:46 whois -> ../bin/whois
lrwxrwxrwx 1 root root 11 2011-01-20 13:46 xstr -> ../bin/xstr

The listing shows that many commands are soft links to their equivalent commands in /usr/bin.

Scripts with hard coded /usr/ucb commands should still work in Solaris 11 Express as they did in Solaris 10 as long as the optional package gets installed. The binaries seem to be smart binaries like the ps command. It behaves like a /usr/ucb/ps command if it is being callled with a full path or without a leading "-" in the option clause.

Conclusions

  • Avoid using /usr/ucb commands in Solaris 2 systems whenever possible
  • Install the compatibility/ucb package from Solaris 11 Express if absolutely needed.
  • Be aware that a number of Solaris commands got folded into a single one which is leading to a polymorphic behavior
  • Advantages of NOT having /usr/ucb installed
    • fewer packages and files
    • fewer needs for upgrades and patching
    • fewer security vulnerabilities due to fewer files and commands installed on the system