How to delete a Red Hat Base channel from Red Hat Satellite?

Solution Verified - Updated -

Environment

  • Red Hat Satellite 5.x

Issue

  • How to delete or remove Red Hat Base channels from Red Hat Satellite server ?
  • How to delete unused Red Hat Base channels from Red Hat Satellite server?
  • How to delete channel from Satellite ?

Resolution

RHN Satellite v5.3 and newer

The "spacewalk-remove-channel" utility can now be used to remove a software channel:

# /usr/bin/spacewalk-remove-channel -c channel_label

This command must be run as root on the same Satellite server from which the channel is being removed. If any systems are subscribed to that channel, the names of those systems are printed to standard output and the script exits without removing the channel. The --unsubscribe flag can be supplied on the command line to automatically unsubscribe those systems from the channel that is being removed. To use this command you need to have spacewalk-backend-tools-0.5.28-49 package on RHN Satellite server.

RHN Satellite v5.2 and older

As there is no such feature supported on RHN Satellite v5.2 and older versions, the following information has been provided by Red Hat, but is outside the scope of our posted Service Level Agreements (https://www.redhat.com/support/service/sla/) and support procedures. The information is provided as-is and any configuration settings or installed applications made from the information in this article could make your Operating System unsupported by Red Hat Support Services. The intent of this article is to provide you with information to accomplish your system needs. Use the information in this article at your own risk.

A script can be used to remove Red Hat provided channels from RHN Satellite. However, this script does not perform any checks, and its changes are not reversible. Therefore, it is extremely important to take precautions before performing this procedure.

The following pre-requisites must be met:

  1. Make sure the channel is not being used anymore. In particular:

    • There are no systems registered to the channel that is going to be deleted from the Satellite.

    • There are no kickstart profiles using the channel.

    • There are no activation keys defined that refer to the channel.

    • There are no custom channels or packages depending on the channel.

  2. Make a backup of the Satellite database. The procedure for performing database backups is documented on the Satellite Installation Guide.

   3.  The script that deletes channels is called satrm.py:

cd /usr/share/rhn
PYTHONPATH=/usr/share/rhn/ python satellite_tools/satrm.py -l
PYTHONPATH=/usr/share/rhn/ python satellite_tools/satrm.py --channel=channel-label

For example, to permanently remove the Red Hat Enterprise Linux 3 WS channel after making sure it is no longer in use:

cd /usr/share/rhn
PYTHONPATH=/usr/share/rhn/ python satellite_tools/satrm.py --channel=rhel-i386-ws-3

The following steps should be done after you run the sartm.py script:

  1. Stop your RHN satellite by  issuing "service rhn-satellite stop"
  2. Delete everything in "/var/cache/rhn", but keep "/var/cache/rhn/satsync"
  3. Start your RHN satellite by issuing "service rhn-satellite start"
  4. Resync the  RHN Satellite with RHN Network by issuing "satellite-sync"
  5. The metadata will now re-generated, depending on your hardware and the amount of channels, this can take quite some time. During this rebuild the RHN Satellite is not usable.
  6. Clean your yum caches on clients as needed.

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.

7 Comments

This will remove the channel from the GUI but it still uses up the storage down /var/satellite. Is there a way to clean-up the used space by the unwanted channels packages/errata you just made disappear from the GUI?

The spacewalk-remove-channel command isn't consistent with removing the files from /var/satellite. It removed all the files for the first channel I ran the command on but not the second.

I would think the best option here would be to go within "Manage Software Channels->Manage Software Packages" - select the channel you're going to remove, select all packages within that channel and confirm for deletion. Once this has been completed, the channel should contain no packages (the last step removed them from /var/satellite) - you should be able to run the spacewalk-remove-channel command to pull from the GUI.

I'd need confirmation from Redhat that the "manage software packages" deletion step actually removes the packages from /var/satellite....

I see evidence that it does remove the packages from disk. I removed rhel-s390x-server-5 which had about 4,000 packages and my /var/satellite usage went from 91% used to 80% (about 12G).

Satellite 5.6 on RHEL 5.

The RPMs are removed only when they are no longer associated with any channel.

See also: https://access.redhat.com/solutions/20988

Thannks for posting the information!