{"record":{"id":"e07d9f24455cea8d","repo":"puppetlabs/puppet","slug":"package-name-was-not-present-after-trying-to-in","errorCode":null,"errorMessage":"Package %{name} was not present after trying to install it","messagePattern":"Package %(.+?) was not present after trying to install it","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/provider/package/urpmi.rb","lineNumber":28,"sourceCode":"\n  def install\n    should = @resource.should(:ensure)\n    debug \"Ensuring => #{should}\"\n    wanted = @resource[:name]\n\n    # XXX: We don't actually deal with epochs here.\n    case should\n    when true, false, Symbol\n      # pass\n    else\n      # Add the package version\n      wanted += \"-#{should}\"\n    end\n\n    urpmi \"--auto\", wanted\n\n    unless query\n      raise Puppet::Error, _(\"Package %{name} was not present after trying to install it\") % { name: name }\n    end\n  end\n\n  # What's the latest package version available?\n  def latest\n    output = urpmq \"-S\", @resource[:name]\n\n    if output =~ /^#{Regexp.escape @resource[:name]}\\s+:\\s+.*\\(\\s+(\\S+)\\s+\\)/\n      Regexp.last_match(1)\n    else\n      # urpmi didn't find updates, pretend the current\n      # version is the latest\n      @resource[:ensure]\n    end\n  end\n\n  def update\n    # Install in urpmi can be used for update, too","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/provider/package/urpmi.rb#L10-L46","documentation":"The urpmi (Mandriva/Mandrake) provider runs 'urpmi --auto <name>' (appending -<version> when pinned; epochs are not handled) and then verifies via query; if the package still is not installed it raises Puppet::Error 'Package ... was not present after trying to install it'. urpmi can exit without error while installing nothing when no configured medium provides the package.","triggerScenarios":"ensure => installed or pinned with provider => urpmi on Mandriva/Mandrake where the package (or the composed name-version string) is not in any medium, or media lists are stale because 'urpmi.update -a' was never run.","commonSituations":"Mandriva 2008-2010 era hosts with dead FTP mirrors in /etc/urpmi/urpmi.cfg; pinned versions with epoch prefixes that break the appended '-version'; media sync never scheduled.","solutions":["Run 'urpmi --auto <name>' manually and read why nothing was installed","Refresh media with 'urpmi.update -a' and repair dead mirror entries in /etc/urpmi/urpmi.cfg","Confirm resolvability with 'urpmq <name>' and drop the version pin (epochs unsupported by this provider)","On EOL Mandriva, host the rpm locally and manage it with provider rpm plus a source path"],"exampleFix":"// before\npackage { 'apache-mod_php':\n  ensure   => '5.3.5-0.1mdv2010.2',\n  provider => urpmi,\n}\n// after - pin dropped to what the medium actually provides\npackage { 'apache-mod_php':\n  ensure   => installed,\n  provider => urpmi,\n}","handlingStrategy":"retry","validationCode":"# Ruby: confirm urpmq can resolve the package before install\ndef urpmi_resolves?(name)\n  out = Puppet::Util::Execution.execute(['urpmq', '-S', name], failonfail: false).to_s\n  out !~ /no package/i && !out.strip.empty?\nend","typeGuard":null,"tryCatchPattern":"retries ||= 0\nbegin\n  provider.install\nrescue Puppet::Error => e\n  raise unless e.message =~ /was not present after trying to install/ && (retries += 1) == 1\n  Puppet::Util::Execution.execute(['urpmi.update', '-a'], failonfail: false)\n  retry\nend","preventionTips":["Cron 'urpmi.update -a' before agent runs so media lists are fresh","Keep mirror entries in /etc/urpmi/urpmi.cfg current; remove dead FTP mirrors","Avoid epoch-pinned versions with the urpmi provider (epochs are not handled)"],"tags":["mandriva","urpmi","package-not-found","media-sync","package-provider"],"backgroundTag":"package-install-failed","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}