Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 594002 - sys-apps/portage: portage/dbapi/vartree.py", line 742, in aux_get
Summary: sys-apps/portage: portage/dbapi/vartree.py", line 742, in aux_get
Status: RESOLVED DUPLICATE of bug 231801
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-16 19:11 UTC by Martin Mokrejš
Modified: 2018-06-13 05:33 UTC (History)
0 users

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 Martin Mokrejš 2016-09-16 19:11:25 UTC
I have been updating net-misc/networkmanager in one emerge instance and another has been doing "emerge -uN1f" of many packages. Usually the lockfile keeps care of eventual conflicts between multiple instances of emerge utility, however, this condition seems to have escaped so far. Below you can see that after some unrelated files checksum computation emerge wanted to look for net-misc/networkmanager-1.2.4 but that failed. At the moment I already had been upgraded to 1.4.0.

Maybe this is too rare to care.


...

>>> Fetching (1 of 1) sci-biology/blue-1.1.3::science
 * blue-1.1.3.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                                                 [ ok ]
 * blue-1.1.3-Correcting_reads_with_Blue.pdf SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                         [ ok ]
 * blue-1.1.3-Changes_for_Blue_1.1.3.pdf SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                             [ ok ]

 * IMPORTANT: 15 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.

Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/emerge", line 50, in <module>
    retval = emerge_main()
  File "/usr/lib64/python2.7/site-packages/_emerge/main.py", line 1185, in emerge_main
    return run_action(emerge_config)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 3236, in run_action
    emerge_config.args, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/actions.py", line 324, in action_build
    settings, trees, myopts, myparams, myaction, myfiles, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 9192, in backtrack_depgraph
    myaction, myfiles, spinner)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 9229, in _backtrack_depgraph
    success, favorites = mydepgraph.select_files(myfiles)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 3583, in select_files
    return self._select_files(args)
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 3592, in _select_files
    self._load_vdb()
  File "/usr/lib64/python2.7/site-packages/_emerge/depgraph.py", line 590, in _load_vdb
    fake_vartree.sync()
  File "/usr/lib64/python2.7/site-packages/_emerge/FakeVartree.py", line 213, in sync
    self._sync()
  File "/usr/lib64/python2.7/site-packages/_emerge/FakeVartree.py", line 262, in _sync
    pkg = self._pkg(cpv)
  File "/usr/lib64/python2.7/site-packages/_emerge/FakeVartree.py", line 284, in _pkg
    self._real_vardb.aux_get(cpv, self._db_keys)),
  File "/usr/lib64/python2.7/site-packages/portage/dbapi/vartree.py", line 742, in aux_get
    raise KeyError(mycpv)
KeyError: u'net-misc/networkmanager-1.2.4'




$ emerge --info
Portage 2.3.0 (python 2.7.11-final-0, default/linux/amd64/13.0, gcc-5.4.0, glibc-2.23-r2, 4.6.3-default-pciehp x86_64)
=================================================================
System uname: Linux-4.6.3-default-pciehp-x86_64-Intel-R-_Core-TM-_i7-2640M_CPU_@_2.80GHz-with-gentoo-2.2
KiB Mem:    16375816 total,   9722332 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Thu, 15 Sep 2016 17:30:01 +0000
sh bash 4.3_p46
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p46::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.20.2-r1::gentoo
dev-lang/python:          2.7.11-r1::gentoo, 3.4.3-r7::gentoo, 3.5.1-r2::gentoo
dev-util/cmake:           3.6.1::gentoo
dev-util/pkgconfig:       0.29.1::gentoo
sys-apps/baselayout:      2.2-r1::gentoo
sys-apps/openrc:          0.21.7::gentoo
sys-apps/sandbox:         2.10-r2::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r2::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.12.6-r1::gentoo, 1.13.4-r1::gentoo, 1.14.1-r1::gentoo, 1.15-r2::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo, 2.26.1::gentoo
sys-devel/gcc:            4.3.6-r1::gentoo, 4.4.7::gentoo, 4.6.4::gentoo, 4.7.4::gentoo, 4.8.5::gentoo, 4.9.3::gentoo, 5.3.0::gentoo, 5.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r2::gentoo
...
Comment 1 Zac Medico gentoo-dev 2016-09-16 19:22:50 UTC
This is interesting because it occurs during the FakeVartree.sync method, while it holds a lock on /var/db/pkg. Even if FEATURES=parallel-install enabled, this lock is supposed to prevent /var/db/pkg from being modified by a concurrent process.
Comment 2 Martin Mokrejš 2016-09-16 19:30:35 UTC
Here is is the missing portion of emerge --info, just in case you wanted to check the FEATURES variable. I felt brave enough to omit the "unrelated" portion. Sorry for that.


