Solaris : Find the software package a file belongs to
Suppose you know the name of a file you need, but don’t know what package it belongs to. Knowing the package name can help you when installing missing software.
If you have a system on which the needed file exists, you can use one of below two methods:
# grep /usr/lib/libC /var/sadm/install/contents
/usr/lib/libC.so.5 f none 0755 bin bin 307352 50140 894427474 SUNWlibC
# pkgchk -l -p /usr/bin/ls
Type: regular file
Expected mode: 0555
Expected owner: root
Expected group: bin
Expected file size (bytes): 18844
Expected sum(1) of contents: 34850
Expected last modification: Jan 05 18:57:54 2000
Referenced by the following packages:
Current status: installed
The field at the end of each line is the package name. In this case, it’s SUNWlibC. You might know that this package can be found on the Solaris installation software CD. However, suppose one of the following is true:
- The file you’re looking for is not installed.
– You don’t know where to find the package (SUNWlibC, etc.).
– The package database doesn’t have information about the file you are looking for.
What you can then do is search the packages on one or more software CD’s. For most CD’s, the installation software can be found in /cdrom/cdrom0 after you insert the CD into your CD-ROM drive. For others, such as Solaris, the path to the installation software might be more difficult to reach. What you should look for is a directory on the CD that contains a list of package names.
Packages can be named in different ways, but most begin with a series of capital letters, followed by a mix of lowercase letters, uppercase letters, and/or numbers. SUNWlibC shares the prefix SUNW with other Solaris packages. As another example, the packages associated with the Sun WorkShop compiler software begin with SPRO, with only a few exceptions (the license manager and the NEO software).
You will need to find this package directory if you plan to install the missing software using the pkgadd command, too. Consult the installation documentation that came with your software for assistance if you have trouble finding the base package directory on the CD. Once you’ve used the cd command to enter the base directory, issue the following command to find out if one of the packages on this CD contains the file you are looking for:
# grep */pkgmap
This is very similar to searching the database of installed packages in the
# /var/sadm/install/contents file.
If the file you were looking for is found, you will need to install some or all of the software on that CD to use it. Consult the installation instructions pertaining to that software CD for additional help.