LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 05-22-2008, 11:38 AM   #1
diego_cn
Member
 
Registered: Mar 2006
Distribution: fedora 7
Posts: 62

Rep: Reputation: 16
RPM remove broken packages


Hi,

I am running RHEL4. I accidentally deleted some files that belongs to a package. Now when I try to remove that package with:

<code>
rpm -e package
</code>

But it will not let me do it. Is there any ways to force remove a broken rpm package?

Thanks,
di
 
Old 05-22-2008, 11:45 AM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
What is the error message?

Do you intend to reinstall the rpm once you get the broken version removed?

What is the name of the rpm? There are some rpms that will result in a system crash if you remove them.

-----------------------
Steve Stites
 
Old 05-22-2008, 02:21 PM   #3
diego_cn
Member
 
Registered: Mar 2006
Distribution: fedora 7
Posts: 62

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by jailbait View Post
What is the error message?

Do you intend to reinstall the rpm once you get the broken version removed?

What is the name of the rpm? There are some rpms that will result in a system crash if you remove them.

-----------------------
Steve Stites
Hi jailbait,

Thanks for the reply. The RPM package is third party one custom build by our company.
Code:
rpm -ql packagename
Shows everything is installed under /opt, which I removed entirely. Since that linux machine is not connected to network, I can only describe the err message:
Code:
chmod: Cannot access /opt/... No such file or directory
/var/tmp/rpm-tmp.82404 line xx: /opt/... No such file or directory
Error: %preun(packagename) scriptlet failed, exit status 1.
I guess with all the files removed, I just need to "unregister" the rpm package to make it marked as uninstalled, so I can install the package again.
 
Old 05-22-2008, 02:45 PM   #4
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
The easiest way is usually just to reinstall the rpm (use the force option). This will reinstall the files you removed. Then uninstall the rpm. After that, go back and remove the left over files.
 
Old 05-22-2008, 03:05 PM   #5
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
What lazlow says is correct. In addition you may run into a few problems with the rpm script if it wasn't written to take such things as missing directories into consideration. Try recreating some of the missing directories:

mkdir /opt

That might get you past some poor coding in the rpm script.

--------------------
Steve Stites
 
Old 05-22-2008, 03:22 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
I disagree. If one fscked up by deliberately removing files by hand instead of uninstalling the package it is not the package managers fault nor "poor coding" but PEBCAK. Reinstalling the package to uninstall it is unnecessary. AFAIK the OP is right if he just needs to "unregister" it (never mind the connotations of the term). Executing 'rpm --justdb -e packagename' should do just that.
 
Old 05-22-2008, 03:47 PM   #7
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
unSpawn,

I agree that diego_cn should be able to uninstall the rpm even though he has deleted /opt. He also says in his second post that he wants to install the rpm again. So installing the new rpm with update or force is also a viable way to override the old rpm.

I have seen rpm packages that assume that such things as /opt or /usr exist and fail if they don't. Since this rpm was written in house and not by a distribution it is quit possible that it doesn't have if statements creating /opt if /opt does not exist, etc.


------------------
Steve Stites
 
Old 05-22-2008, 05:42 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by jailbait View Post
He also says in his second post that he wants to install the rpm again.
Thanks for pointing me to that. I should have read his post more carefully.
 
Old 05-22-2008, 11:27 PM   #9
diego_cn
Member
 
Registered: Mar 2006
Distribution: fedora 7
Posts: 62

Original Poster
Rep: Reputation: 16
--justdb

That's what I am looking for. Thanks for all your helps.

To clarify the matter a little bit more, for future reference: The original rpm packages was coded such that it has to install through a external script file. Therefore it cannot be manually installed. So reinistall with --force option does not work here.

p.s yum has spoiled me and I forget much of the rpm arguments already
 
  


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
installed apache from source, didn't remove rpm, updated rpm causes problems leftPeg Linux - Newbie 5 06-06-2007 09:20 PM
How to remove non-rpm installed packages ??? thinknologist Ubuntu 3 04-13-2007 12:55 AM
How to remove rpm packages from Mandriva 2007 eikeland Linux - Software 2 01-27-2007 02:30 PM
Mandrake Update/Install Packages/Remove Packages wslyhbb Mandriva 2 03-15-2004 09:43 AM
creating packages (.tgz/.deb/.rpm) How from the source packages? l_9_l Linux - General 1 03-06-2002 06:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 04:35 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