Still fighting with the repair of repositories after migrating to Katello 3.18 (now on 4.1.2)

Problem:
After the migration to Katello 3.18 we had issues with some content not currently moved to the new PULP directories. Some repositories are so stubborn, even creating a new repo and downloading all content again leads to the same missing RPMs, as the database thinks they are downloaded already.

I tried full sync, full sync and validate, regenerate metadata, all to no avail. This is the error I see when I do run a full sync on a CentOS 7 repository:

Aug  6 11:42:01 foreman pulpcore-worker-3: pulp [abe0bd91-1bf1-4438-8e86-98b0c7cfcaa8]: pulpcore.tasking.pulpcore_worker:INFO: Task 6f441a94-690b-4d3f-81cd-6884969faa1a failed ()
Aug  6 11:42:01 foreman pulpcore-worker-3: pulp [abe0bd91-1bf1-4438-8e86-98b0c7cfcaa8]: pulpcore.tasking.pulpcore_worker:INFO:   File "/usr/lib/python3.6/site-packages/pulpcore/tasking/pulpcore_worker.py", line 272, in _perform_task
Aug  6 11:42:01 foreman pulpcore-worker-3: result = func(*args, **kwargs)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulp_rpm/app/tasks/synchronizing.py", line 427, in synchronize
Aug  6 11:42:01 foreman pulpcore-worker-3: version = dv.create()
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/declarative_version.py", line 151, in create
Aug  6 11:42:01 foreman pulpcore-worker-3: loop.run_until_complete(pipeline)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib64/python3.6/asyncio/base_events.py", line 484, in run_until_complete
Aug  6 11:42:01 foreman pulpcore-worker-3: return future.result()
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 225, in create_pipeline
Aug  6 11:42:01 foreman pulpcore-worker-3: await asyncio.gather(*futures)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/api.py", line 43, in __call__
Aug  6 11:42:01 foreman pulpcore-worker-3: await self.run()
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/artifact_stages.py", line 181, in run
Aug  6 11:42:01 foreman pulpcore-worker-3: pb.done += task.result()  # download_count
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/artifact_stages.py", line 207, in _handle_content_unit
Aug  6 11:42:01 foreman pulpcore-worker-3: await asyncio.gather(*downloaders_for_content)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/plugin/stages/models.py", line 89, in download
Aug  6 11:42:01 foreman pulpcore-worker-3: download_result = await downloader.run(extra_data=self.extra_data)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/download/http.py", line 258, in run
Aug  6 11:42:01 foreman pulpcore-worker-3: return await download_wrapper()
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/backoff/_async.py", line 133, in retry
Aug  6 11:42:01 foreman pulpcore-worker-3: ret = await target(*args, **kwargs)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/download/http.py", line 256, in download_wrapper
Aug  6 11:42:01 foreman pulpcore-worker-3: return await self._run(extra_data=extra_data)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulp_rpm/app/downloaders.py", line 95, in _run
Aug  6 11:42:01 foreman pulpcore-worker-3: to_return = await self._handle_response(response)
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib/python3.6/site-packages/pulpcore/download/http.py", line 210, in _handle_response
Aug  6 11:42:01 foreman pulpcore-worker-3: chunk = await response.content.read(1048576)  # 1 megabyte
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib64/python3.6/site-packages/aiohttp/streams.py", line 380, in read
Aug  6 11:42:01 foreman pulpcore-worker-3: await self._wait("read")
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib64/python3.6/site-packages/aiohttp/streams.py", line 306, in _wait
Aug  6 11:42:01 foreman pulpcore-worker-3: await waiter
Aug  6 11:42:01 foreman pulpcore-worker-3: File "/usr/lib64/python3.6/site-packages/aiohttp/helpers.py", line 656, in __exit__
Aug  6 11:42:01 foreman pulpcore-worker-3: raise asyncio.TimeoutError from None

It looks like some sort of time out message, but it always affects the same RPM and it doesn’t move any further.

Isn’t there any option in Katello to complete empty out a repository and re-download everything? Or have the full sync identify missing RPMs and download them freshly?

Expected outcome:
The full sync option should repair missing files, remove obsolete files and somehow really really repair a repository.

Foreman and Proxy versions:
Foreman 2.5.2
Katello 4.1.2

Foreman and Proxy plugin versions:
Pulp 3.14.0

Distribution and version:
CentOS 7

Other relevant data:

You should be able to remove all packages from the repository (e.g. when you click on the package count) and remove everything. I supposed you could also write a little script to call hammer repository remove-content.

Once you have removed everything from the repository you have to make sure that there are no references left, i.e. for each content view using this repository publish and promote a new version and delete all older content view versions.

After that, remove all orphaned content

# foreman-rake katello:delete_orphaned_content RAILS_ENV=production

I think, that should delete all those packages from the file system as well as the databases.

Thank you, I will try that and post my findings.

