LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 01-12-2007, 08:00 PM   #1
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
rpm packages uninstalled - how to reinstall


How can rpm package be installed if someone has accidentally run the "rpm -e rpm" command?

We can not use upd2date and yum as they are based on the rpm.

Please advice.
 
Old 01-12-2007, 08:45 PM   #2
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
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

--Ian
 
Old 01-13-2007, 12:47 PM   #3
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Original Poster
Rep: Reputation: 32
where to get the rpm tarball

Ian,

I appriciate your reply. How can I get the source tarball of the rpm? I am unable to find the right tarball in the rpm.org.
 
Old 01-13-2007, 07:01 PM   #4
IBall
Senior Member
 
Registered: Nov 2003
Location: Perth, Western Australia
Distribution: Ubuntu, Debian, Various using VMWare
Posts: 2,088

Rep: Reputation: 62
Try the latest version on www.rpm.org

I would seriously think about reinstalling though - it may turn out to be easier in the long run.

--Ian
 
Old 01-13-2007, 07:36 PM   #5
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Original Poster
Rep: Reputation: 32
Ian,

I do understand that backing up and reinstalling is the best option, but i have some problem to take that path.

I searched for the rpm's tar.gz in the rpm.org but could not find the one that is needed.

I am not sure about the mercurial repositories, that is mentioned there.

Please advise.
 
Old 01-15-2007, 07:18 AM   #6
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
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>
 
Old 01-15-2007, 07:34 AM   #7
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
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.
 
Old 01-15-2007, 10:09 AM   #8
Lenard
Senior Member
 
Registered: Dec 2005
Location: Indiana
Distribution: RHEL/CentOS/SL 5 i386 and x86_64 pata for IDE in use
Posts: 4,790

Rep: Reputation: 58
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.
 
Old 01-16-2007, 06:55 PM   #9
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Original Poster
Rep: Reputation: 32
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.

Yes indeed.. it was a stupid mistake.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Uninstalled one of two kernels, yum keeps trying to download packages for it ttnunam Linux - General 3 11-16-2006 01:09 AM
Yast does not show UNINSTALLED packages pujansrt SUSE / openSUSE 8 06-06-2006 02:05 AM
Uninstalled too many packages, but don't know what to put back qscomputing Linux - General 2 03-31-2006 09:54 PM
meauto uninstalled - NEED to reinstall, PLZ help tom_mcfadden MEPIS 7 09-16-2005 10:09 AM
no uninstalled packages in my rpmdatabase, using apt... Mayco Fedora 0 12-14-2004 08:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration