[Satellite 6.2] Capsule sync fails with error `RPM1004: Error retrieving metadata: NOT FOUND`

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.2.10
  • Red Hat Capsule 6.2.10

Issue

  • Capsule sync fails with error RPM1004: Error retrieving metadata: NOT FOUND

  • Observed following traceback in the sync log

Traceback (most recent call last):\n File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 240, in trace_task\n R = retval = fun(*args, **kwargs)\n File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 473, in call\n return super(Task, self).call(*args, **kwargs)\n File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 103, in call\n return super(PulpTask, self).call(*args, **kwargs)\n File "/usr/lib/python2.7/site-packages/celery/app/trace.py", line 437, in protected_call\n return self.run(*args, **kwargs)\n File "/usr/lib/python2.7/site-packages/pulp/server/controllers/repository.py", line 762, in sync\n sync_report = sync_repo(transfer_repo, conduit, call_config)\n File "/usr/lib/python2.7/site-packages/pulp/server/async/tasks.py", line 658, in wrap_f\n return f(*args, **kwargs)\n File "/usr/lib/python2.7/site-packages/pulp_rpm/plugins/importers/yum/importer.py", line 81, in sync_repo\n report = self._current_sync.run()\n File "/usr/lib/python2.7/site-packages/pulp_rpm/plugins/importers/yum/sync.py", line 320, in run\n reason=self.repomd_not_found_reason)\nPulpCodedException: Error retrieving metadata: NOT FOUND\n"





## Resolution

* Take Satellite snapshot before performing below steps.
* Run below command on Satellite server

mongo pulp_database --eval 'db.repo_distributors.update({"last_publish": {$ne: null}}, {$set: {"last_publish": null}}, {"multi":true})'



* Execute the following command in `foreman-rake console`

foreman-rake console

irb(main):001:0> User.current = User.first
irb(main):002:0> Katello::Repository.where("name ilike '%fastrack%'").each { |repo|
ForemanTasks.async_task(Actions::Pulp::Repository::DistributorPublish, :pulp_id => repo.pulp_id, :distributor_type_id =>
Runcible::Models::YumDistributor.type_id) }
exit


**Note:**  Here search is based on repository name called `fasttrack`.  Modify this search value as per requirement. 

For more KB articles/solutions related to Red Hat Satellite 6.x Capsule Sync Issues, please refer to the [Consolidated Troubleshooting Article for Red Hat Satellite 6.x Capsule Sync Issues](https://access.redhat.com/articles/6445391)



## Diagnostic Steps

* On Red Hat Satellite WebUI, under **Monitor** >> **Tasks** >> click on the **Capsule Sync task**, following error is observed:

Label: Actions::Katello::CapsuleContent::Sync
Name: Synchronize capsule content Stuck with error of:
RPM1004: Error retrieving metadata: NOT FOUND



- on the Capsule, check what repositories were affected:


# grep "PulpCodedException: Error retrieving metadata: NOT FOUND" * -B50 /var/log/messages | grep "pulp:repository" |  cut -d ":" -f 3 | sort | uniq

RedHat-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_6_Server_-Optional_Fastrack_RPMs_x86_64
RedHat-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_6_Server
-Fastrack_RPMs_x86_64
RedHat-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_7_Server
-Fastrack_RPMs_x86_64
RedHat-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_7_Server
-_Optional_Fastrack_RPMs_x86_64


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.