How to delete orphaned content in /var/lib/pulp on Capsule?
Environment
- Red Hat Satellite 6
- External Capsule
Issue
- Disabling some synchronized repositories or deleting old Content View versions leave orphaned content under
/var/lib/pulp - Satellite has
/etc/cron.weekly/katello-remove-orphansor/etc/cron.d/katelloscript to identify such content and delete it - Capsule does not have such a cleaning mechanism, causing no space is ever cleaned from Capsule's
/var/lib/pulp - How to remove orphaned content from Capsule to prevent disk full?
Resolution
Notice: the below procedure works for removing orphaned RPM content. To get rid of other types of content, an analogous procedure should be followed. E.g. for docker containers, one should install pulp-docker-admin-extensions.noarch package and list docker repo list instead of rpm repo list. Such procedures have not been verified by Red Hat, yet.
- Identify and delete the redundant / not further used repositories manually, and then clean orphaned content on the Capsule.
-
clean orphaned content on Satellite:
foreman-rake katello:delete_orphaned_content RAILS_ENV=production >/dev/null
-
For Satellite 6.9 and older, the pulp-admin command is available:
- install [pulp-admin](https://access.redhat.com/solutions/1295653) both on Satellite and Capsule
- list repositories on **both** Satellite and Capsule
pulpAdminPassword=$(grep ^default_password /etc/pulp/server.conf | cut -d' ' -f2)
pulp-admin -u admin -p $pulpAdminPassword rpm repo list | tr '\n' ';' | sed "s/; //g" | tr ';' '\n'
> pulp_admin_repo_list.$(hostname -f).txt
- copy the list from the Satellite to the Capsule - below the files are differentiated by hostnames `satellite.example.com` and `capsule.example.com`
- identify and remove repositories that are present on the Capsule but dont exist on the Satellite - run on the Capsule:
for repo_id in $(grep Id pulp_admin_repo_list.capsule.example.com.txt | awk '{ print $2 }'); do
if [ $(grep -c "${repo_id}$" pulp_admin_repo_list.satellite.example.com.txt) -eq 0 ]; then
pulp-admin -u admin -p $pulpAdminPassword rpm repo delete --repo-id $repo_id
fi
done
- remove orphaned content on the Capsule:
pulp-admin -u admin -p $pulpAdminPassword orphan remove --all
For more KB articles/solutions related to Red Hat Satellite 6.x Pulp 2.0 Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Pulp 2.0-related Issues
Root Cause
- While Satellite has a tool (executed weekly by
cron) to identify and remove orphaned content, no such tool exists for Capsule. - This is tracked under This content is not included.this bugzilla.
- Satellite 6.6 for RHEL7 has added task via RHSA-2019:3172
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.