You are not logged in.

#1 2010-11-01 00:08:27

pie86
Member
Registered: 2009-09-06
Posts: 78

Duplicated database entry

Hi everybody,
few days ago I moved /var to a separate partition since there was no space left in root partition. I made some mistakes and now pacman behaves like this:

[pie@xps ~]$ pacman -Qi nano
error: duplicated database entry 'xdg-utils'
error: duplicated database entry 'libgnome-keyring'
error: duplicated database entry 'dhcpcd'
error: duplicated database entry 'consolekit'
error: duplicated database entry 'nss'
error: duplicated database entry 'libxfont'
error: duplicated database entry 'libass'
error: duplicated database entry 'libnotify'
error: duplicated database entry 'initscripts'
error: duplicated database entry 'mutagen'
error: duplicated database entry 'pango-perl'
error: duplicated database entry 'gstreamer0.10-bad'
error: duplicated database entry 'libxext'
error: duplicated database entry 'filesystem'
error: duplicated database entry 'fuse'
error: duplicated database entry 'libxau'
error: duplicated database entry 'cryptsetup'
error: duplicated database entry 'hunspell'
error: duplicated database entry 'libxvmc'
error: duplicated database entry 'libxcb'
error: duplicated database entry 'xf86-input-evdev'
error: duplicated database entry 'wicd'
error: duplicated database entry 'file-roller'
error: duplicated database entry 'avahi'
error: duplicated database entry 'libtiff'
error: duplicated database entry 'hal'
error: duplicated database entry 'libxcomposite'
error: duplicated database entry 'xf86-input-synaptics'
error: duplicated database entry 'pacman-mirrorlist'
error: duplicated database entry 'xorg-utils'
error: duplicated database entry 'perl'
error: duplicated database entry 'parted'
error: duplicated database entry 'intel-dri'
error: duplicated database entry 'mdadm'
error: duplicated database entry 'xextproto'
error: duplicated database entry 'orc'
error: duplicated database entry 'libnice'
error: duplicated database entry 'cabextract'
error: duplicated database entry 'xulrunner'
error: duplicated database entry 'renderproto'
error: duplicated database entry 'libdatrie'
error: duplicated database entry 'diffpac'
error: duplicated database entry 'libpng'
error: duplicated database entry 'sdl'
error: duplicated database entry 'libimobiledevice'
error: duplicated database entry 'psmisc'
error: duplicated database entry 'kbproto'
error: duplicated database entry 'libldap'
error: duplicated database entry 'x264'
error: duplicated database entry 'libxdamage'
error: duplicated database entry 'libfetch'
error: duplicated database entry 'vte'
error: duplicated database entry 'util-linux-ng'
error: duplicated database entry 'coreutils'
error: duplicated database entry 'smbclient'
error: duplicated database entry 'gstreamer0.10-base'
error: duplicated database entry 'lvm2'
error: duplicated database entry 'glibc'
error: duplicated database entry 'pinentry'
error: duplicated database entry 'libgcrypt'
error: duplicated database entry 'gstreamer0.10-ugly'
error: duplicated database entry 'libgpg-error'
error: duplicated database entry 'glib-perl'
error: duplicated database entry 'pcmciautils'
error: duplicated database entry 'dhclient'
error: duplicated database entry 'libftdi'
error: duplicated database entry 'libsoup'
error: duplicated database entry 'libdrm'
error: duplicated database entry 'libxi'
error: duplicated database entry 'xz'
error: duplicated database entry 'pygobject'
error: duplicated database entry 'libx11'
error: duplicated database entry 'firefox'
error: duplicated database entry 'gnupg2'
error: duplicated database entry 'device-mapper'
error: duplicated database entry 'libsoup-gnome'
error: duplicated database entry 'eventlog'
error: duplicated database entry 'libassuan'
error: duplicated database entry 'dnsutils'
error: duplicated database entry 'intltool'
error: duplicated database entry 'sqlite3'
error: duplicated database entry 'xorg-server-utils'
error: duplicated database entry 'kernel26'
error: duplicated database entry 'cairo-perl'
error: duplicated database entry 'speex'
error: duplicated database entry 'libarchive'
error: duplicated database entry 'libgl'
error: duplicated database entry 'gstreamer0.10-bad-plugins'
error: duplicated database entry 'pango'
error: duplicated database entry 'syslog-ng'
error: duplicated database entry 'gparted'
error: duplicated database entry 'libxrender'
error: duplicated database entry 'gstreamer0.10'
error: duplicated database entry 'xproto'
error: duplicated database entry 'openssl'
error: duplicated database entry 'libksba'
error: duplicated database entry 'xf86-video-vesa'
error: duplicated database entry 'libcdaudio'
error: duplicated database entry 'libid3tag'
error: duplicated database entry 'libao'
error: duplicated database entry 'mplayer'
error: duplicated database entry 'libtool'
error: duplicated database entry 'libxfixes'
error: duplicated database entry 'tcp_wrappers'
error: duplicated database entry 'libpurple'
error: duplicated database entry 'gnome-keyring'
error: duplicated database entry 'gtk2-perl'
error: duplicated database entry 'libmms'
error: duplicated database entry 'videoproto'
error: duplicated database entry 'recode'
error: duplicated database entry 'gettext'
error: duplicated database entry 'mkinitcpio'
error: duplicated database entry 'nspr'
error: duplicated database entry 'usbutils'
error: duplicated database entry 'libpciaccess'
error: duplicated database entry 'gstreamer0.10-good'
error: duplicated database entry 'dirmngr'
error: duplicated database entry 'pygtk'
error: duplicated database entry 'curl'
error: duplicated database entry 'module-init-tools'
error: duplicated database entry 'jasper'
error: duplicated database entry 'gstreamer0.10-base-plugins'
error: duplicated database entry 'sg3_utils'
error: duplicated database entry 'libmysqlclient'
error: duplicated database entry 'dash'
error: duplicated database entry 'mjpegtools'
error: duplicated database entry 'farsight2'
error: duplicated database entry 'pm-quirks'
error: duplicated database entry 'xorg-server'
error: duplicated database entry 'libwnck'
error: duplicated database entry 'jack'
error: duplicated database entry 'gstreamer0.10-good-plugins'
error: duplicated database entry 'pacman'
error: duplicated database entry 'pycairo'
error: duplicated database entry 'mkinitcpio-busybox'
error: duplicated database entry 'man-pages'
error: duplicated database entry 'pidgin'
error: duplicated database entry 'tzdata'
error: duplicated database entry 'freetype2'
error: duplicated database entry 'gstreamer0.10-ugly-plugins'
error: duplicated database entry 'pixman'
error: duplicated database entry 'run-parts'
error: duplicated database entry 'mesa'
error: duplicated database entry 'sudo'
error: duplicated database entry 'libcups'
error: duplicated database entry 'xf86-video-intel'
error: duplicated database entry 'pcre'
error: duplicated database entry 'pm-utils'
error: duplicated database entry 'nano'
Name           : nano
Version        : 2.2.4-1
URL            : http://www.nano-editor.org
Licenses       : GPL
Groups         : base
Provides       : None
Depends On     : glibc  ncurses
Optional Deps  : None
Required By    : None
Conflicts With : None
Replaces       : None
Installed Size : 1424.00 K
Packager       : Andreas Radke <andyrtr@archlinux.org>
Architecture   : i686
Build Date     : Sun Apr 18 19:18:46 2010
Install Date   : Sun Jun 6 18:42:42 2010
Install Reason : Explicitly installed
Install Script : Yes
Description    : Pico editor clone with enhancements