Repositories:

gentoo
    location: /scratch/usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

science
    location: /home/mmokrejs/proj/sci
    masters: gentoo
    priority: 0

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 1

layman
    location: /var/lib/layman
    masters: gentoo
    priority: 2

haskell
    location: /var/lib/layman/haskell
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 sun-bcla-java-vm Oracle-BCLA-JavaSE IBM-J1.6 skype-eula Nero-EULA-US AdobeFlash-10.3 skype-4.0.0.7-copyright AdobeFlash-11.x OPERA-2014"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -maes -mpclmul -mpopcnt -mavx -march=native"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/maven-bin-3.2/conf /var/bind /var/lib/hsqldb /var/spool/torque"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.4/ext-active/ /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/ext-active/ /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="-O2 -pipe -maes -mpclmul -mpopcnt -mavx -march=native"
DISTDIR="/scratch/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news noclean nostrip parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://gentoo.wheel.sk/ http://ftp.fi.muni.cz/pub/linux/gentoo/ http://gentoo.mirror.web4u.cz/ rsync://gentoo.mirror.dkm.cz/gentoo/ ftp://gentoo.mirror.web4u.cz/"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
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="/scratch/var/tmp"
USE="X acpi alsa amd64 amr apache apache2 apulse avx berkdb bindist bluetooth boost bzip2 cairo cgi cli coin consolekit cracklib crypt cryptlib cups cxx dbus device-mapper dhcp directfb dri drm dvd emboss encode fax fbcon ffmpeg flac fontconfig fortran gbm gd gdbm geoip gimp glpk gnutls gpm gtk hal hpijs hwdb iconv id3tag imaging innodb java javafx javascript jce jpeg jpg js jscript keymap ladspa lapack laptop lcms libnotify lm_sensors mad matroska mmx mmxext modules mpi mpich2 multilib mysql ncurses nfs nls nptl nptlonly nscd nsplugin ntfsprogs ocr ogg opengl openmp pam parport pcre pdf perl php png policykit polkit ppds pppd python qt3support readline rendering resolvconf scanner seccomp server session slideshow sndfile sqlite sse sse2 sse3 sse4_1 sse4_2 ssl ssse3 suexec svg syslog tcl tcpd threads tiff tk truetype udev unicode usb v4l v4l2 vim-syntax vnc wavpack wifi x11 xattr xcb xml xorg xrandr xv xvid xvmc zlib" ABI_X86="64 32" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="alias authz_host auth_basic auth_digest cgi cgid deflate dir env filter include info mem_cache mime mime_magic negotiation remoteip setenvif status userdir vhost_alias rewrite usertrack cache file_cache disk_cache charset_lite log_config log_forensic" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" DRACUT_MODULES="crypt crypt-gpg" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" L10N="en_US en en_GB cs" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_US en_GB en cs" OFFICE_IMPLEMENTATION="libreoffice" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby20 ruby21" USERLAND="GNU" VIDEO_CARDS="vesa vmware fbdev intel i915 i965" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
USE_PYTHON="2.7"
Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Zac Medico gentoo-dev 2016-09-16 19:39:21 UTC
Assuming that the lock works as intended, we might suspect that the KeyError could be explained by a stale result returned from the vardbapi.cpv_all method here:

https://gitweb.gentoo.org/proj/portage.git/tree/pym/_emerge/FakeVartree.py?h=portage-2.3.0#n231

However, this code relies of the portage.util.listdir module, for which caching has been disabled:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=0196031ce8f5dc8b9385e06013e42c47d1185a3b
Comment 4 Elias Probst 2017-12-19 19:14:46 UTC
Saw an exception in "dbapi/vartree.py", line 744, in aux_get" today as well, I believe it's the same issue, but I'm not totally sure.

Had one shell running "emerge -av --with-bdeps=y --depclean", where one of the pkgs being removed was "=dev-java/swt-3.8.2-r1", started a little later in a 2nd shell "emerge @smart-live-rebuild --exclude-powertop" and ended up with the following:


