Use (With Examples)

Examples of usage

Available packages

With the available (-a) option you get common name, package name, version and download size.

# pkgutil -a | head
9menu                CSW9menu             1.8,REV=2006.05.19         15.3 KB
a2ps                 CSWa2ps              4.13b                       1.3 MB
aalib                CSWaalib             1.4.0,REV=2008.04.13_rev=rc5 198.5 KB
achievo              CSWachievo           0.8.4                     273.6 KB
acpidump             CSWacpidump          20071116,REV=2008.05.10    20.7 KB
aggregate            CSWaggregate         1.6,REV=2008.03.22         10.4 KB
amanda               CSWamanda            2.4.4p4,REV=2005.08.05      2.3 MB
amarok               CSWamarok            1.4.8,REV=2008.02.26       12.8 MB
amavisd_new          CSWamavisdnew        2.5.2,REV=2007.08.03      656.2 KB
amsn                 CSWamsn              0.94                        2.3 MB

You can also add arguments that filter the output, it tries to match both the common name and the package name. See the example below which lists available packages with the strings "geoip" or "python" in them. This is equivalent to "pkgutil -a | egrep -i 'geoip|python'" but much easier to type.

# pkgutil -a geoip python
ap2_modgeoip         CSWap2modgeoip       1.2.5,REV=2008.10.17        16.0 KB
ap2_modpython        CSWap2modpython      3.3.1,REV=2007.10.25       389.5 KB
geoip                CSWgeoip             1.4.4,REV=2008.04.15       310.5 KB
geoip_devel          CSWgeoipdevel        1.4.4,REV=2008.04.15       160.1 KB
gnome_python         CSWgnome-python      2.0.2,REV=2004.08.09       251.4 KB
pm_geoippureperl     CSWpmgeoippureperl   1.19,REV=2008.04.16         18.7 KB
python               CSWpython            2.5.1,REV=2007.11.03        10.9 MB
python_tk            CSWpython-tk         2.5.1,REV=2007.11.03       301.3 KB

Compare packages

With compare (-c) you get your locally installed CSW packages and their version compared to the current catalog. Below is a sample listing, note that CSWripmime is a testing package that is not officially available in the catalog.

# pkgutil -c
package                   installed                 catalog
CSWmiltergreylist         4.0,REV=2008.04.03        4.0,REV=2008.05.06             
CSWrcs                    5.7,REV=2006.01.10        SAME                     
CSWripmime                1.4.0.7,REV=2008.04.11    not in catalog

As with -a you can add filters to the output. The example shows the status of packages containing "php" or "perl". Again, this is the same as "pkgutil -c | egrep -i 'php|perl'" but much easier to type.

# pkgutil -c php perl
package                   installed                 catalog
CSWap2modphp5             5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWperl                   5.8.8,REV=2008.10.08      SAME                     
CSWphp5                   5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWphp5gd                 5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWphp5mysqli             5.2.4,REV=2007.10.29      5.2.6,REV=2008.10.28     
CSWpmgeoippureperl        1.19,REV=2008.04.16       SAME

You can also use -C which skips the SAME lines. This option also takes filter arguments like -a and -c.

# pkgutil -C
package                   installed                 catalog
CSWcswclassutils          1.32,REV=2010.02.09       1.30,REV=2009.11.21      
CSWcurlrt                 7.19.7,REV=2010.01.15     7.20.0,REV=2010.02.15    
CSWdiffutils              2.8.1,REV=2005.11.10      2.9,REV=2010.02.17       
CSWpcp                    1.09,REV=2010.02.17       not in catalog           
CSWpython                 2.6.4,REV=2009.12.21      2.6.4,REV=2010.02.15     
CSWpython-rt              2.6.4,REV=2009.12.22      2.6.4,REV=2010.02.15

A fast way of checking a single package is by using -c with —single:

pkgutil -c --single CSWdiffutils
CSWdiffutils              2.8.1,REV=2005.11.10      2.9,REV=2010.02.17

Update notifications

The option email (-e) will compare your installed packages to the available ones and send you an e-mail if there's updates available for your system. You could set it up to run weekly from root's crontab like this:

0 5 * * 0 /opt/csw/bin/pkgutil -U -e nobody@foo.bar > /dev/null 2>&1

This is an example of how the e-mail looks like:

From: Super-User <root@foo.bar>
To: nobody@foo.bar
Subject: yourhostname: CSW updates available

CSWbind                   9.4.2,REV=2008.01.17      9.4.2,REV=2008.07.09_rev=p1
CSWmiltergreylist         4.0,REV=2008.04.03        4.0,REV=2008.05.06

