Cloning RHEL8 Repositories

Latest response

I ran into a really strange issue using cloned RHEL8 repositories (BaseOS and AppStream). When I attempted to install virtualization related packages, DNF would attempt to install older packages. This led to different dependency issues and failed install attempts.

What was even stranger was the repository I was pulling packages from had the packages I was looking for. When I would try and check (yum list libvirt-daemon-kvm --showduplicates) for the different versions of a package, the packages were not showing up.

After going back and forth with Red Hat support, I wasn't making progress and decided to nuke my repositories. After a fresh reposync and creating copies of my repositories I was able to see the problem. My newly created AppStream repositories did not contain module information or update information.

Red Hat support says you don't need to do a createrepo on RHEL8 repositories if you are creating copies. This is true if you don't need to make changes to the repository. For various reasons, we sign every package, including the repodata of our repositories. This means we need to do a createrepo.

The tricky part is getting the module info and update info. Without those, your repositories are virtually useless.

So here is what you need to do:
Repository A: repository that does reposync
Repository B: cloned repository

1) Extract module info from repo_A

cd repo_A/repodata
module_file=`ls -S -l *-modules.yaml.gz | head -n 1 | rev| cut -d" " -f1 | rev`
gunzip -c $module_file > ../modules.yaml

2) Extract update info from repo A

cd repo_A/repodata
update_file=`ls -S -l *-updateinfo.xml.gz | head -n 1 | rev| cut -d" " -f1 | rev`
gunzip -c $update_file > ../updateinfo.xml

3) Make a copy of your repo

cp repo_A repo_B

4) Copy modules.yaml file and updateinfo.xml from repo_A to repo_B

cd repo_A
cp modules.yaml repo_B
cp updateinfo.xml repo_B

5) Make changes to repo_B.
sign packages, add packages, whatever

6) Get rid of repo data for repo_B

rm -rf repo_B/repodata

7) Re-generate repodata of repo_B

cd repo_B
createrepo -g comps.xml ./

8) When you recreate the repo, the module.yaml file in repo_B will automatically get pulled into the repodata, but not the updateinfo. As a last step, you need to update the repodata to include updateinfo.xml

cd repo_B
modifyrepo updateinfo.xml repodata

9) As a last step, you can optionally sign the repodata.

This appears to only affect AppStream repositories as they contain module or update related information. BaseOS does not require this information.

Hope this helps someone.

Responses