--> git ls-remote https://anongit.kde.org/plasma-integration HEAD
->  https://anongit.kde.org/plasma-sdk [HEAD]                                         
--> git ls-remote https://anongit.kde.org/plasma-sdk HEAD
!!! Error enumerating =dev-java/swt-3.8.2-r1: [KeyError] 'dev-java/swt-3.8.2-r1'                   
... done!                                  
Traceback (most recent call last):                                                              
  File "/usr/lib64/python3.5/site-packages/portage/dbapi/vartree.py", line 812, in _aux_get
    st = os.stat(mydir)                                                                 
  File "/usr/lib64/python3.5/site-packages/portage/__init__.py", line 250, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)                                      
FileNotFoundError: [Errno 2] No such file or directory: b'/var/db/pkg/dev-java/swt-3.8.2-r1'
                                                                                          
During handling of the above exception, another exception occurred:
                                 
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/smartliverebuild/core.py", line 113, in SmartLiveRebuild
    for vcs in pkg.inherits:                                                                                                        
  File "/usr/lib64/python3.5/site-packages/gentoopm/portagepm/pkg.py", line 123, in inherits
    return SpaceSepFrozenSet(self._aux_get('INHERITED'))
  File "/usr/lib64/python3.5/site-packages/gentoopm/portagepm/pkg.py", line 107, in _aux_get
    val = map(str, self._dbapi.aux_get(self._cpv, keys))
  File "/usr/lib64/python3.5/site-packages/portage/dbapi/vartree.py", line 731, in aux_get
    mydata = self._aux_get(mycpv, wants)
  File "/usr/lib64/python3.5/site-packages/portage/dbapi/vartree.py", line 815, in _aux_get
    raise KeyError(mycpv)
KeyError: 'dev-java/swt-3.8.2-r1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/portage/dbapi/vartree.py", line 740, in aux_get
    mydir_stat = os.stat(mydir)
  File "/usr/lib64/python3.5/site-packages/portage/__init__.py", line 250, in __call__
    rval = self._func(*wrapped_args, **wrapped_kwargs)
FileNotFoundError: [Errno 2] No such file or directory: b'/var/db/pkg/dev-java/swt-3.8.2-r1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.5/emerge", line 50, in <module>
    retval = emerge_main()
  File "/usr/lib64/python3.5/site-packages/_emerge/main.py", line 1250, in emerge_main
    return run_action(emerge_config)
  File "/usr/lib64/python3.5/site-packages/_emerge/actions.py", line 3297, in run_action
    retval = action_build(emerge_config, spinner=spinner)
  File "/usr/lib64/python3.5/site-packages/_emerge/actions.py", line 339, in action_build
    settings, trees, myopts, myparams, myaction, myfiles, spinner)
  File "/usr/lib64/python3.5/site-packages/_emerge/depgraph.py", line 9601, in backtrack_depgraph
    myaction, myfiles, spinner)
  File "/usr/lib64/python3.5/site-packages/_emerge/depgraph.py", line 9638, in _backtrack_depgraph
    success, favorites = mydepgraph.select_files(myfiles)
  File "/usr/lib64/python3.5/site-packages/_emerge/depgraph.py", line 3813, in select_files
    return self._select_files(args)
  File "/usr/lib64/python3.5/site-packages/_emerge/depgraph.py", line 3947, in _select_files
    set_atoms = root_config.setconfig.getSetAtoms(s)
  File "/usr/lib64/python3.5/site-packages/portage/_sets/__init__.py", line 257, in getSetAtoms
    myatoms = myset.getAtoms()
  File "/usr/lib64/python3.5/site-packages/portage/_sets/base.py", line 65, in getAtoms
    self._load()
  File "/usr/lib64/python3.5/site-packages/portage/_sets/base.py", line 60, in _load
    self.load()
  File "/usr/lib64/python3.5/site-packages/smartliverebuild/sets.py", line 46, in load
    packages = SmartLiveRebuild(c.get_options(), pm)
  File "/usr/lib64/python3.5/site-packages/smartliverebuild/core.py", line 135, in SmartLiveRebuild
    erraneous.append(str(pkg.slotted_atom))
  File "/usr/lib64/python3.5/site-packages/gentoopm/portagepm/pkg.py", line 156, in slotted_atom
    slot = self.slot
  File "/usr/lib64/python3.5/site-packages/gentoopm/portagepm/pkg.py", line 142, in slot
    return self._aux_get('SLOT')
  File "/usr/lib64/python3.5/site-packages/gentoopm/portagepm/pkg.py", line 107, in _aux_get
    val = map(str, self._dbapi.aux_get(self._cpv, keys))
  File "/usr/lib64/python3.5/site-packages/portage/dbapi/vartree.py", line 744, in aux_get
    raise KeyError(mycpv)
