puppetlabs/puppet · error · Puppet::ExecutionFailure

Could not find package %{name}

Error message

Could not find package %{name}

What it means

The up2date provider (RHEL 2.1/3/4) runs 'up2date -u <name>' then re-queries; if rpm -q still cannot see the package it raises Puppet::ExecutionFailure 'Could not find package'. up2date is the legacy RHN client, so failure usually means the system is not registered to RHN or the subscribed channels lack the package.

Source

Thrown at lib/puppet/provider/package/up2date.rb:18

# frozen_string_literal: true

Puppet::Type.type(:package).provide :up2date, :parent => :rpm, :source => :rpm do
  desc "Support for Red Hat's proprietary `up2date` package update
    mechanism."

  commands :up2date => "/usr/sbin/up2date-nox"

  defaultfor 'os.family' => :redhat, 'os.distro.release.full' => ["2.1", "3", "4"]

  confine    'os.family' => :redhat

  # Install a package using 'up2date'.
  def install
    up2date "-u", @resource[:name]

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

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

    if output =~ /^#{Regexp.escape @resource[:name]}-(\d+.*)\.\w+/
      Regexp.last_match(1)
    else
      # up2date 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 'up2date -u <name>' manually and read the RHN errors it prints
  2. Re-register the system (rhn_register) and verify channel subscriptions ('up2date --show-channels')
  3. Correct the resource to a plain package name with ensure => installed (no version suffix)
  4. On any remotely modern system use the yum/dnf provider instead of up2date

Example fix

// before
package { 'gcc':
  ensure   => '3.2.3-20',
  provider => up2date,
}
// after - plain name; the provider has no reliable version pinning
package { 'gcc':
  ensure   => installed,
  provider => up2date,
}
Defensive patterns

Strategy: validation

Validate before calling

# Ruby: confirm RHN registration before up2date installs
def rhn_registered?
  File.exist?('/etc/sysconfig/rhn/systemid') &&
    Puppet::Util::Execution.execute(['/usr/sbin/up2date-nox', '--show-channels'], failonfail: false).exitstatus.zero?
end

Try / catch

begin
  provider.install
rescue Puppet::ExecutionFailure => e
  raise unless e.message =~ /Could not find package/
  raise Puppet::Error, "#{resource[:name]} not in RHN channels - run rhn_register or fix entitlements"
end

Prevention

When it happens

Trigger: ensure => installed with provider => up2date on RHEL 2.1/3/4 (defaultfor those releases) when up2date exits without installing: no RHN registration, expired entitlement, package absent from subscribed channels, or a name/version the client cannot resolve.

Common situations: Legacy RHEL 3/4 hosts with lapsed RHN entitlements; /etc/sysconfig/rhn/sources misconfiguration; package names including versions that up2date rejects.

Related errors


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