puppetlabs/puppet · error · Puppet::ExecutionFailure

Could not find package %{name}

Error message

Could not find package %{name}

What it means

The rug (SUSE) provider runs 'rug --quiet install -y <name>' and then re-queries; if the package still is not found it raises Puppet::ExecutionFailure 'Could not find package'. The post-install query uses the rpm parent provider, so whatever rug installed must be visible to 'rpm -q <name>' afterwards, and the --quiet flag hides rug's own explanation.

Source

Thrown at lib/puppet/provider/package/rug.rb:29

  # Install a package using 'rug'.
  def install
    should = @resource.should(:ensure)
    debug "Ensuring => #{should}"
    wanted = @resource[:name]

    # XXX: We don't actually deal with epochs here.
    case should
    when true, false, Symbol
      # pass
    else
      # Add the package version
      wanted += "-#{should}"
    end
    rug "--quiet", :install, "-y", wanted

    unless query
      raise Puppet::ExecutionFailure, _("Could not find package %{name}") % { name: name }
    end
  end

  # What's the latest package version available?
  def latest
    # rug can only get a list of *all* available packages?
    output = rug "list-updates"

    if output =~ /#{Regexp.escape @resource[:name]}\s*\|\s*([^\s|]+)/
      Regexp.last_match(1)
    else
      # rug didn't find updates, pretend the current
      # version is the latest
      @property_hash[:ensure]
    end
  end

  def update

View on GitHub (pinned to e227c27540)

Solutions

  1. Run 'rug install -y <name>' manually to see the real reason (--quiet hides it from Puppet logs)
  2. Fix the catalog source: 'rczmd status' and restart the zmd service so rug has a working catalog
  3. Refresh metadata with 'rug refresh' and retry the puppet run
  4. On SLES 10 SP2+/11+ prefer the zypper provider, which is the maintained code path

Example fix

// before
package { 'apache2':
  ensure   => '2.2.3-20.18',
  provider => rug,
}
// after - unversioned ensure on the maintained zypper provider
package { 'apache2':
  ensure   => installed,
  provider => zypper,
}
Defensive patterns

Strategy: validation

Validate before calling

# Ruby: confirm rug can see the package before the run
def rug_knows_package?(name)
  out = Puppet::Util::Execution.execute(['/usr/bin/rug', 'search', name], failonfail: false).to_s
  out =~ /^#{Regexp.escape(name)}\b/
end

Try / catch

retries ||= 0
begin
  provider.install
rescue Puppet::ExecutionFailure => e
  raise unless e.message =~ /Could not find package/ && (retries += 1) == 1
  Puppet::Util::Execution.execute(['/usr/bin/rug', 'refresh'], failonfail: false)
  retry
end

Prevention

When it happens

Trigger: ensure => installed (or a pinned name-<should> string, since epochs are not handled) with provider => rug where rug exits without installing: name absent from the configured ZENworks/zmd catalog, zmd service down, or stale catalog metadata.

Common situations: SLES 9/10 boxes with the zmd daemon stopped; typo'd package names; pinned versions missing release suffixes; rug catalogs never refreshed.

Related errors


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