KeyError: 'dev-java/swt-3.8.2-r1'
... done!
>>> Auto-cleaning packages...
 * waiting for lock on /var/db/.pkg.portage_lockfile ...                                                                      [ ok ]

>>> No outdated packages were found on your system.





"emerge --info":
Portage 2.3.16 (python 3.5.4-final-0, default/linux/amd64/17.0/desktop/plasma/systemd, gcc-6.4.0, glibc-2.25-r9, 4.14.2-gentoo x86_64)                                                                                                                                    =================================================================                                                                    System uname: Linux-4.14.2-gentoo-x86_64-Intel-R-_Core-TM-_i7-3537U_CPU_@_2.00GHz-with-gentoo-2.4.1                                  KiB Mem:     8014184 total,   1857184 free                                                                                           KiB Swap:    3071996 total,   2408128 free                                                                                           Timestamp of repository gentoo: Tue, 19 Dec 2017 00:15:01 +0000                                                                      Head commit of repository gentoo: 96b6c0a0b3ee695a996961cb73eb8ec60efbafc0                                                           Head commit of repository kde: 863715182784324214e24dcb0aab5fe0a6329241                                                                                                                                                                                                   Head commit of repository mozilla: 63a1f3f4c27e9d0f3ca12fe7cec0b648a344127b                                                                                                                                                                                               Head commit of repository qt: 8e488dabaa7ea2058ed9fefc1986b2ddedaebe5c
                                                                                                                                     Head commit of repository voyageur: 9f9c7da98ac72996c9392731063235be954f2c27
                                                         
Head commit of repository x11: c5b5b210f52e4536727c18afb4a0586507d13dac

sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
ccache version 3.2.4 [enabled]
app-shells/bash:          4.3_p48-r1::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.3::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo
dev-util/ccache:          3.2.4::gentoo
dev-util/cmake:           3.8.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r2::gentoo, 1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            6.4.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r3::gentoo
sys-devel/make:           4.2.1::gentoo
sys-kernel/linux-headers: 4.6::gentoo (virtual/os-headers)
sys-libs/glibc:           2.25-r9::gentoo
Repositories:

gentoo
    location: /var/cache/portage/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.de.gentoo.org/gentoo-portage/
    priority: -1000
    sync-rsync-extra-opts:

kde
    location: /var/cache/portage/repos/kde
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/proj/kde.git
    masters: gentoo

mozilla                                                                                                                      [21/364]
    location: /var/cache/portage/repos/mozilla
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/proj/mozilla.git
    masters: gentoo

qt
    location: /var/cache/portage/repos/qt
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/proj/qt.git
    masters: gentoo

voyageur
    location: /var/cache/portage/repos/voyageur
    sync-type: git
    sync-uri: https://cafarelli.fr/git/voyageur-overlay
    masters: gentoo

x11
    location: /var/cache/portage/repos/x11
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/proj/x11.git
    masters: gentoo

Installed sets: @baton, @gpxsync, @kde-plasma-live, @kdepim-live
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/themes/oxyg
en-gtk/gtk-2.0"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/ap
ache2-php7.1/ext-active/ /etc/php/cgi-php7.1/ext-active/ /etc/php/cli-php7.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/term
info /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe -ggdb"
DISTDIR="/var/cache/portage/distfiles/"
EMERGE_DEFAULT_OPTS="--jobs=1 --keep-going --load-average=2.0"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs ccache cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles mer
ge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmer
ge-logs unmerge-orphans userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://de-mirror.org/distro/gentoo/ http://mirror.netcologne.de/gentoo/ http://mirror.switch.ch/ftp/mirror/gentoo/"
LANG="en_US.utf8"
LC_ALL="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j4"
PKGDIR="/var/cache/portage/packages/"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stat
s --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac acl acpi activities alsa amd64 audiofile avahi berkdb bluetooth branding bzip2 cairo cdda cdparanoia cli cracklib cryp
t css cups cxx dbus declarative dri dts dvdr emboss encode exif fastcgi ffmpeg fftw firefox flac gdbm gif git glamor glib gnutls gpg
gs gstreamer gtk gtk3 hdri iconv icu imagemagick imap inotify ipv6 jabber jpeg jpeg2k kde kdeprefix kerberos kipi kms kwallet lame lc
ms ldap libnotify libsamplerate lzma mac mad matroska mmap mmx mng modules mp3 mp4 mpeg mplayer multilib musicbrainz ncurses networkm
anager nls nptl nsplugin ogg opengl opus pam pango pcre pdf perl phonon plasma png policykit postgres ppds private-headers pulseaudio
 python qml qt qt3support qt5 rdesktop readline rss ruby samba sasl sdl seccomp semantic-desktop session smp spell spice sqlite sse s
