OpenSolaris 2009.06 Image Packaging System Guide
Previous Next

pkg(1) Command Reference

pkg(1) supports two options directly:

  • -R – Perform the packaging operations on the image rooted at dir, rather than the image discovered automatically. All the pkg commands accept -R dir as an option.

  • --help or -? – List the subcommands and options supported by pkg(1).

For the OpenSolaris 2009.06 release, the pkg command has the following subcommands and options.

Table 10-1 pkg(1) Commands

Subcommands

Description

Privileges Required to Run Command

pkg image-create

Creates an image suitable for package operations at the directory specified by dir.

Syntax : pkg image-create [-fFPUz] [--force] [--full | --partial | --user] [--zone] [-k ssl_key] [-c ssl_cert] [--no-refresh] (-p | --publisher) name=origin_uri dir

  • -F– Creates a full image.

  • -f– Forces the command to create an image over an existing image.


    Caution - Use this option with care. See How to Create an Image.


  • -P – Creates a partial image.

  • -U – Creates a user image (default).

  • -z – Runs the image in a non-global zone context.

  • -p– Specifies a preferred publisher.


    Note - This option must be specified.


  • -c – Specifies the client key (for publishers using client SSL authentication).

  • -k – Specifies certificate (for publishers using client SSL authentication).

  • --no-refresh – Does not attempt to contact the image's publisher to retrieve its catalog.

Yes

pkg image-update

Updates all installed packages in the current image to the latest available version.

