RHEL: subscription-manager, release pinning and ABRT cleanup
subscription-manager commands for subscription and release pinning, plus ABRT report cleanup.
Cheat sheet for managing the Red Hat subscription of a RHEL server with subscription-manager, pinning a minor release and cleaning ABRT reports.
Status and registration
sudo subscription-manager status
sudo subscription-manager list --consumed
sudo subscription-manager list
subscription-manager list --available
subscription-manager register --username <username>
The /etc/sysconfig/rhn/systemid file identifies a system registered through the legacy RHN mechanism. For the latter:
rhnreg_ks --profilename=my_rhel_system01 --username=<username> --password=<PASSWORD>
See also the Red Hat registration assistant.
Pinning a release
The principle is described in How to tie a system to a specific update of Red Hat Enterprise Linux.
# show the current release
sudo subscription-manager release
# set a release
subscription-manager release --set=8.6
yum clean all
# remove the pin
subscription-manager release --unset
yum clean all
# check
subscription-manager repos
subscription-manager release --show
Removing subscriptions
subscription-manager remove --all
subscription-manager unregister
subscription-manager clean
subscription-manager unsubscribe --all also removes all consumed subscriptions.
ABRT cleanup
Useful abrt-cli commands (configuration in /etc/abrt/abrt.conf):
abrt-cli status
abrt-cli list
abrt-cli remove /var/spool/abrt/<report_directory>
abrt-cli process
Script removing reports older than 10 days (services are stopped during the operation and restarted afterwards):
#!/bin/bash
set -e
function cleanup()
{
systemctl start abrtd
systemctl start abrt-oops
}
trap cleanup EXIT
systemctl stop abrt-oops
find /var/spool/abrt/ -type d -ctime +10 -exec abrt-cli rm {} \;
cleanup