Reinstalling an Image

If you know exactly what end result you want, and achieving that result requires a large number of packaging changes, such as uninstalling a large number of packages, you might want to use the pkg exact-install command. The result of the pkg exact-install command is an image with only the specified packages and their dependencies installed. Any currently installed packages that are not specified on the pkg exact-install command line and are not a dependency of the specified packages are removed.

Note:

A version of the pkg:/entire constraint package must be included in the exact-install operands. An image with no pkg:/entire installed is not supported.

The pkg exact-install command ignores restrictions to not install packages that are on the avoid list. If a package that is on the avoid list in the current BE is named as an operand on the exact-install command or is in the dependency chain, that package will be installed in the new BE; the new BE will have an empty avoid list. See Avoiding Installing Some Packages in a Group Package for information about the avoid list.

The pkg exact-install command ignores restrictions to not update packages that are on the frozen list. If a package that is frozen in the current BE is named as an operand on the exact-install command or is in the dependency chain, that package will be installed in the new BE at the version specified by the exact-install command; the new BE will not have any frozen packages. See Locking Packages to a Specified Version for information about frozen packages.

Otherwise, the exact-install subcommand behaves the same way that the install subcommand behaves. Image variant and facet settings, image property settings, and publisher settings are retained. If any package cannot be installed in this image, then none of the specified packages is installed. Non-global zones are affected by any resulting package updates or removals as described in Working with Non-Global Zones. Note that the -r option is not available for exact-install.

See Installing a New Package for information about publisher stickiness and search order and about using the -g option.

The following practices are recommended for using the pkg exact-install command:

  • Check the versions of packages that are available from configured publishers by using pkg list -a as shown in Installable Packages. If you want to use exact-install to reinstall current versions, and newer versions are available to be installed, you must specify the version portion of the package FMRI in the list of packages to install.

  • Include the entire constraint package in the list of packages to install at a version equal to or greater than the version of the currently installed pkg:/entire package.

  • Include one of the system group packages such as the solaris-minimal-server package in the list of packages to install.

  • Run the command first with the -nv or -nvv options to see exactly what will be installed and what will be removed.

  • Use the --be-name option to install into a new BE that has a meaningful name.

  • Always keep the current working BE as a backup until the new BE is thoroughly tested.

The following example creates a new image with a minimal installation at the same version as the current image:

$ pkg list -Hv entire
pkg://solaris/entire@11.4-11.4.0.0.1.10.0:20180702T173343Z
$ pkg exact-install --be-name 11.4.0min entire@11.4-11.4.0 solaris-minimal-server

Note:

Specifying a version of the pkg:/entire constraint package that is older than the version of the currently installed pkg:/entire package is not guaranteed to work. Some changes, such as a change in zpool version, could cause a downgraded exact-install BE to fail to boot or to behave in unexpected ways. Smaller version deltas are more likely to be successful than larger version deltas.