Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 43139 - emerge crashes with ValueError: Key count mismatch
Summary: emerge crashes with ValueError: Key count mismatch
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: x86 Linux
: High critical (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-02-27 15:03 UTC by Artiom Molchanov
Modified: 2004-08-16 11:36 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Artiom Molchanov 2004-02-27 15:03:29 UTC
emerge -up world
 
These are the packages that I would merge, in order:
 
Calculating world dependencies
Traceback (most recent call last):
  File "/usr/bin/emerge", line 2517, in ?
    if not mydepgraph.xcreate(myaction):
  File "/usr/bin/emerge", line 1109, in xcreate
    myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
  File "/usr/lib/portage/pym/portage.py", line 4690, in xmatch
    myval=best(self.xmatch("match-visible",None,mydep,mykey))
  File "/usr/lib/portage/pym/portage.py", line 4701, in xmatch
    myval=match_from_list(mydep,self.xmatch("list-visible",None,mydep,mykey))
  File "/usr/lib/portage/pym/portage.py", line 4687, in xmatch
    myval=self.gvisible(self.visible(self.cp_list(mykey)))
  File "/usr/lib/portage/pym/portage.py", line 4782, in gvisible
    myaux=db["/"]["porttree"].dbapi.aux_get(mycpv, ["KEYWORDS"])
  File "/usr/lib/portage/pym/portage.py", line 4526, in aux_get
    auxdb_is_valid = self.auxdb[cat].has_key(pkg) and \
  File "/usr/lib/portage/pym/portage_db_template.py", line 15, in __getitem__
    return self.get_values(key)
  File "/usr/lib/portage/pym/portage_db_flat.py", line 58, in get_values
    raise ValueError, "Key count mismatch"
ValueError: Key count mismatch

For any other emerge:

emerge vnc
Calculating dependencies
!!! Problem in net-misc/vnc dependencies.
!!! Key count mismatch
root@pluton artiom # emerge kde
Calculating dependencies
!!! Problem in kde-base/kde dependencies.
!!! Key count mismatch

My emerge is up to date, emerge sync also...

emerge info
Portage 2.0.50-r1 (default-x86-1.4, gcc-3.3.2, glibc-2.3.2-r9, 2.4.20-gentoo-r8)=================================================================
System uname: 2.4.20-gentoo-r8 i686 AMD Athlon(TM) XP 2500+
Gentoo Base System version 1.4.3.13
Autoconf: sys-devel/autoconf-2.58-r1
Automake: sys-devel/automake-1.7.7
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=i686 -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.1/share/config /usr/kde/3.2/share/config /usr/kde/3/share/config /usr/share/config /var/bind /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-O3 -march=i686 -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://212.219.247.21/sites/www.ibiblio.org/gentoo/ http://212.219.247.18/sites/www.ibiblio.org/gentoo/ http://212.219.247.17/sites/www.ibiblio.org/gentoo/ http://212.219.247.16/sites/www.ibiblio.org/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="3dnow X apm arts avi berkdb bonobo cdr crypt cups dvd encode esd foomaticdb gdbm gif gnome gpm gtk gtk2 gtkhtml imlib jpeg kde ldap libg++ libwww mad mikmod mmx motif mozilla mpeg ncurses nls oggvorbis opengl oss pam pdflib perl png python qt quicktime readline scanner sdl slang spell sse ssl svga tcltk tcpd truetype unicode video_cards_radeon x86 xml2 xmms xv zlib"
Comment 1 Paul Cassidy 2004-03-20 15:18:36 UTC
I get the same behaviour. Only on a machine with a fresh stage3 install from LiveCD though.

means I can't emerge system!!

I tried /usr/lib/portage/bin/fix-db.py

emerge -up system
 
These are the packages that I would merge, in order:
 
Calculating system dependencies
Traceback (most recent call last):
  File "/usr/bin/emerge", line 2517, in ?
    if not mydepgraph.xcreate(myaction):
  File "/usr/bin/emerge", line 1109, in xcreate
    myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
  File "/usr/lib/portage/pym/portage.py", line 4690, in xmatch
    myval=best(self.xmatch("match-visible",None,mydep,mykey))
  File "/usr/lib/portage/pym/portage.py", line 4701, in xmatch
    myval=match_from_list(mydep,self.xmatch("list-visible",None,mydep,mykey))
  File "/usr/lib/portage/pym/portage.py", line 4687, in xmatch
    myval=self.gvisible(self.visible(self.cp_list(mykey)))
  File "/usr/lib/portage/pym/portage.py", line 4782, in gvisible
    myaux=db["/"]["porttree"].dbapi.aux_get(mycpv, ["KEYWORDS"])
  File "/usr/lib/portage/pym/portage.py", line 4526, in aux_get
    auxdb_is_valid = self.auxdb[cat].has_key(pkg) and \
  File "/usr/lib/portage/pym/portage_db_template.py", line 15, in __getitem__
    return self.get_values(key)
  File "/usr/lib/portage/pym/portage_db_flat.py", line 58, in get_values
    raise ValueError, "Key count mismatch"
ValueError: Key count mismatch


emerge info
!!! Using `which gcc` to gcc locate version, this may break
!!! DISTCC, installing gcc-config and setting your current gcc
!!! profile will fix this
Portage 2.0.50-r1 (default-x86-1.4, gcc-3.2.1, glibc-2.3.1-r2, 2.4.20-xfs_pre2)
=================================================================
System uname: 2.4.20-xfs_pre2 i586 Pentium 75 - 200
Gentoo Base System version 1.4.3.13
Autoconf: sys-devel/autoconf-2.53a
Automake: sys-devel/automake-1.6.3
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-march=pentium -O3 -pipe"
CHOST="i586-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d"
CXXFLAGS="-march=pentium -O3 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS=""
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="apm arts avi berkdb crypt cups encode foomaticdb gdbm gif gpm imlib jpeg libg++ libwww mad mikmod motif mpeg ncurses nls oggvorbis opengl oss pam pdflib perl png python quicktime readline sdl slang spell ssl svga tcpd truetype x86 xml2 xmms xv zlib"
Comment 2 Artiom Molchanov 2004-03-21 01:09:32 UTC
I found a solution for this problem. I deleted all portage tree ( /usr/portage )
and did emerge sync.
Comment 3 Paul Cassidy 2004-03-21 03:51:10 UTC
I'm not sure the issue is with /usr/portage
/usr/portage is nfs mounted and shared between several
machines. The problem only occurs on one machine, all the others work fine.

/usr/portage is up to date.

Comment 4 Masatomo Nakano (RETIRED) gentoo-dev 2004-03-21 06:41:15 UTC
Hello Paul,

Can you try this on the machine?
# rm -rf /var/cache/edb/dep/*
# emerge sync

(You need to do the first command carefully.)
Comment 5 Paul Cassidy 2004-03-21 15:43:09 UTC
Thanks Masatomo,

That worked. It took about 8 hours though as the machine only has 16M RAM
I'm still not sure what the problem was though, the portage cache was straight
from my liveCD which is 1.4_rc2 I think. Is it possible that this cache is 
incompatible with what's in place at the moment?
Comment 6 Masatomo Nakano (RETIRED) gentoo-dev 2004-03-21 16:03:17 UTC
I've seen this problem 3 times in this bugzilla. 
I think we need to fix this bug..
If there is a cache problem, portage should remake the cache automatically.

I'll check portage code and fix it if I can.

carpaski, what do you think?
Comment 7 Paul Cassidy 2004-03-22 03:35:24 UTC
Just to give you some more info to go on, hope it helps.

I haven't got the logs from my efforts, so can't post the exact error messages.

The problem started when I tried to emerge distcc. The emerge failed complaining
about a dependency clash with Perl-MakeMaker.

I thought updating portage and baselayout would fix it, thinking the old versions
on the CD might be causing the problems with an up to date portage tree.

Once portage was updated I could emerge almost nothing. I did manage to get
syslog-ng to emerge I think, possibly vixie-cron also but nothing else.

Comment 8 Haroon Rafique 2004-03-22 06:58:52 UTC
Same error here. Fix mentioned in comment 4 solved the problem. For me, I hadn't even to started to emerge anything. What I do remember doing is that I was updating portage by:

emerge portage

and incidentally had a task also running to download the sources for the rest of the packages that needed to be updated:

emerge -Uf world

Perhaps both of these running at the same time while portage was being updated caused the cache corruption.
Comment 9 Nicholas Jones (RETIRED) gentoo-dev 2004-03-23 14:49:03 UTC
Shouldn't be any interference... there are locks in play.

This isn't too hard to fix... will be in >=-r3
Comment 10 Brian Harring (RETIRED) gentoo-dev 2004-08-16 11:36:32 UTC
This has popped up a couple of times...
Either way,  .50-r9 and .51_pre* have code that handle it better, and it's been fixed for a while.