Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088
Rep:
You can't use the rpm command either
I would suggest that the best way may be to find the source for the rpm program, and compile it. However, this may lead to additional problems that will be hard to solve due to missing dependencies.
Perhaps the easiest way would be to back up your data and reinstall.
Also, be very, very careful when running as root in future
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790
Rep:
You are in quite a pickel, others have suggested to backup and re-install or to use the tar file which both are quite good ideas. But there is one other way that might work.
From a similar system (same family version) copy the /usr/lib/rpm/ directory to the same location on the affected system, also copy the /bin/rpm file to the same location on the affected system. You also need the rpm package that was removed on the system. After you get all of this in place try from where the rpm package is located and try something like;
/usr/lib/rpm/rpmi -ivh <the filename of the rpm package here>
I would also try first the method Lenard explained. If the command fails because of the files already existing, try using the force switch too, if it works (I'm not 100% sure, but I think it was --force).
However, to prevent this from happening in the future, you should not be able to say "somebody accidentally run 'rpm -e rpm'"; the right to use rpm should only be allowed to the system administrator (because otherwise people could install whatever they want on the system, including software that helped them breach the system or even use it as a tool to do harm to other machines over ethernet, for example), and that person should know well what to do. It's generally a good idea to run rpm in the "test mode", whatever it was called, so that rpm tests to see if the wanted procedure would successfully work out but nothing was "really" done. And after that, if it went ok, run the actual rpm command to install, remove or update software.
By the way, shouldn't rpm ask you if you really want to remove a package before proceeding? This would prevent biggest "accidents", hopefully. If it's not the default action, but only an option, you should alias the real rpm to an rpm command which always asks if something should be done before proceeding (like some people handle 'rm' to prevent accidental removals), or if that's not possible (should be), then write a small script, rename 'rm' and put that script instead of 'rm' to run rm for the user, asking whether the operation should be done or not. It's just common sense, and in important environments (others than playgrounds) you just never can't bee too careful.
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790
Rep:
To bouncer:
You should see this thread; http://www.linuxquestions.org/questi...d.php?t=518984
which clearly states that avijitp's "friend" used the force switch in the fist place to remove the package. yes there was a warning and this was no accident, a moment of stupidity yes;
Code:
$ sudo rpm -e rpm
error: Failed dependencies:
rpm = 4.4.2-33.el5 is needed by (installed) rpm-libs-4.4.2-33.el5.x86_64
rpm is needed by (installed) man-1.6d-1.1.x86_64
rpm >= 0:4.1.1 is needed by (installed) yum-3.0.1-2.fc6.noarch
rpm = 4.4.2-33.el5 is needed by (installed) rpm-build-4.4.2-33.el5.x86_64
rpm >= 0:4.1.1 is needed by (installed) createrepo-0.4.4-2.fc6.noarch
rpm = 4.4.2-33.el5 is needed by (installed) rpm-python-4.4.2-33.el5.x86_64
To avijitp:
The only wany to make sure this "accident" does not happen again is to create a backup of the system and keep it handy. It is also a good idea to keep a current "spare copy" of the /usr/bin/rpm file and /usr/lib/rpm directory tree someplace.
Thanks to all of you for your help. I am trying the way Lenerd has described. Hopefully I will be able to address this as the current system is very important and can not be reinstalled and we dont have backup either.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.