Figuring out which package a Solaris utility belongs to

While reading through some old notes this weekend, I came across a page I created eons ago about managing Solaris packages. If you want to find out the file modes, the user and group ownership and the package a file belongs to, you can run the pkgchk utility with the “-l” and “-p” options and the name of a file to check:

$ pkgchk -l -p /usr/sfw/bin/snmpget

Pathname: /usr/sfw/bin/snmpget
Type: regular file
Expected mode: 0755
Expected owner: root
Expected group: bin
Expected file size (bytes): 20372
Expected sum(1) of contents: 48443
Expected last modification: Sep 20 17:41:36 2007
Referenced by the following packages:
        SUNWsmcmd      
Current status: installed

Pkgchk is a nifty utility!

4 Comments

Chris K. Haley  on February 4th, 2008

Great piece of info – I have had a need to do this a few times in the past, but have never looked up how to do it. I’m bookmarking this one…

Marco  on February 5th, 2008

Hi, is there a way to find what dependency a pkg has, before install it? checked the man pages, but didn’t find nothing.
Cheers
M

Ryan  on February 7th, 2008

Marco,
About the only way to find out what a package depends upon is to look in the install/depend file. Example, using the CPQary3 package:

rbrown@usul:~/packages/> ls
CPQary3
rbrown@usul:~/packages/> grep -v ^# CPQary3/install/depend
P SUNWcar Core Architecture, (Root)
P SUNWkvm Core Architecture, (Kvm)
P SUNWcsr Core Solaris, (Root)
P SUNWcsu Core Solaris, (Usr)
P SUNWcsd Core Solaris Devices
P SUNWcsl Core Solaris Libraries

Those are all pretty normal packages, so no big problem there. If the package is in datastream format (aka, it’s a file, not a directory), you’ll have to use pkgtrans first to convert it back.

Ash  on September 8th, 2008

Hey nice information you got there. Well just wondering regarding all the packages new package will be depending upon. This is a bit different from checking dependecies.

Like D option in pkgcheck.

Also I have just started new forum/community. I would like to invite you to be part of it.
Check it on http://sharetab.com/forum. Also it will be great if you can spread the word.

Leave a Comment