se2 ssl startup-notification subversion svg systemd taglib tcpd theora tiff truetype udev udisks unicode upnp upower usb user-session
 v4l2 vaapi vcd vim-syntax vnc vorbis wayland widgets wmf wxwidgets x264 xattr xcb xcomposite xinerama xml xv xvid xvmc zeroconf zip
zlib zsh-completion" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938
 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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="kexi plan sheets" CAMERAS="*" COLLECTD_PLUGINS="df interface irq load me
mory rrdtool swap syslog" CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" ENLIGHTENMENT_MOD
ULES="backlight battery clock comp conf-applications conf-dialogs conf-display conf-edgebindings conf-interaction conf-intl conf-keyb
indings conf-menus conf-paths conf-performance conf-randr conf-shelves conf-theme conf-window-manipulation conf-window-remembers cpuf
req dropshadow everything fileman fileman-opinfo gadman ibar ibox illume2 mixer msgbus notification pager quickaccess start syscon sy
stray tasks temperature tiling winlist wizard xkbswitch" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpscl
ock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmat
e tnt ublox ubx" INPUT_DEVICES="evdev keyboard mouse synaptics libinput" KERNEL="linux" L10N="en de" LCD_DEVICES="bayrad cfontz cfont
z633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en de" OF
FICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_
TARGETS="python2_7 python3_5" QEMU_SOFTMMU_TARGETS="x86_64 i386" QEMU_USER_TARGETS="x86_64 i386" RUBY_TARGETS="ruby22" USERLAND="GNU"
 VIDEO_CARDS="intel vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tar
pit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EX
TRA_OPTS
Comment 5 Zac Medico gentoo-dev 2017-12-19 19:56:58 UTC
(In reply to Elias Probst from comment #4)
> Saw an exception in "dbapi/vartree.py", line 744, in aux_get" today as well,
> I believe it's the same issue, but I'm not totally sure.

Since it was triggered by smart-live-rebuild, it's a separate issue. In that case emerge would have to lock the package database during evaluation of package sets.

(In reply to Martin Mokrejš from comment #0)
> ...
> 
> >>> Fetching (1 of 1) sci-biology/blue-1.1.3::science
>  * blue-1.1.3.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...                   
> [ ok ]
>  * blue-1.1.3-Correcting_reads_with_Blue.pdf SHA256 SHA512 WHIRLPOOL size
> ;-) ...                                                                     
> [ ok ]
>  * blue-1.1.3-Changes_for_Blue_1.1.3.pdf SHA256 SHA512 WHIRLPOOL size ;-)
> ...                                                                         
> [ ok ]
> 
>  * IMPORTANT: 15 news items need reading for repository 'gentoo'.
>  * Use eselect news read to view new items.

I don't understand why the above output appears just before the dependency calculation traceback. Normally emerge doesn't calculate dependencies just after fetching something like that.
Comment 6 Zac Medico gentoo-dev 2017-12-19 20:01:48 UTC
(In reply to Zac Medico from comment #5)
> (In reply to Martin Mokrejš from comment #0)
> > ...
> > 
> > >>> Fetching (1 of 1) sci-biology/blue-1.1.3::science
> >  * blue-1.1.3.tar.gz SHA256 SHA512 WHIRLPOOL size ;-) ...                   
> > [ ok ]
> >  * blue-1.1.3-Correcting_reads_with_Blue.pdf SHA256 SHA512 WHIRLPOOL size
> > ;-) ...                                                                     
> > [ ok ]
> >  * blue-1.1.3-Changes_for_Blue_1.1.3.pdf SHA256 SHA512 WHIRLPOOL size ;-)
> > ...                                                                         
> > [ ok ]
> > 
> >  * IMPORTANT: 15 news items need reading for repository 'gentoo'.
> >  * Use eselect news read to view new items.
> 
> I don't understand why the above output appears just before the dependency
> calculation traceback. Normally emerge doesn't calculate dependencies just
> after fetching something like that.

Perhaps you were running emerge --fetch as a non-root user? In that case, the current user does not have privileges to lock /var/db/pkg, so there's no way to prevent the KeyError from happening. There's not really a good way to handle such an error other than to abort, since /var/db/pkg could be continuously mutating.
Comment 7 Zac Medico gentoo-dev 2018-06-13 05:33:04 UTC

*** This bug has been marked as a duplicate of bug 231801 ***