[SOLVED] Removing duplicate packages

General support questions
RikT
Posts: 12
Joined: 2012/05/20 20:09:06

[SOLVED] Removing duplicate packages

Post by RikT » 2013/12/29 17:27:56

The system this concerns is a headless server that I do not have physical access to. I was trying to update the system yesterday over ssh when the bad weather in the UK caused a power cut dropping my connection. Once power was restored I was unable to complete the update, receiving a message:

Code: Select all

** Found 200 pre-existing rpmdb problem(s), 'yum check' output follows:
and then lists 200 packages.

Code: Select all

yum-complete-transaction --cleanup-only
reports no unfinished transactions and

Code: Select all

package-cleanup --cleandupes
fails after promising to remove a load of packages with

Code: Select all

Error: Trying to remove "yum", which is protected
You could try using --skip-broken to work around the problem
which feels like an awful idea.

I tried rebooting the server and got a kernel panic

Code: Select all

Kernel panic - not syncing: VFS: Unable to mount fs on unknown-block(0,0)
Pid: 1, comm: swapper Not tainted 2.6.32-431.1.2.0.1.el6.x86_64 #1 
Remote hands were able to boot from the previous kernel and I have since done an rpm -e on the 2.6.32-431 kernel. Whilst I have a working system I am still unable to update as described above. Any ideas gratefully received.
Last edited by RikT on 2014/01/14 12:40:18, edited 1 time in total.

Ideal
Posts: 56
Joined: 2009/07/17 22:32:51

Re: Oh I've made a horrible mess!

Post by Ideal » 2013/12/30 03:10:27

Can't give you too much help on your current situation but in the future try using "dtach" on the remote system before starting the update.

Whoever
Posts: 1361
Joined: 2013/09/06 03:12:10

Re: Oh I've made a horrible mess!

Post by Whoever » 2013/12/30 05:50:01

There may be better ways to fix this, but what will work is to remove the duplicates from the database. Look at the list of duplicate packages and on each one, do:

Code: Select all

rpm -e --justdb <package-version>
It's important to use the "--justdb" option, and make sure that you specify the version so that you don't delete any files or important packages, just the rpm database entries.

RikT
Posts: 12
Joined: 2012/05/20 20:09:06

Re: Oh I've made a horrible mess!

Post by RikT » 2013/12/31 10:33:56

Thanks. After I've done that should

Code: Select all

yum update
work?

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Oh I've made a horrible mess!

Post by TrevorH » 2013/12/31 10:35:16

Yes.

Further, for all those packages that you have manually removed with the just-db option, personally I would also run `yum reinstall $packagename` afterwards to make sure that you actually have the correct versions of all files supplied by the newer RPMs and that there are no remnants of the older ones remaining.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
vonskippy
Posts: 839
Joined: 2006/12/30 03:00:04
Location: Western Slope Colorado

Re: Oh I've made a horrible mess!

Post by vonskippy » 2013/12/31 17:51:27

To prevent this from happening in the future, use SCREEN so if your connection drops, you won't fubar your remote system.

Here's one of the many guides to get you started...

http://www.rackaid.com/blog/linux-scree ... nd-how-to/
For the 2.5^15th time :: Better Details = Better Answers

scottro
Forum Moderator
Posts: 2556
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: Oh I've made a horrible mess!

Post by scottro » 2013/12/31 21:30:14

New users should check the FAQ and Read Me First pages

RikT
Posts: 12
Joined: 2012/05/20 20:09:06

Re: [SOLVED] Removing duplicate packages

Post by RikT » 2014/01/14 12:44:43

Thank you very much Whoever. That solved the problem. System now updated and running. :D

SamSmith34
Posts: 28
Joined: 2011/04/08 16:41:59

Re: [SOLVED] Removing duplicate packages

Post by SamSmith34 » 2016/03/13 11:06:44

Years later, I am in the same mess. Yum was not being updated when the problem occurred, and is not in the list of duplicated packages on my broken-box. Does this mean that "package-cleanup --cleandupes" only works on systems that do not have yum installed on them.

Even picking through the DB manually removing dozens of entries fails, due to dependency issues which do not automatically resolve themselves. I am always amazed to see "couldn't do something" shown - when it should be "found something - fix automatically y/n" (at most).

Perhaps there has been a replacement to "package-cleanup --cleandupes" that will actually clean the duplicates out without saying it won't because yum is present?

Or do I need to uninstall yum? Or is "package-cleanup" a part of Yum which is just broken?

Edit 2:
Oops - didn't work after all. Adding --nodeps in front of the copy/paste of all the packages listed above in the duplicates list was suggested elsewhere. But this just makes it not complain. Then when you try to install something, all the old duplicate and broken-dependency problems are still there.

Edit 3:
What finally worked, to fix the pieces I needed working now, was to downgrade the broken things, rebuild db, then upgrade them, again. That seems to fix the dependencies and dups. Still, I hope there is a working utility out there, as there are lots of other broken pieces which will be hitting me later. It would be nice to clean it all up in one step.

User avatar
TrevorH
Site Admin
Posts: 33215
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [SOLVED] Removing duplicate packages

Post by TrevorH » 2016/03/13 13:14:21

package-cleanup is part of yum-utils
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply