2

I stupidly did "yum remove python" which also ended up removing all the packages that required python as well.

Luckily, I have access to another Linux machine that is a near clone of this machine, and it still has all those packages installed. The catch is that it belongs to someone else and I can, at most, poke around. I also don't know what to specifically re-install on my machine. The list (when I removed python) was humongous.

I was wondering if there were any commands I could enter into this twin machine that could tell me: Of the currently installed packages, which ones depend on python? I could then use that list to manually re-install each one back on my own machine. So it's really more of the python dependents, not dependencies.

From looking around, I came across such commands like "repoquery --whatrequires" & "rpm --whatrequires", but these don't seem to generate the same list as "yum remove python".

The 2 machines run RHEL 6.

  • Yeah, --whatrequires should include everything that depends on python. You just want everything that depends on python that you had previously installed. – drs Jul 11 '14 at 15:26
3

Assuming the clones had the same packages installed before you removed python, a sure-fire way to get the list of packages needed would be to compare rpm -qa from each clone.

# on clone 1:
rpm -qa | sort > clone1.txt

# on clone 2:
rpm -qa | sort > clone2.txt

Get clone1.txt and clone2.txt on the same computer. Then run

comm -13 clone1.txt clone2.txt

to see which rpms are on Clone 2 and not Clone 1.

2

You may have /var/log/rpmpkgs which has a list of all the RPM packages installed. (in RHEL 6 that list is generated by the package rpm-cron) If you have the list of packages you may look at /var/log/yum.log to see what packages were uninstalled.

2

Actually, you can undo a yum command. On the computer with python removed, try running yum history:

yum history
Loaded plugins: langpacks, refresh-packagekit
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   284 | yum remove python        | 2014-07-09 14:47 | Remove         |  1213   
...

Identify the line of yum remove python and note the ID

yum history undo 284

However, yum should depend on python so you may have removed yum as well. If so you'll have to download it and its dependencies manually again. First check that your system has the needed dependencies (this list was generated on a Fedora 19 system, so double-check with your RHEL 6 clone):

[root@localhost ~]# repoquery -R yum
/usr/bin/python
pygpgme
pyliblzma
python >= 2.4
python(abi) = 2.7
python-iniparse
python-sqlite
python-urlgrabber >= 3.9.0-8
pyxattr
rpm >= 4.4.2
rpm-python
yum-metadata-parser >= 1.1.0

For each that you're missing, download the package from your RHEL 6 sources and install it manually with rpm.

Generally removing packages doesn't remove all of their configuration files. I don't know about yum. Hopefully the yum history database is still intact after reinstalling it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.