1

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.

1
  • Not easy to fix, probably a reinstallation is in order. Python is a core part of the system, removing it also removes most of the tools needed to manage packages. Commented Oct 14, 2021 at 17:50

2 Answers 2

0

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
  • Thanks for the response but I am getting the below error after running "dnf history undo last" command: Error: The following problems occurred while running a transaction: Cannot find rpm nevra "python3-dateutil-1:2.6.1-6.el8.noarch". Cannot find rpm nevra "subscription-manager-1.28.13-4.el8_4.x86_64". Cannot find rpm nevra "subscription-manager-cockpit-1.28.13-4.el8_4.noarch". Cannot find rpm nevra "usermode-1.113-1.el8.x86_64". Cannot find rpm nevra "yum-utils-4.0.18-4.el8.noarch". Commented Oct 18, 2021 at 9:58
0
  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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .