Accidentally removed python3-dateutil from RHEL 8

Posted on

Problem :

I was trying to fix a setup issue related to airflow and accidentally I removed python3-dateutil from the machine (RHEL 8) using sudo yum remove python3-dateutil this also lead to the removal of dependant packages like dnf-plugin-spacewalk, dnf-plugins-core, rhn-setup, rhnsd, subscription-manager, subscription-manager-cockpit, yum-utils and some various other unused dependencies like dnf-plugin-subscription-manager, rhn-check, rhsm-icons, subscription-manager-rhsm-certificates, usermode and etc.

Now when I am trying to reinstall python3-dateutil using sudo yum install python3-dateutil, it’s giving Error: There are no enabled repositories in “/etc/yum.repos.d”, “/etc/yum/repos.d”, “/etc/distro.repos.d”. None of the yum command is working.

Someone how knows how to fix this issue kindly help.

Solution :

A very similar question was asked in the post
CentOS 8 – uninstalled python, How to recover laptop?

The answer that was given is as follows:

You could revert the last transaction with:

dnf history undo last

Since you already ran something else, reverting last won’t restore to
the desired state. List the last 5 transactions:

dnf history list | head -n5

Then rollback to the one prior to the ID that corresponds to when
you mistakenly deleted Python, e.g.:

dnf history rollback 123

The 123 should be a transaction that was before you deleted
Python, aka “last good transaction”.

  1. List the packages you uninstalled using dnf history|head + dnf history info <num>
  2. Open to the Red Hat Package Browser. And choose your product in the drop-down menu. For me, it is “Red Hat Enterprise Linux for x86_64“.
  3. Search for every package one by one and click “noarch” or “x86_64” depending on your architecture and package availability.
  4. Select the version in the drop-down menu that corresponds to the version you listed in step 1.
  5. Download the package (Not the one marked source)
  6. Send the RPMs to your server/workstation
  7. Run sudo dnf localinstall *.rpm

Leave a Reply

Your email address will not be published. Required fields are marked *