I have an offline repo however it’s missing modular metadata. I ran createrepo to try and repair the repo. However I can still see the metadat is missing. How can I fix this?
Running createrepo will destroy modular data in a repository. It’s easier to redo the reposync to get the repo data back.
# rocky 8 dnf reposync -g --delete -p /path/to/baseos --download-metadata --repoid=baseos dnf reposync -g --delete -p /path/to/appstream --download-metadata --repoid=appstream dnf reposync -g --delete -p /path/to/powertools --download-metadata --repoid=powertools dnf reposync -g --delete -p /path/to/extras --download-metadata --repoid=extras # rocky 9 dnf reposync -g --delete -p /path/to/baseos --download-metadata --repoid=baseos dnf reposync -g --delete -p /path/to/appstream --download-metadata --repoid=appstream dnf reposync -g --delete -p /path/to/powertools --download-metadata --repoid=crb dnf reposync -g --delete -p /path/to/extras --download-metadata --repoid=extras
What @nazunalika said is without doubt the best answer for a local repo mirror.
OTOH: There are scenarios where you can use “createrepo_c” with the --update flag. Provided you have a comps.xml for the repo in question.
Likewise “modifyrepo_c” can be called with --mdtype=modules by pointing it to your modules.yaml.
We do custom rebuilds of EL8 and EL9 ISO images and replace or drop in around 1200 RPMs in our special builds, which forces us to update the local repository on the ISO as well. A traditional createrepo call would trash the module data, so we use this work around:
createrepo_c --update -g /home/build_cd/ISO/Minimal/comps.xml /home/build_cd/ISO/Minimal modifyrepo_c --mdtype=modules /home/build_cd/ISO/Minimal/modules.yaml /home/build_cd/ISO/Minimal/
Like said: This depends on having a comps.xml and modules.yaml that match your repository layout and that might not be a given in your situation.
Thank for the response. Is possible to build the repo from the DVD ISO? Than run the reposync after that? I built a repo using the DVD. Installed python2 to ensure the required metadate was there. Ran reposync from an existing repo that is missing the modules metadata but looks like the metadat is erased after the reposync completes . Which puts me back ot your solution.
Is possible to build the repo from the DVD ISO?
Depends on what you want to achieve. Do you want a local mirror that is in sync with one of the official mirrors? In that case this wouldn’t be the best of ideas and I’d rather recommend reposync or (if supported by the mirror) rsync.
If you just need a one-shot local mirror that has the DVD RPMs and doesn’t get updates from an official mirror? Then my suggested method should work.
If you want a local copy of the official mirror and want a repository with your own RPMs that aren’t available upstream? In that case the easiest approach is to split this in two:
1.) Create a local copy of the official mirror using “reposync”.
2.) Stuff your own RPMs into a second and separate local repository and create the meta-data for it. If your local and custom repo doesn’t provide modular RPMs, then you don’t need to create modular meta-data for it and can skip usage of a comps.xml and
modules.yaml and just create the metadata with “createrepo_c”.