OK, after many tries I am ready to give up. I can’t resist the feeling that there are way too many moving parts inside of the Foreman/Katello system for it to be stable and solid. If I have a repository of downloaded content, there has to be a way to remove all downloaded content and just download it again. But there is none. Creating a new repo doesn’t solve things, as apparently Pulp is keeping hashes and decides to not download content it already has. Great if all works, not so much of something breaks.

I cannot always rebuild the whole system from scratch if I encounter any issue. Its too much effort and impacts my level of trust in this solution.

I found a manual workaround, but I would have highly appreciated more assistance from a Katello/Pulp expert.

When a host tries to download a missing file from the repository, monitor the /v/l/m file on the Foreman/Katello server. It will show you the path accessed and not found (something like …/p/GUID). On the host running yum you see the file missing (like /p/python2-six-…rpm). Now you can download the missing file with curl or wget on the Forman server and save it as the /p/GUID mentioned above. I did this for a couple of files missing since the upgrade and can finally update my hosts again.

ping @katello

Sorry for the ping devs, but I can’t continue without your help. Basically, I hope this would also be very useful in the future for other users.

Essentially I am looking for a way to do a full re-download of missing files in a repo, which seems to have been already cataloged inside of the DB. Right now, no matter which option I choose for sync, the DB content wins. That means, if a file is supposed to be downloaded to my local mirror, it will be skipped, even if it doesn’t exist. As stated in my previous comment, I found a manual workaround, but this is very tedious as I need to wait for a client to request a file, look at the logs right at that moment and re-download it manually.

It would be perfect if the “verify content checksum” sync would also make sure, that each file actually exists in the /v/l/pulp/artifact directory and if not, download it again.

So, before we think too hard about it, I’d like to see if it’s actually a timeout error. If you are still seeing the original asyncio.TimeoutError during a sync (or something related to timeouts), try this:

Go to Administer > Settings > Content > Sync Connection Timeout

Increase it up to 3600 to really ensure it’s out of the way.

Resync your repositories.

If that doesn’t help, and your sync error is different, I’d like to see the new error. Also, what are all the failing Dynflow actions on your sync task?

