When running emerge --sync, or emerge --metadata, or emerge --regen, I get a KeyError in /usr/lib/python3.10/site-packages/portage/dbapi/bintree.py. Reproducible: Always Steps to Reproduce: 1. emerge --regen 2. 3. Actual Results: Performing Global Updates (Could take a couple of minutes if you have a lot of binary packages.) .='update pass' *='binary update' #='/var/db update' @='/var/db move' s='/var/db SLOT move' %='binary move' S='binary SLOT move' p='update /etc/portage/package.*' /var/db/repos/gentoo/profiles/updates/2Q-2020......... /var/db/repos/gentoo/profiles/updates/4Q-2022........ pTraceback (most recent call last): File "/usr/lib/python-exec/python3.10/emerge", line 60, in <module> retval = emerge_main() File "/usr/lib/python3.10/site-packages/_emerge/main.py", line 1294, in emerge_main return run_action(emerge_config) File "/usr/lib/python3.10/site-packages/_emerge/actions.py", line 3447, in run_action and _global_updates( File "/usr/lib/python3.10/site-packages/portage/_global_updates.py", line 41, in _global_updates return _do_global_updates( File "/usr/lib/python3.10/site-packages/portage/_global_updates.py", line 257, in _do_global_updates bindb.update_ents(repo_map, onUpdate=onUpdate) File "/usr/lib/python3.10/site-packages/portage/dbapi/__init__.py", line 414, in update_ents aux_update(cpv, metadata_updates) File "/usr/lib/python3.10/site-packages/portage/dbapi/bintree.py", line 267, in aux_update raise KeyError(cpv) KeyError: 'media-libs/mesa-21.3.5' emerge --info: Portage 3.0.38.1 (python 3.10.8-final-0, default/linux/amd64/17.1/no-multilib, gcc-12.2.1, glibc-2.35-r8, 5.18.19-x86_64 x86_64) ================================================================= System uname: Linux-5.18.19-x86_64-x86_64-11th_Gen_Intel-R-_Core-TM-_i7-1185G7_@_3.00GHz-with-glibc2.35 KiB Mem: 32587100 total, 1570208 free KiB Swap: 0 total, 0 free Timestamp of repository gentoo: Sun, 30 Oct 2022 21:00:01 +0000 Head commit of repository gentoo: 46d3daa7817132bcc9855038d5bf7ba9089dc000 sh bash 5.1_p16-r1 ld GNU ld (Gentoo 2.38 p4) 2.38 app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r1::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.34.1-r3::gentoo dev-lang/python: 3.9.15::gentoo, 3.10.8::gentoo dev-lang/rust-bin: 1.64.0::gentoo dev-util/cmake: 3.23.3::gentoo dev-util/meson: 0.62.2::gentoo sys-apps/baselayout: 2.8::gentoo sys-apps/openrc: 0.45.2-r1::gentoo sys-apps/sandbox: 2.29::gentoo sys-devel/autoconf: 2.71-r1::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.38-r2::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/clang: 14.0.6-r1::gentoo sys-devel/gcc: 12.2.1_p20220917::gentoo sys-devel/gcc-config: 2.5-r1::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/llvm: 14.0.6-r2::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.15-r3::gentoo (virtual/os-headers) sys-libs/glibc: 2.35-r8::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-extra-opts: sync-rsync-verify-max-age: 24 sync-rsync-verify-metamanifest: yes sync-rsync-verify-jobs: 1 billiob-overlay location: /home/boris/gentoo-overlay masters: gentoo priority: 0 guru location: /var/lib/layman/guru masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-Os -pipe -march=x86-64" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.8/conf" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c" CXXFLAGS="-Os -pipe -march=x86-64" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS=" --usepkg-exclude 'sys-firmware/* dev-libs/boost sys-devel/gcc sys-libs/glibc virtual/* dev-lang/python-exec dev-lang/python-exec-conf net-im/slack'" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME" FCFLAGS="-Os -pipe -march=x86-64" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live clean-logs compressdebug config-protect-if-modified distlocks ebuild-locks fakeroot fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-Os -pipe -march=x86-64" GENTOO_MIRRORS="http://ftp.free.fr/mirrors/ftp.gentoo.org/ http://gentoo.mirrors.ovh.net/gentoo-distfiles/" LANG="en_US.UTF-8" LC_ALL="" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j5" PKGDIR="/var/cache/binpkgs" PORTAGE_CONFIGROOT="/" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git" PORTAGE_TMPDIR="/var/tmp" SHELL="/bin/zsh" USE="acl alsa amd64 bzip2 cdr cli crypt dri dvd elogind fortran gdbm iconv ipv6 jpeg jpeg2k libglvnd libtirpc ncurses nls nptl openmp pam pcre png pulseaudio readline seccomp split-usr ssl test-rust unicode vaapi vim-syntax vulkan wayland xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="synaptics libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" NGINX_MODULES_HTTP="access auth_basic autoindex charset gzip gzip_static limit_conn limit_req proxy referer rewrite stub_status fastcgi upstream_check upstream_hash upstream_ip_hash upstream_keepalive upstream_least_conn upstream_zone" NGINX_MODULES_STREAM="upstream_hash upstream_least_conn upstream_zone" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_USER_TARGETS="x86_64" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="intel i915 iris" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account" Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
I can't reproduce, but it's worth noting that I think this is to do with a binpkg of yours rather than a clean tree state (which is not to say it's your fault at all, just that it's going to be related to whatever is up with the binpkg).
I can't reproduce it either on my other system. I emptied the binpkg directory and the --regen works fine.
I bet this is bug 877357 or related (the libva rename).
I had the issue again. I'm using a shared nfs share with 3 servers. I make my updates one after the other but I guess some may have run at the same time and corrupt the Packages file. I have fixed it by running `emaint binhost --fix` where my binary packages are stored.