Satellite sync on Red Hat Satellite 6 fails with " Error retrieving metadata: A connection error occurred:"

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.2.x
  • Satellite sync.

Issue

Repository sync fails with below error:

{"code"=>"RPM1004",
      "data"=>{"reason"=>"A connection error occurred"},
      "description"=>"Error retrieving metadata: A connection error occurred",
      "sub_errors"=>[]},
    "_id"=>{"$oid"=>"587ef9f34e0ea39dd625b9df"},
    "id"=>"587ef9f34e0ea39dd625b9df"}],
 "contents_changed"=>true,
 "poll_attempts"=>{"total"=>47, "failed"=>1}}

Resolution

  • Make sure there are no paused/pending/running tasks present on satellite server.

  • If there are no stuck tasks, you can use Foreman's console to delete any orphaned repositories:

# foreman-rake console

In the foreman-rake console, use these commands:

User.current = User.first

::Katello::Repository.all.each do |repo|
  begin
    puts "Checking #{repo.name} - #{repo.id}"
    Katello.pulp_server.extensions.repository.retrieve_with_details(repo.pulp_id)
  rescue RestClient::ResourceNotFound
    puts "Deleting #{repo.name} - #{repo.id}"
    repo.destroy!
  end
end
  • Then run below command to restart the katello-service:
# katello-service restart
  1. then re-run the upgrade command as below:
# satellite-installer --scenario satellite --upgrade

For more KB articles/solutions related to Red Hat Satellite 6.x Repository Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Repository Issues.

Root Cause

  • orphaned content of repository was causing sync task to get stuck.
SBR
Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.