puppetlabs/puppet · error · Puppet::Error

Unable to update %{package}

Error message

Unable to update %{package}

What it means

Raised at the tail of `install` (lib/puppet/provider/package/pkg.rb:258) in the Solaris `pkg` provider. After the retry loop, a non-zero `pkg install` exit (when `nofail` is not set) aborts with Puppet::Error; %{package} embeds the command's combined stdout/stderr, which contains the actual pkg diagnostics.

Source

Thrown at lib/puppet/provider/package/pkg.rb:258

    unhold if properties[:mark] == :hold
    begin
      tries = 1
      # pkg install exits with code 7 when the image is currently in use by another process and cannot be modified
      r = exec_cmd(command(:pkg), command, *args, name)
      while r[:exit] == 7
        if tries > 4
          raise Puppet::Error, _("Pkg could not install %{name} after %{tries} tries. Aborting run") % { name: name, tries: tries }
        end

        sleep 2**tries
        tries += 1
        r = exec_cmd(command(:pkg), command, *args, name)
      end
    ensure
      hold if @resource[:mark] == :hold
    end
    return r if nofail
    raise Puppet::Error, _("Unable to update %{package}") % { package: r[:out] } if r[:exit] != 0
  end

  # uninstall the package. The complication comes from the -r_ecursive flag which is no longer
  # present in newer package version.
  def uninstall
    cmd = [:uninstall]
    case (pkg :version).chomp
    when /052adf36c3f4/
      cmd << '-r'
    end
    cmd << @resource[:name]
    unhold if properties[:mark] == :hold
    begin
      pkg cmd
    rescue StandardError, LoadError => e
      hold if properties[:mark] == :hold
      raise e
    end

View on GitHub (pinned to e227c27540)

Solutions

  1. Read the embedded output in the error - it is pkg's own failure message.
  2. Reproduce by hand: run the same `pkg install <name>@<version>` as root.
  3. Fix publisher configuration (`pkg publisher`, `pkg set-publisher`) and refresh metadata (`pkg refresh --full`).
  4. Dry-run first (`pkg install -n <name>`) to validate solvability, then let the agent retry.
Defensive patterns

Strategy: try-catch

Validate before calling

# Dry-run the exact install to catch failures before the agent applies it
pkg install -n "${name}@${version}" >/dev/null 2>&1 || echo "install would fail - fix publishers/version first"

Try / catch

begin
  provider.install
rescue Puppet::Error => e
  # e.message embeds pkg stdout/stderr - log it for triage
  Puppet.err("pkg install failed: #{e.message}")
  raise
end

Prevention

When it happens

Trigger: `pkg install` failing with any code other than 0/7: no candidate version in the configured publishers, unsatisfiable dependency resolution, unreachable publisher repository, proxy/network failure, or full disk.

Common situations: Publishers moved or renamed after a repo migration; a pinned version that no longer exists; HTTPS proxy blocking pkg; /var or / exhausted.

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/646a23c3d9c833a4. Report an issue: GitHub.