Remove packages

This feature is to be considered experimental at this stage.

The remove (-r) option can remove a package including all dependencies that are not in use by other packages.

# pkgutil -r CSWrcs
Recursively checking catalog, may take a while...
Looking at installed CSW packages...
Examining dependencies for:
  CSWrcs (remove)
  CSWdiffutils (remove)
  CSWcommon (in use)
Removing CSWrcs
... (output of pkgrm not shown)
Removing CSWdiffutils
... (output of pkgrm not shown)

Run it over and over again with the same arguments until all unused packages are removed. It's normal that it can't remove all packages in one go.

System check

You can check what pkgutil finds in your system by using syscheck (-V). Example below:

# pkgutil -V
- System -
Pkgutil         1.10
Arch            i386
Solaris         5.10
Pkg patch       119318 (119318-01 installed)
GPG binary      /opt/csw/bin/gpg
Gzip binary     /opt/csw/bin/gzip
Mailx binary    /bin/mailx
MD5 binary      not found (suggestion: install CSWtextutils)
MD5 module      2.36 (primary choice for MD5)
Perl            5.008008
Perl binary     /opt/csw/bin/perl
Wget binary     /opt/csw/bin/wget
PATH            /opt/csw/bin:/usr/sbin:/usr/bin

- Configuration -
catalog_not_cached      true (default: true)
catalog_update          14 (default: 14)
exclude_pattern         perl (default: none)
gpg_homedir             not set (default: none)
maxpkglist              2500000 (default: 2500000)
mirror                  http://ftp.df.lth.se/pub/csw/current
                        (default: http://ibiblio.org/pub/packages/solaris/opencsw/current)
noncsw                  false (default: false)
pkgaddopts              -S (default: none)
pkgliststyle            1 (default: 0)
stop_on_hook_soft_error not set (default: false)
use_gpg                 false (default: false)
use_md5                 false (default: false)
wgetopts                -nv (default: none)

Temporary site

With the temp (-t) option you can select a primary download location, the location specified with mirror in pkgutil.conf will be secondary. Downloads will try the primary location first and go on to the secondary if it has to.

You can use this if you're having problems with your normal mirror and want to use another official mirror temporarily. See example:

# grep mirror= /etc/opt/csw/pkgutil.conf
mirror=http://www.ibiblio.org/pub/packages/solaris/opencsw/current
# pkgutil -t http://ftp.math.purdue.edu/mirrors/opencsw.org/current -i perl

If you have packages you have built yourself that has dependencies to CSW packages it can be a problem to install them easily. Now you can use pkgutil for that as well. Use bldcat to create a catalog for your own packages and then place them on a web server you control. Then use "-t http://yourserver" so pkgutil can find your catalog.

# bldcat .
# pkgutil -t http://yourserver -i yourpackage

Package streams

You can download packages for a specific platform with all dependencies into one big file in order to transfer and install them on another computer using the stream option (-s). The desired platform can be specified and is not related to the platform pkgutil runs on.

Example to download "nano" for Solaris 10 Sparc:

pkgutil --stream --download -T sparc:5.10 nano

The example below will send a package stream including all dependencies needed for CSWbind to standard output which is piped to gzip. With "-o -" the normal output is sent to standard error and "-y" is used to skip the confirmation prompt.

# pkgutil -y -o - -ds bind | gzip > bind.pkg.gz

Use on Linux for downloading

Sometimes your Solaris servers don't have direct internet access but you have Linux servers that does. Then you can use pkgutil to download packages intelligently for you on a Linux host. Pkgutil is not designed for Linux though so you have to do some steps before it works.

  • Download the latest version of the script to your home directory
$ cd
$ wget http://pkgutil.svn.sourceforge.net/viewvc/pkgutil/trunk/pkgutil
$ chmod 755 pkgutil
  • Create a directory to hold the admin file
# mkdir -p /var/opt/csw/pkgutil
  • Create the admin file
# touch /var/opt/csw/pkgutil/admin
  • Pkgutil looks in the wrong locations for wget so fake a Solaris location with a symlink
# mkdir /usr/sfw/bin
# ln -s /usr/bin/wget /usr/sfw/bin/wget

Now you can use pkgutil for downloading, you must specify target architecture and Solaris release, for example:

Downloads perl and its dependencies for Solaris 10 on i386 to the .pkgutil directory in your home directory

$ ./pkgutil -d -T i386:5.10 perl

For obvious reasons all options involving actual Solaris package commands will not work. An alternative to this downloading on Linux may be rsyncing your own local mirror from one of the official ones.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License