{"record":{"id":"646a23c3d9c833a4","repo":"puppetlabs/puppet","slug":"unable-to-update-package","errorCode":null,"errorMessage":"Unable to update %{package}","messagePattern":"Unable to update %(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/pkg.rb","lineNumber":258,"sourceCode":"    unhold if properties[:mark] == :hold\n    begin\n      tries = 1\n      # pkg install exits with code 7 when the image is currently in use by another process and cannot be modified\n      r = exec_cmd(command(:pkg), command, *args, name)\n      while r[:exit] == 7\n        if tries > 4\n          raise Puppet::Error, _(\"Pkg could not install %{name} after %{tries} tries. Aborting run\") % { name: name, tries: tries }\n        end\n\n        sleep 2**tries\n        tries += 1\n        r = exec_cmd(command(:pkg), command, *args, name)\n      end\n    ensure\n      hold if @resource[:mark] == :hold\n    end\n    return r if nofail\n    raise Puppet::Error, _(\"Unable to update %{package}\") % { package: r[:out] } if r[:exit] != 0\n  end\n\n  # uninstall the package. The complication comes from the -r_ecursive flag which is no longer\n  # present in newer package version.\n  def uninstall\n    cmd = [:uninstall]\n    case (pkg :version).chomp\n    when /052adf36c3f4/\n      cmd << '-r'\n    end\n    cmd << @resource[:name]\n    unhold if properties[:mark] == :hold\n    begin\n      pkg cmd\n    rescue StandardError, LoadError => e\n      hold if properties[:mark] == :hold\n      raise e\n    end","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/pkg.rb#L240-L276","documentation":"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.","triggerScenarios":"`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.","commonSituations":"Publishers moved or renamed after a repo migration; a pinned version that no longer exists; HTTPS proxy blocking pkg; /var or / exhausted.","solutions":["Read the embedded output in the error - it is pkg's own failure message.","Reproduce by hand: run the same `pkg install <name>@<version>` as root.","Fix publisher configuration (`pkg publisher`, `pkg set-publisher`) and refresh metadata (`pkg refresh --full`).","Dry-run first (`pkg install -n <name>`) to validate solvability, then let the agent retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# Dry-run the exact install to catch failures before the agent applies it\npkg install -n \"${name}@${version}\" >/dev/null 2>&1 || echo \"install would fail - fix publishers/version first\"","typeGuard":null,"tryCatchPattern":"begin\n  provider.install\nrescue Puppet::Error => e\n  # e.message embeds pkg stdout/stderr - log it for triage\n  Puppet.err(\"pkg install failed: #{e.message}\")\n  raise\nend","preventionTips":["Run `pkg install -n` dry-runs in CI against the same publishers as production.","Keep publisher config managed and refreshed (`pkg refresh --full`).","Monitor disk space on / and /var so pkg never fails mid-operation."],"tags":["solaris","pkg","install","exit-code","package-provider"],"backgroundTag":"package-manager-command-failure","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}