News, tips, partners, and perspectives for the Oracle Solaris operating system

Preparing for the Upcoming Removal of UCB Utilities from the Next Version of Solaris

Eric Reid
Principal Software Engineer

(Note: Edited after errata noted and suggestions made by the Solaris team)

For those of you who are holding on to the /usr/ucb commands as a
last vestige of Solaris's origins in the UC Berkeley UNIX
distribution, it's time to act. The long-anticipated demise of the
/usr/ucb and /usr/ucblib directories is planned for the next major
version of Solaris. If you are building software that uses these
components, now's the time to switch to alternatives.  Shell scripts
are often used during software installation and configuration, so
dependency on /usr/ucb commands could stop your app from installing

If you don't know if your software package depends on the commands
or libraries in these directories, here's a simple heuristic:  if
you're not requiring Solaris 11 users to run "pkg install ucb"
that means you're not using ucb command or libraries, and you can
skip the rest of this writeup.

If you're still reading, perform these checks:

  • Do you explicitly add /usr/ucb in the PATH for your shell
    commands, so that you get the /usr/ucb versions of commands
    instead of the /usr/bin?
  • Do any shell scripts use /usr/ucb in PATH variables or
    explicit command paths?
  • Do any system() or exec*() calls in your application use

You can go to the top level directory of your software, either your
build tree or your distribution and run:

    # find ./ \( -type f -a -print -a -exec strings '{}' \; \) |

    nawk '/^\.\// {file =  $0; first = 1}; /usr\/ucb/ {if (first)
{print "FILE:", file; first = 0}; print "\t" $0}'

This shell code will print out any files with strings containing
"usr/ucb", so it catches /usr/ucb and /usr/ucblib. Here's the output
from running it in a test directory:

FILE:  ./mywd/Makefile
                  INSTALL = /usr/ucb/install
FILE:  ./d.ksh
            /usr/ucb/date -r $seconds $format
FILE:  ./DragAndDrop/core.1
FILE:  ./%s

FILE:  ./uid.c
        printf( "/usr/ucb/whoami: " );
        system( "exec /usr/ucb/whoami" );

        Please make sure the "ld" used is /usr/ccs/bin/ld
rather than /usr/ucb/ld.

Note: The command sees lines that start with "./" as file
names, so the command mistook the "./%s" it found in
./DragAndDrop/core.1 as a file name. The next line was really found
in the file  DragAndDrop/core.1. If you see a file name in the
output that doesn't exist, then the script was was confused in just
this way. Ignore the FILE: line for the non-existent file, and the
rest of the output will make sense.

Commands most likely to come from /usr/ucb:

  • ps -- now the /usr/bin version also accepts the /usr/ucb/ps
  • echo -- "-n" for no newline vs. "\r"
  • whereis -- No direct replacement.
  • whoami  -- Replacement in /usr/bin
  • sum -- /usr/ucb and /usr/bin versions return different
    checksums, see manpage sum(1B)
  • touch -- /usr/ucb/touch has a -f option not in

The good news is that of the 76 commands in /usr/ucb as of Solaris
11.3, 45 of them are links back to /usr/bin, and only 31 are unique
to /usr/ucb.  This means that many of the commands in /usr/ucb are
available in /usr/bin by default now and in some cases, /usr/ucb may
not be required at all.  "ls -la /usr/ucb" shows the commands that
are linked to /usr/bin.

The man pages for a /usr/ucb command can be displayed with "man -s1b
<cmd>", e.g.

# man -s1b echo

Now check for libraries. Look back at the find output, or peruse
your own build files. Do you see /usr/ucblib in any makefiles, or

Libraries in /usr/ucblib and /usr/ucblib/sparcv9:

  • libcurses.so
  • libbdbm.so
  • librpcsoc.so
  • libtermcap.so
  • libucb.so

So get ready for the changes in Solaris, and clear out the last
remnants of UCB, along with your SunOS 4.x documentation and your Joy
of UNIX button
. Fix up your software before Oracle releases
the  version of Solaris without /usr/ucb and /usr/ucblib.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.