puppetlabs/puppet · error · Puppet::Error

Could not list installed Packages: %{detail}

Error message

Could not list installed Packages: %{detail}

What it means

Raised by aix.rb:135 in pkglist when the command used to enumerate packages (`installp -L -d <source>` for source listings or `lslpp` for installed packages) raises Puppet::ExecutionFailure. When pkglist was called for a single package name (hash[:pkgname] set) the failure is swallowed and nil returned; only catalog-wide listings (`puppet resource package`, instances/prefetch without a specific name) raise this error with the command output as %{detail}.

Source

Thrown at lib/puppet/provider/package/aix.rb:135

  def self.pkglist(hash = {})
    cmd = [command(:lslpp), "-qLc"]

    name = hash[:pkgname]
    if name
      cmd << name
    end

    begin
      list = execute(cmd).scan(/^[^#][^:]*:([^:]*):([^:]*):[^:]*:[^:]*:([^:])/).collect { |n, e, s|
        e = :absent if [:broken, :inconsistent].include?(STATE_CODE[s])
        { :name => n, :ensure => e, :status => STATE_CODE[s], :provider => self.name }
      }
    rescue Puppet::ExecutionFailure => detail
      if hash[:pkgname]
        return nil
      else
        raise Puppet::Error, _("Could not list installed Packages: %{detail}") % { detail: detail }, detail.backtrace
      end
    end

    if hash[:pkgname]
      list.shift
    else
      list
    end
  end

  def self.instances
    pkglist.collect do |hash|
      new(hash)
    end
  end

  def latest
    upd = latest_info

View on GitHub (pinned to e227c27540)

Solutions

  1. Run the failing listing command manually to see %{detail}: `installp -L -d <source>` or `lslpp -L -c`.
  2. Fix or mount the source depot, or correct the `source` attribute on the package resource.
  3. If lslpp itself fails, check /usr/lib/objrepos consistency (`lppchk -v`) before re-running puppet.
Defensive patterns

Strategy: try-catch

Validate before calling

# verify the depot is listable before puppet runs
source = '/path/to/lpp_source'
system("installp -L -d #{source} >/dev/null") or raise "installp cannot list #{source}"

Try / catch

begin
  Puppet::Type.type(:package).provider(:aix).instances
rescue Puppet::Error => e
  raise unless e.message =~ /Could not list installed Packages/
  # degrade to named-only checks instead of full enumeration
  packages.each { |p| p.provider.query rescue nil }
end

Prevention

When it happens

Trigger: Running `puppet resource package` on AIX, or an agent run where the aix provider must enumerate instances: the underlying installp/lslpp command exits non-zero because the source depot given via `source =>` is missing/unmounted/unreadable, or lslpp is broken.

Common situations: NIM/lpp_source depot not mounted or moved; source path typo in the package resource; /usr/lib/objrepos corrupted so lslpp fails; permissions preventing reading the source directory.

Related errors


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