@iballou I changed the timeout, but I don’t think that’s the issue. This is a /v/l/messages trace from the “verify content checksum”:

Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.app.tasks.repository:WARNING: Missing file for <Artifact: pk=05c5bf54-3654-42f5-8525-efb16fce8253>
Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.app.tasks.repository:WARNING: Missing file for <Artifact: pk=4d7e4e8d-6111-4a9c-81ed-811a093f9582>
Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.app.tasks.repository:WARNING: Missing file for <Artifact: pk=3d37b6c7-e1b4-4173-ac9b-b4fb3c685b50>
Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.app.tasks.repository:WARNING: Missing file for <Artifact: pk=1de8cefc-3b3b-4ec3-9781-abb06a8bdaf1>
Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.app.tasks.repository:WARNING: Missing file for <Artifact: pk=dd4bd578-3809-4a5a-9b55-c15201ca900e>
Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.app.tasks.repository:WARNING: Missing file for <Artifact: pk=c8b9e854-4c05-4e59-8a2f-d67fbad28f9f>
Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.tasking.pulpcore_worker:INFO: Task d588acb3-bd20-4391-918f-b90b7297c3ec failed ('md5')
Mar 18 15:49:43 foreman pulpcore-worker-1: pulp [47a3e6af-31b5-43e0-9419-350bbbd73ddf]: pulpcore.tasking.pulpcore_worker:INFO:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/tasking/pulpcore_worker.py", line 377, in _perform_task
Mar 18 15:49:43 foreman pulpcore-worker-1: result = func(*args, **kwargs)
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/tasks/repository.py", line 176, in repair_version
Mar 18 15:49:43 foreman pulpcore-worker-1: loop.run_until_complete(
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/rh/rh-python38/root/usr/lib64/python3.8/asyncio/base_events.py", line 616, in run_until_complete
Mar 18 15:49:43 foreman pulpcore-worker-1: return future.result()
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/tasks/repository.py", line 150, in _repair_artifacts_for_content
Mar 18 15:49:43 foreman pulpcore-worker-1: await asyncio.gather(*done)  # Clean up tasks
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/tasks/repository.py", line 78, in _repair_ca
Mar 18 15:49:43 foreman pulpcore-worker-1: dl_result = await downloader.run()
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 259, in run
Mar 18 15:49:43 foreman pulpcore-worker-1: return await download_wrapper()
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
Mar 18 15:49:43 foreman pulpcore-worker-1: ret = await target(*args, **kwargs)
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 255, in download_wrapper
Mar 18 15:49:43 foreman pulpcore-worker-1: return await self._run(extra_data=extra_data)
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulp_rpm/app/downloaders.py", line 118, in _run
Mar 18 15:49:43 foreman pulpcore-worker-1: to_return = await self._handle_response(response)
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 207, in _handle_response
Mar 18 15:49:43 foreman pulpcore-worker-1: await self.finalize()
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/base.py", line 166, in finalize
Mar 18 15:49:43 foreman pulpcore-worker-1: self.validate_digests()
Mar 18 15:49:43 foreman pulpcore-worker-1: File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/base.py", line 215, in validate_digests
Mar 18 15:49:43 foreman pulpcore-worker-1: if expected_digest != self._digests[algorithm].hexdigest():

It looks like some artifacts are identified as missing but one file fails with ‘md5’ error.

Ah okay, so it seems to be the md5 issue. Trying this might help:

sudo -u pulp PULP_SETTINGS='/etc/pulp/settings.py'  pulpcore-manager  handle-artifact-checksums  --report --checksums md5,sha1,sha224,sha256,sha384,sha512
foreman-installer     --foreman-proxy-content-pulpcore-allowed-content-checksums md5 \
    --foreman-proxy-content-pulpcore-allowed-content-checksums sha1 \
    --foreman-proxy-content-pulpcore-allowed-content-checksums sha224 \
    --foreman-proxy-content-pulpcore-allowed-content-checksums sha256 \
    --foreman-proxy-content-pulpcore-allowed-content-checksums sha384 \
    --foreman-proxy-content-pulpcore-allowed-content-checksums sha512

Thank you Ian. This is the output of the first command, I didn’t run the second command yet, as I believe it shows something is off?

/opt/theforeman/tfm-pulpcore/root/usr/lib64/python3.8/site-packages/cryptography/hazmat/bindings/openssl/binding.py:173: CryptographyDeprecationWarning: OpenSSL version 1.0.2 is no longer supported by the OpenSSL project, please upgrade. The next version of cryptography will drop support for it.
  warnings.warn(
System check identified some issues:

WARNINGS:
?: (guardian.W001) Guardian authentication backend is not hooked. You can add this in settings as eg: `AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', 'guardian.backends.ObjectPermissionBackend')`.
Warning: the handle-artifact-checksums report is in tech preview and may change in the future.
Found 0 on-demand content units with forbidden checksums.
Found 54028 downloaded content units with forbidden or missing checksums.
There is approx. 184400.04Mb content data to be re-hashed.

Affected repository versions with present content:
/repositories/rpm/rpm/3158eabf-062f-432f-9521-f2852d1df277/versions/1/
/repositories/rpm/rpm/3b155835-839d-4fc7-b13e-77e8cdf964d7/versions/1/
/repositories/rpm/rpm/e9432baa-96b1-4f5f-89fa-978567f0e901/versions/1/
/repositories/rpm/rpm/58dbbae3-b6eb-4438-abf9-55ba302b9fb3/versions/1/
/repositories/rpm/rpm/222e4899-23a9-43aa-9ba8-92ac25007e4c/versions/1/
/repositories/rpm/rpm/06f26d4e-07d3-4117-a232-8350a096c2c6/versions/1/
/repositories/rpm/rpm/4b763cfe-3682-4d51-8aa3-c46eb1fbbc70/versions/1/
/repositories/rpm/rpm/95f4decb-25a7-47ca-809f-bfa70284bf3a/versions/1/
/repositories/rpm/rpm/611272b5-1ff5-49d2-8b56-ac826ba63da1/versions/1/
/repositories/rpm/rpm/051ef2f7-94f1-4902-b946-0695d2804b98/versions/1/
/repositories/rpm/rpm/30c36a28-fa55-459f-a3f3-01a523b5c2ca/versions/1/
/repositories/rpm/rpm/202e75a9-516b-4853-85a9-8d2b9d44f642/versions/1/
/repositories/rpm/rpm/6d14e370-ab75-4723-9a95-ab1d1e4287f4/versions/1/
/repositories/rpm/rpm/7f21804a-57d2-4adb-a3a4-ea4a566c848c/versions/2/
/repositories/rpm/rpm/0dc46a6f-0c0b-469f-8fb2-be3ffd167eca/versions/2/
/repositories/rpm/rpm/0011c008-a778-40cd-94ce-571f0af1f5ec/versions/2/
/repositories/rpm/rpm/3158eabf-062f-432f-9521-f2852d1df277/versions/2/
/repositories/rpm/rpm/cc3f6530-283d-4f8b-8a1c-83887a4929e5/versions/2/
/repositories/rpm/rpm/e9432baa-96b1-4f5f-89fa-978567f0e901/versions/2/
/repositories/rpm/rpm/b0e81fba-4e55-4966-9b1e-1fb664733b00/versions/2/
/repositories/rpm/rpm/3f79ad70-e152-4046-9624-5c074622a7bd/versions/2/
/repositories/rpm/rpm/58dbbae3-b6eb-4438-abf9-55ba302b9fb3/versions/2/
/repositories/rpm/rpm/0dc46a6f-0c0b-469f-8fb2-be3ffd167eca/versions/3/
/repositories/rpm/rpm/7f21804a-57d2-4adb-a3a4-ea4a566c848c/versions/3/
/repositories/rpm/rpm/6d14e370-ab75-4723-9a95-ab1d1e4287f4/versions/3/
/repositories/rpm/rpm/aecbb56c-54ea-4a0d-9dc9-d9938d1101b2/versions/3/
/repositories/rpm/rpm/0011c008-a778-40cd-94ce-571f0af1f5ec/versions/3/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/3/
/repositories/rpm/rpm/7f21804a-57d2-4adb-a3a4-ea4a566c848c/versions/4/
/repositories/rpm/rpm/aecbb56c-54ea-4a0d-9dc9-d9938d1101b2/versions/4/
/repositories/rpm/rpm/0dc46a6f-0c0b-469f-8fb2-be3ffd167eca/versions/4/
/repositories/rpm/rpm/0011c008-a778-40cd-94ce-571f0af1f5ec/versions/4/
/repositories/rpm/rpm/512b7545-9c52-4bdd-829b-6fd7fe274762/versions/5/
/repositories/rpm/rpm/eca8a7ba-544d-43cc-bbda-8b618fff5dd2/versions/5/
/repositories/rpm/rpm/7f21804a-57d2-4adb-a3a4-ea4a566c848c/versions/6/
/repositories/rpm/rpm/aecbb56c-54ea-4a0d-9dc9-d9938d1101b2/versions/6/
/repositories/rpm/rpm/0011c008-a778-40cd-94ce-571f0af1f5ec/versions/6/
/repositories/rpm/rpm/0dc46a6f-0c0b-469f-8fb2-be3ffd167eca/versions/6/
/repositories/rpm/rpm/f8217410-ceb4-421f-af99-c2e508ba2a5b/versions/6/
/repositories/rpm/rpm/c1cc1978-fd18-4daf-a5fd-f2fca50076fc/versions/7/
/repositories/rpm/rpm/a373c3c6-2415-4881-a682-4333d11957fc/versions/7/
/repositories/rpm/rpm/eca8a7ba-544d-43cc-bbda-8b618fff5dd2/versions/7/
/repositories/rpm/rpm/6bbf0abd-2f28-4489-a773-a8d3e1caba6e/versions/7/
/repositories/rpm/rpm/7f21804a-57d2-4adb-a3a4-ea4a566c848c/versions/8/
/repositories/rpm/rpm/eca8a7ba-544d-43cc-bbda-8b618fff5dd2/versions/9/
/repositories/rpm/rpm/4abed608-4e94-47d1-92eb-136f2ce0a39c/versions/9/
/repositories/rpm/rpm/4abed608-4e94-47d1-92eb-136f2ce0a39c/versions/10/
/repositories/rpm/rpm/512b7545-9c52-4bdd-829b-6fd7fe274762/versions/12/
/repositories/rpm/rpm/c1cc1978-fd18-4daf-a5fd-f2fca50076fc/versions/13/
/repositories/rpm/rpm/eca8a7ba-544d-43cc-bbda-8b618fff5dd2/versions/13/
/repositories/rpm/rpm/512b7545-9c52-4bdd-829b-6fd7fe274762/versions/16/
/repositories/rpm/rpm/512b7545-9c52-4bdd-829b-6fd7fe274762/versions/17/
/repositories/rpm/rpm/c1cc1978-fd18-4daf-a5fd-f2fca50076fc/versions/17/
/repositories/rpm/rpm/eca8a7ba-544d-43cc-bbda-8b618fff5dd2/versions/18/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/19/
/repositories/rpm/rpm/3aa5768e-6611-47e2-a5d1-b4767306392c/versions/19/
/repositories/rpm/rpm/c1cc1978-fd18-4daf-a5fd-f2fca50076fc/versions/21/
/repositories/rpm/rpm/c1cc1978-fd18-4daf-a5fd-f2fca50076fc/versions/23/
/repositories/rpm/rpm/3aa5768e-6611-47e2-a5d1-b4767306392c/versions/25/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/36/
/repositories/rpm/rpm/5e6556c2-dd4f-4e85-9f1d-4e2f2d939e22/versions/36/
/repositories/rpm/rpm/efefdae9-3ae6-4d6e-9f6b-93ee0d9edeef/versions/43/
/repositories/rpm/rpm/efefdae9-3ae6-4d6e-9f6b-93ee0d9edeef/versions/61/
/repositories/rpm/rpm/efefdae9-3ae6-4d6e-9f6b-93ee0d9edeef/versions/62/
/repositories/rpm/rpm/efefdae9-3ae6-4d6e-9f6b-93ee0d9edeef/versions/63/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/68/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/74/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/87/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/90/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/91/
/repositories/rpm/rpm/064aa30c-a0cd-4b30-8fe9-a6c8230637cc/versions/92/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/132/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/134/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/135/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/140/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/141/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/142/
/repositories/rpm/rpm/95cea67a-ff80-412c-b7b0-53e226e06702/versions/143/
/repositories/rpm/rpm/717c274a-a6bf-42e6-b670-150214dddfeb/versions/178/
/repositories/rpm/rpm/717c274a-a6bf-42e6-b670-150214dddfeb/versions/179/
/repositories/rpm/rpm/717c274a-a6bf-42e6-b670-150214dddfeb/versions/180/
/repositories/rpm/rpm/c175d8f6-a00b-4008-9ca5-0f42daa7a690/versions/187/
/repositories/rpm/rpm/c175d8f6-a00b-4008-9ca5-0f42daa7a690/versions/188/
/repositories/rpm/rpm/c175d8f6-a00b-4008-9ca5-0f42daa7a690/versions/189/
/repositories/rpm/rpm/5e6776c5-ad62-45a8-b8dc-7686a4e93f53/versions/196/
/repositories/rpm/rpm/5e6776c5-ad62-45a8-b8dc-7686a4e93f53/versions/197/
/repositories/rpm/rpm/5e6776c5-ad62-45a8-b8dc-7686a4e93f53/versions/198/
/repositories/rpm/rpm/5e6776c5-ad62-45a8-b8dc-7686a4e93f53/versions/199/```

Hey @rbremer, I’m just getting confirmation that you can continue with the installer step.

1 Like

@dralley I’m 99% sure that @rbremer should run sudo -u pulp PULP_SETTINGS='/etc/pulp/settings.py' pulpcore-manager handle-artifact-checksums and then the installer to fix up the md5 repository issues, is that right? From the report it seems to be the case.

The easiest thing to do, if your threat model permits it, is to allow md5 checksums. Otherwise yes I think that sounds correct @iballou

2 Likes

Thanks @dralley. @rbremer you can proceed to run the foreman-installer command above.

@iballou Did that, unfortunately, looks like we have to really repair the checksums first, as the foreman-installer fails with:

2022-03-19 11:57:49 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]: Starting to evaluate the resource (2091 of 2198)
2022-03-19 11:57:49 [DEBUG ] [configure] Exec[pulpcore-manager reset-admin-password --random](provider=posix): Executing check 'pulpcore-manager dumpdata auth.User | grep "\"username\": \"admin\""'
2022-03-19 11:57:49 [DEBUG ] [configure] Executing with uid=pulp: 'pulpcore-manager dumpdata auth.User | grep "\"username\": \"admin\""'
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless: /opt/theforeman/tfm-pulpcore/root/usr/lib64/python3.8/site-packages/cryptography/hazmat/bindings/openssl/binding.py:173: CryptographyDeprecationWarning: OpenSSL version 1.0.2 is no longer supported by the OpenSSL project, please upgrade. The next version of cryptography will drop support for it.
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   warnings.warn(
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless: Traceback (most recent call last):
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/bin/pulpcore-manager", line 11, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     load_entry_point('pulpcore==3.16.3', 'console_scripts', 'pulpcore-manager')()
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/manage.py", line 11, in manage
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     execute_from_command_line(sys.argv)
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     utility.execute()
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     django.setup()
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     apps.populate(settings.INSTALLED_APPS)
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/apps/registry.py", line 114, in populate
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     app_config.import_models()
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/apps/config.py", line 301, in import_models
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     self.models_module = import_module(models_module_name)
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/rh/rh-python38/root/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     return _bootstrap._gcd_import(name[level:], package, level)
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "<frozen importlib._bootstrap>", line 991, in _find_and_load
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "<frozen importlib._bootstrap_external>", line 843, in exec_module
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/models/__init__.py", line 24, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     from .exporter import (  # noqa
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/models/exporter.py", line 11, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     from pulpcore.app.models.repository import Repository
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/models/repository.py", line 22, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     from pulpcore.cache import Cache
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/cache/__init__.py", line 1, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     from .cache import Cache, AsyncCache, ContentCache, CacheKeys  # noqa
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/cache/cache.py", line 7, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     from pulpcore.app.settings import settings
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/settings.py", line 415, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     raise e
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:   File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/settings.py", line 374, in <module>
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless:     raise ImproperlyConfigured(
2022-03-19 11:57:53 [DEBUG ] [configure] /Stage[main]/Pulpcore::Database/Pulpcore::Admin[reset-admin-password --random]/Exec[pulpcore-manager reset-admin-password --random]/unless: django.core.exceptions.ImproperlyConfigured: There have been identified artifacts missing checksum 'md5'. Run 'pulpcore-manager handle-artifact-checksums' first to populate missing artifact checksums.

I will execute the handle-artifact-checksums command first and update you on the result.

Ok, now I hit a catch22. Apparently I can’t run the above command:

[root@foreman ~]# sudo -u pulp PULP_SETTINGS='/etc/pulp/settings.py' pulpcore-manager handle-artifact-checksums
/opt/theforeman/tfm-pulpcore/root/usr/lib64/python3.8/site-packages/cryptography/hazmat/bindings/openssl/binding.py:173: CryptographyDeprecationWarning: OpenSSL version 1.0.2 is no longer supported by the OpenSSL project, please upgrade. The next version of cryptography will drop support for it.
  warnings.warn(
System check identified some issues:

WARNINGS:
?: (guardian.W001) Guardian authentication backend is not hooked. You can add this in settings as eg: `AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', 'guardian.backends.ObjectPermissionBackend')`.
Restoring missing file /var/lib/pulp/media/artifact/49/d6fdc1ad0a446e0affee271f66ca847f2facb538203dab2a713474ce812618
Traceback (most recent call last):
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/management/commands/handle-artifact-checksums.py", line 181, in handle
    for chunk in fp.chunks(CHUNK_SIZE):
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/base.py", line 55, in chunks
    self.seek(0)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/utils.py", line 46, in <lambda>
    seek = property(lambda self: self.file.seek)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/db/models/fields/files.py", line 45, in _get_file
    self._file = self.storage.open(self.name, 'rb')
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/storage.py", line 38, in open
    return self._open(name, mode)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/storage.py", line 238, in _open
    return File(open(self.path(name), mode))
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/pulp/media/artifact/49/d6fdc1ad0a446e0affee271f66ca847f2facb538203dab2a713474ce812618'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/theforeman/tfm-pulpcore/root/usr/bin/pulpcore-manager", line 11, in <module>
    load_entry_point('pulpcore==3.16.3', 'console_scripts', 'pulpcore-manager')()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/manage.py", line 11, in manage
    execute_from_command_line(sys.argv)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/management/commands/handle-artifact-checksums.py", line 186, in handle
    restored = self._download_artifact(a, checksum, file_path)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/management/commands/handle-artifact-checksums.py", line 127, in _download_artifact
    dl_result = downloader.fetch()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/base.py", line 180, in fetch
    return done.pop().result()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 259, in run
    return await download_wrapper()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 255, in download_wrapper
    return await self._run(extra_data=extra_data)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulp_rpm/app/downloaders.py", line 118, in _run
    to_return = await self._handle_response(response)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 209, in _handle_response
    await self.handle_data(chunk)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/base.py", line 142, in handle_data
    self._ensure_writer_has_open_file()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/base.py", line 125, in _ensure_writer_has_open_file
    self._writer = tempfile.NamedTemporaryFile(dir=os.getcwd(), delete=False)
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/tempfile.py", line 540, in NamedTemporaryFile
    (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/tempfile.py", line 250, in _mkstemp_inner
    fd = _os.open(file, flags, 0o600)
PermissionError: [Errno 13] Permission denied: '/root/tmpsq1eqbf_'

but I can’t perform the “validate checksum” on the repo to download the missing artifacts without repairing the checksum first.

@dralley do you think the global repair feature could potentially help with the missing artifacts? Repairing Pulp — Pulp Project 3.18.2 documentation

Actually, @rbremer, it looks like the “Permission denied” error could be the root issue. Try CDing to /tmp/ before running the command. It seems Pulp cannot create the temp files in /.

@iballou Thank you for the suggestion, I tried it but the command still fails:

[root@foreman tmp]# sudo -u pulp PULP_SETTINGS='/etc/pulp/settings.py' pulpcore-manager handle-artifact-checksums
/opt/theforeman/tfm-pulpcore/root/usr/lib64/python3.8/site-packages/cryptography/hazmat/bindings/openssl/binding.py:173: CryptographyDeprecationWarning: OpenSSL version 1.0.2 is no longer supported by the OpenSSL project, please upgrade. The next version of cryptography will drop support for it.
  warnings.warn(
System check identified some issues:

WARNINGS:
?: (guardian.W001) Guardian authentication backend is not hooked. You can add this in settings as eg: `AUTHENTICATION_BACKENDS = ('django.contrib.auth.backends.ModelBackend', 'guardian.backends.ObjectPermissionBackend')`.
Restoring missing file /var/lib/pulp/media/artifact/49/d6fdc1ad0a446e0affee271f66ca847f2facb538203dab2a713474ce812618
Restoring missing file /var/lib/pulp/media/artifact/19/39ce298615e1d7cc6d04708f47684ae70a86f76a0476c4a8222c64b7efcf32
Restoring missing file /var/lib/pulp/media/artifact/a5/8acb04f1953606e348776360bbfbeed5946ca5ce7f68c8e798b26382accc59
Restoring missing file /var/lib/pulp/media/artifact/32/75f06333c46fe863019c14709670f0b44aa6154fcf5121a3ae1c7d941b0bd6
Restoring missing file /var/lib/pulp/media/artifact/38/142eb1ffcb6384f464bf3912f818a53322b1d069ce6ff7e1e979e58d025fd6
Restoring missing file /var/lib/pulp/media/artifact/44/64e75ffc120ddf191640aa46e386170782daeca850051e9f4d3b597ff33454
Restoring missing file /var/lib/pulp/media/artifact/70/65ee4e2b2aa44a3bc82db1d397f87c396f678b4a82f4eb66e5b74c64bb8c1e
Restoring missing file /var/lib/pulp/media/artifact/ef/a1d51e9e6a2477f732b1eb9dcb1b3cc2452aaa0d39f30e714d644e2f418761
Restoring missing file /var/lib/pulp/media/artifact/fe/2aac9dd519b4bb0b7568285aae81a5cf56fb08a18dc5064a59b01486ae74d9
Restoring missing file /var/lib/pulp/media/artifact/ba/5cb0dea77048bb6dbf64690bc70fef99f5a12396f5ae116c38210be010057c
Restoring missing file /var/lib/pulp/media/artifact/0e/00deb9f0d6962e5f3ad7ab30d09913acfad3e56c2e86a5f47b83b0daf97b0d
Restoring missing file /var/lib/pulp/media/artifact/8d/49ba47ccf417f343a248a5e58dd0ae85a5e6c773fcfe078c1f8118df5249c4
Restoring missing file /var/lib/pulp/media/artifact/e3/3666347d5affb3645a24e2882962cbdd6f6fb1e5ae11b9ef8b9d3facb33b78
Restoring missing file /var/lib/pulp/media/artifact/38/e18169537cfada9626d0b2d08061db4ef2f922ff0cfcc13e67de8b9ad2c863
Restoring missing file /var/lib/pulp/media/artifact/5b/3f1344d732759905e70352ee390557fcbfcd9f1f18bd4ef07de140fa5602f4
Restoring missing file /var/lib/pulp/media/artifact/5d/4c6d4b08d4248cb4aa146aa1105adcfa391b5f8c57ef765cd585112f398b8e
Restoring missing file /var/lib/pulp/media/artifact/f6/832af96423097a574b288aea0748eab92c2dcf43e63e006ace9fd331f1bed1
Restoring missing file /var/lib/pulp/media/artifact/23/cf00d60ab7e28b3bdedb95be0eea7f93dfbc0eda4aaecc3dd241eac7ee0628
Restoring missing file /var/lib/pulp/media/artifact/11/1bad70a9c4dcd5e477c992e426498a7a728245cf860fdbad464d8915e6bc73
Restoring missing file /var/lib/pulp/media/artifact/44/6209516c0f0cf62ca07a9d2b17c0c79c472363604e0f76f4fc07c51b607c7b
Restoring missing file /var/lib/pulp/media/artifact/bd/ce51a03e32c987261652b0d6a0eff94bf6be7f0c667df7e874fe952b3f31f3
Restoring missing file /var/lib/pulp/media/artifact/fe/342ab3d7e3b76f867992f503fe336d2325e614d4cc638cba79dac42425b1c9
Restoring missing file /var/lib/pulp/media/artifact/0f/274297e424c0a3f479f041c377d5ede8551d583b4cd485a4cd945cc70b5c56
Restoring missing file /var/lib/pulp/media/artifact/28/7c2b230b29604ac92dd3497d39c265c16f17472244b71d7b737ea383c0588e
Restoring missing file /var/lib/pulp/media/artifact/6e/4540fe9645f11a9e24fed4bf4ab6f49eba215a48b2dd4fa62d8024b213da71
Restoring missing file /var/lib/pulp/media/artifact/56/f30f4fa5986bc18c745e7490374ac0d8457b4d0e04c1b6b0d03c9329e6d20e
Restoring missing file /var/lib/pulp/media/artifact/5d/0a1b5ac0964ae22d9f860f9c7f0ce1933c9dbed54cdcdd5c2b83c40ec0b51d
Restoring missing file /var/lib/pulp/media/artifact/69/623f8df8899becb30009257b452856a53e00571f7eadb815eede7920fd6e14
Restoring missing file /var/lib/pulp/media/artifact/fa/0375565a86878cac461bde4be235351ffa241d7d4a6db05dc81a375f1476c6
Restoring missing file /var/lib/pulp/media/artifact/38/7c721305afad30056b43f00380eb4bf640c36197aba68f4a1128821ee7eeb5
Restoring missing file /var/lib/pulp/media/artifact/4e/6d946c89cc23375fbe38b001f0df4aa668eeaae8c633588304f807aa53f9b7
Restoring missing file /var/lib/pulp/media/artifact/d1/5dd104f59377c8df175605e39778a9441234a8237c04ad8d178493f76c0d08
Restoring missing file /var/lib/pulp/media/artifact/d2/af432843f4db506b142414f331a8cdaa905ca8b5895ec0de7b66c0c21d8bc4
Restoring missing file /var/lib/pulp/media/artifact/87/4adadc57f8e0b67efe3996ae6805257a51fca7a8e1842667af8cf27d26c998
Restoring missing file /var/lib/pulp/media/artifact/f1/318e1bfb7bf43524fafbae51811cf545f620830e05cf116bde2ebe95306656
Restoring missing file /var/lib/pulp/media/artifact/e1/c4ee8bfa90b94384db5ca0efa3ccfb933b9e332db3e720673f1c5598e6bd96
Restoring missing file /var/lib/pulp/media/artifact/ff/364c6868f892212307e6870a79d8dd5e702f5b39370695a9f7364fb16f8735
Restoring missing file /var/lib/pulp/media/artifact/2b/4d5f7245b3c09a833c5f25b38c8c5de74d124883a033fce3da012de2648957
Restoring missing file /var/lib/pulp/media/artifact/15/572c0e0f34a88a4ad9405ec5ed933ca99afc2b8452d740ba801d5caf33d9cf
Restoring missing file /var/lib/pulp/media/artifact/7b/d3ad626347f1ac109ded3dafe350cb147a5bcb6210d599177c8088f94d16c7
Restoring missing file /var/lib/pulp/media/artifact/94/ba6a1118062a00f15c8d5f86d55c6a086a4cfd52ba025d10359340e4f72041
Restoring missing file /var/lib/pulp/media/artifact/96/888a117207ec544f0312e1110ea80c864be506bc9f73bd1acb9361b622a8ac
Giving up download_wrapper(...) after 1 tries (aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('http://ftp.halifax.rwth-aachen.de/fedora-epel/7/x86_64/Packages/a/anope-mysql-2.0.9-3.el7.x86_64.rpm?repo=epel-7&arch=x86_64'))
pulp [None]: backoff:ERROR: Giving up download_wrapper(...) after 1 tries (aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('http://ftp.halifax.rwth-aachen.de/fedora-epel/7/x86_64/Packages/a/anope-mysql-2.0.9-3.el7.x86_64.rpm?repo=epel-7&arch=x86_64'))
Traceback (most recent call last):
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/management/commands/handle-artifact-checksums.py", line 181, in handle
    for chunk in fp.chunks(CHUNK_SIZE):
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/base.py", line 55, in chunks
    self.seek(0)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/utils.py", line 46, in <lambda>
    seek = property(lambda self: self.file.seek)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/db/models/fields/files.py", line 45, in _get_file
    self._file = self.storage.open(self.name, 'rb')
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/storage.py", line 38, in open
    return self._open(name, mode)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/files/storage.py", line 238, in _open
    return File(open(self.path(name), mode))
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/pulp/media/artifact/96/888a117207ec544f0312e1110ea80c864be506bc9f73bd1acb9361b622a8ac'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/theforeman/tfm-pulpcore/root/usr/bin/pulpcore-manager", line 11, in <module>
    load_entry_point('pulpcore==3.16.3', 'console_scripts', 'pulpcore-manager')()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/manage.py", line 11, in manage
    execute_from_command_line(sys.argv)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
    output = self.handle(*args, **options)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/management/commands/handle-artifact-checksums.py", line 186, in handle
    restored = self._download_artifact(a, checksum, file_path)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/app/management/commands/handle-artifact-checksums.py", line 127, in _download_artifact
    dl_result = downloader.fetch()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/base.py", line 180, in fetch
    return done.pop().result()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 259, in run
    return await download_wrapper()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulpcore/download/http.py", line 255, in download_wrapper
    return await self._run(extra_data=extra_data)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulp_rpm/app/downloaders.py", line 117, in _run
    self.raise_for_status(response)
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib/python3.8/site-packages/pulp_rpm/app/downloaders.py", line 102, in raise_for_status
    response.raise_for_status()
  File "/opt/theforeman/tfm-pulpcore/root/usr/lib64/python3.8/site-packages/aiohttp/client_reqrep.py", line 998, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 404, message='Not Found', url=URL('http://ftp.halifax.rwth-aachen.de/fedora-epel/7/x86_64/Packages/a/anope-mysql-2.0.9-3.el7.x86_64.rpm?repo=epel-7&arch=x86_64')

But we get a clearer picture now. There are artifacts inside the DB, which no longer exist upstream. The repository is set to “content only”, so it should remove them. I tried a regular sync before, but apparently this sync did not remove the no longer existing content.

According to the “Repairing Pulp” link you sent before its clearly stated, that the repair does not deal with this kind of situation. To be honest, I don’t know why, because a full sync should just remove all local artifacts and DB entries for content no longer available upstream, but since I have no deeper understanding of Pulp, I am sure there are good reasons for that.

Would it be an option to create a new repository with a different uplink mirror? I remember I tried this before (older Katello release), and it looked to me as if Pulp is too smart, not downloading again what’s already in the DB, so I ended up in the same place.

Some more info:
I tried to manually remove the affected package shown above from the repo:

[root@foreman tmp]# hammer package list --search anope-mysql-2.0.9-3.el7.x86_64.rpm
------|------------------------------------|--------------------------
ID    | FILENAME                           | SOURCE RPM
------|------------------------------------|--------------------------
62691 | anope-mysql-2.0.9-3.el7.x86_64.rpm | anope-2.0.9-3.el7.src.rpm
------|------------------------------------|--------------------------
[root@foreman tmp]# hammer repository remove-content --id 2454 --ids 62691
Repository content removed.

and after ran the handle-artifact-checksum command again, hoping it would realize, that this package is no longer part of the repo. Unfortunately, it did not as it tried to download it again and failed with the same error I showed before.