Syntax: pkg image-update [-fnvq] [--be-name name [--no-refresh] [--no-index]

  • -f - Skips safety checks.

  • -n - Executes the requested operation but make no persistent changes to the image.

  • -v - Issues verbose progress messages during the requested operation.

  • -q - No message is shown during command execution.

  • ---be-name - Renames the newly created boot environment to the name specified by name. This option is valid only if a new boot environment is created during image-update. See also beadm(1).

  • --no-refresh - Does not attempt to contact the image's authorities to retrieve their catalogs.

Yes

pkg refresh

Retrieves updated catalogs for each publisher registered within the image.

Syntax: pkg refresh [-full] [publisher..]

  • -full - Retrieves full catalog.

  • When no publisher is specified, the command retrieves updates for each publisher registered within the image.

No

pkg install

Installs a package.

Syntax: pkg install [-nvq] [--no-refresh] [--no-index] pkg_fmri

  • -n - Executes the requested operation but makes no persistent changes to the image.

  • -v - Issues verbose progress messages during the requested operation.

  • --no-refresh - Does not attempt to contact the image's authorities to retrieve their catalogs.

  • --no-index - Does not update the search indexes after the operation has completed successfully.

Yes

pkg uninstall

Uninstalls a package.

Syntax: pkg uninstall [-nrvq] pkg_fmri

  • -n - Executes the requested operation but makes no persistent changes to the image.

  • -v - Issues verbose progress messages during the requested operation.

  • -r - Recursively uninstall any packages that are dependent on the initial package.

  • --no-refresh - Does not attempt to contact the image's authorities to retrieve their catalogs.

  • --no-index - Does not update the search indexes after the operation has completed successfully.

Yes

pkg info

Displays information about a package.

Syntax : pkg info [-lr] [--license] pkg_fmri

  • -l – Displays the data available from locally installed packages. This is the default option.

  • -r – Shows the latest available package on the server. A package FMRI must be specified with this option.

  • --license – Displays license and copyright information for a package.

No

pkg contents

Displays the contents (action attributes) of packages in the current image.

Syntax : pkg contents [-Hmr] [-o attribute] [ -s sort_key] [-t action_type] pkg_fmri

  • -m - Shows the complete contents of the action as represented in the package manifest.

  • -o - Specifies the attributes that you are searching for. Multiple attributes can be specified with a single -o option by separating the attributes with commas. If this option is not specified, only the path attribute is displayed.

  • -r - Retrieves the contents of a package from the server. This option is used in cases where the package is not already installed. A package FMRI must be specified when using this option.

  • -s - Sorts the display based on the specified attribute.

  • -t - Displays information pertaining only to the specified action.

  • -H - Does not display any headers.

Yes

pkg search

Searches for token, and displays the FMRIs in which token was found.

Syntax: pkg search [-alprI] [-s server] query

  • -a - Display information about matching actions along with the search results.

  • -l - Searches the installed packages on the image.

  • -p - Perform the search and display the packages which contain atleast one action that matched query.

  • -r - Searches the repository corresponding to the image's publishers. This is the default option. This option can be combined with the -l option so that both local and remote searches are performed.

  • -s - Searches for packages in the specified server, a pkg(5) repository. Multiple servers can be specified. This option can be combined with the -l option.

  • -I - Search for packages in a case sensitive manner.


    Note - The -I option can only be used with the default option, -l at this time.



    Note - Boolean search using AND and OR is supported. For more information, see the pkg(1) man page.


No

pkg list

Displays most recent version information about the state of packages in the current image.

Syntax: pkg list [-aHsuvf] [--no-refresh] pkg_fmri

  • -a - Display information on all known packages, whether they are installed or not installed.

  • -H - Do not display any headers.

  • -s - Display only package name and description of the package.

  • -u - Show information only about packages which have newer versions available.

  • -v - Show detailed package FMRIs.

  • -f - List all known versions of a package.

  • --no-refresh - Do not attempt to contact the repositories for the image's publishers to retrieve publisher metadata.

No

pkg verify

Validate the installation of packages in the current image.

Syntax: pkg verify -[Hqv] pkg_fmri

  • -v - Display verbose information.

  • -q - Do not report anything but return failure if there are any verification problems.

  • -H - Remove headers from the listing.

Yes

pkg fix

Fixes any errors reported by pkg verify

Syntax : pkg fix pkg_fmri

Yes

pkg set-property propname propvalue

Updates an existing image property or add a new image property.


Note - The preferred publisher property cannot be changed using this subcommand. Use pkg set-publisher to change the preferred publisher.


Yes

pkg unset-property propname propvalue

Removes an existing image property or add a new image property.


Note - The preferred publisher property cannot be changed using this subcommand. Use pkg set-publisher to change the preferred publisher.


Yes

pkg property [propname..]

Displays image property information.

  • No argument – Display name and values for all image properties.

  • -H – Remove headers from the listing.

No

pkg set-publisher

Updates an existing publisher or adds an additional package publisher.

Syntax: pkg set-publisher [-Ped] [-k ssl_key] [-c ssl_cert] [-O origin_url] [-m mirror_to_add] [-M mirror_to_remove] [--enable] [--disable] [--no-refresh] [--reset-uuid] publisher

  • -P - Sets the specified publisher as the preferred publisher.

  • -c - Specifies client SSL certificate.

  • -k - Specifies client key.

  • -O - Sets the URL prefix for the origin packaging repository for the publisher.

  • -m - Adds the URI as a mirror for the given publisher.

  • -M - Removes the URI as a mirror for the given publisher.

  • -e - Enables the given publisher.

  • -d - Disables the given publisher.


    Note - A disabled publisher is not used when the package list is being populated or in certain package operations. However the properties for a disabled publisher can still be set and viewed.



    Caution - If only one publisher exists, it cannot be disabled.


  • --no-refresh - Do not attempt to contact the specified publisher to retrieve the metadata.

  • ---reset-uuid - Choose a new, unique identifier to identify this image to the publisher.

Yes

pkg unset-publisher

Removes the configuration associated with the given publisher.

Syntax: pkg unset-publisher publisher

Yes

pkg publisher

Displays publisher information. If a publisher is specified, configuration values associated with the publisher is displayed.

Syntax: pkg publisher [-HPa] publisher

  • No argument - Display the list of all configured publishers, their origin URLs , and their mirrors.

  • -H- Remove headers from the listing.

  • -P- Display only preferred publisher information.

  • -a- Display all publishers including those that have been disabled.

No

pkg history

Displays the history of operations executed in the image.

Syntax : pkg history [-Hl]

  • -H – Remove headers from the listing.

  • -l – Display detailed history information which includes the outcome of the command, when the command completed execution, version and name of the client used, identity of the user who performed the operation, and any errors encountered while executing the command.

No

pkg purge-history

Deletes all existing history information.

Yes

pkg help

Views a list of all available commands and their associated options.

No

Previous Next