Apart from the problem with the duplicated packages I do not understand why, for example, nano is for i686 architecture while I'm running a x86_64 system! Is it correct? Does anyone know how can I solve this issue? Which one of the pair of packets should I delete?

thanks
Pietro

Offline

#2 2010-11-01 00:12:56

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,477
Website

Re: Duplicated database entry

You have restored old /var/lib/pacman/local entries as well as new ones.  I guess the old nano was for i686...

Anyway, go through the list of duplicate entries and fix your pacman database by removing the old one.

Offline

#3 2010-11-01 09:18:35

pie86
Member
Registered: 2009-09-06
Posts: 78

Re: Duplicated database entry

Should I always remove the old one?
For example in the case of nano:

pacman -Qi nano
Nome           : nano
Versione       : 2.2.4-1

ls /var/lib/pacman/local/ | grep nano
nano-2.2.4-1
nano-2.2.5-1

Should I remove the old one also in this case?

Offline

#4 2010-11-01 09:25:07

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,477
Website

Re: Duplicated database entry

The old one is probably wrong...

Offline

#5 2011-12-30 20:33:41

jeffmikels
Member
Registered: 2007-04-19
Posts: 36

Re: Duplicated database entry

Here's a little python script to remove old duplicates from /var/lib/pacman/local:

#!/usr/bin/env python

import os,re, datetime
d = '/var/lib/pacman/local'

packages = os.listdir(d)
packages.sort()

pkgname_search = re.compile('^(.*?)-[0-9]')

old_packages = []

for pkg1 in packages:
	if pkg1 in old_packages:
		continue
		
	#get package name
	pkgname = pkgname_search.findall(pkg1)[0]
	
	#look for other items with the same package name
	for pkg2 in packages:
		if pkg2 == pkg1:
			continue
		if pkg2 in old_packages:
			continue
		if pkgname == pkgname_search.findall(pkg2)[0]:
			# We now have two duplicate packages, we want to delete the old one
			
			old_package = pkg1
			path1 = os.path.join(d,pkg1)
			path2 = os.path.join(d,pkg2)
			if os.stat(path1).st_mtime > os.stat(path2).st_mtime:
				old_package = pkg2
			
			old_packages.append(old_package)
			#print ('duplicate found:\t')
			#print (pkg1)
			#print (pkg2)
			#print ('old:', old_package)
			
			oldpath = os.path.join(d,old_package)
			target = os.path.join('/var/lib/pacman/OLD',old_package)
			cmd = 'mv "%s" "%s"' % (oldpath, target)
			
			#double-check that the oldpath still exists (it may have been removed in a previous pass)
			if os.path.exists(oldpath):
				print(cmd)
				os.system(cmd)

Run with sudo at your own risk.


...using Arch as a home server since 2006.

Offline

#6 2012-01-30 01:29:50

yuyu
Member
Registered: 2012-01-30
Posts: 9

Re: Duplicated database entry

Thank you jeffmikels!  I took the "risk" and it worked great, saved a bunch of hassle.
Some might complain about the revived thread, for me it was quite timely.

Offline

#7 2012-08-18 23:52:55

NMigo
Member
Registered: 2012-05-03
Posts: 10

Re: Duplicated database entry

The script worked great, had to manually create the OLD directory though with:

sudo mkdir /var/lib/pacman/OLD

Thanks!

Offline

#8 2014-11-19 17:01:11

nTia89
Banned
From: varese, italy
Registered: 2008-12-22
Posts: 1,230

Re: Duplicated database entry

thank you @jeffmikels
after a problem in my /var due to reiserfs failure I got some pacman's error
I used your script to solve them


+pc: custom | AMD Opteron 175 | nForce4 Ultra | 2GB ram DDR400 | nVidia 9800GT 1GB | ArchLinux x86_64 w/ openbox
+laptop: Apple | MacBook (2,1) | 2GB ram | Mac OS X 10.4 -> DIED
+ultrabook: Dell | XPS 13 (9343) | 8GB ram | 256GB ssd | FullHD display | Windows 8.1 64bit ArchLinux x86_64 w/ Gnome

Offline

#9 2014-11-19 17:18:54

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: Duplicated database entry

Two pointless necrobumps in the space of minutes: enjoy your vacation.



Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB