Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 262698 - emerge -Duv system results in "'portage' user or group not found" (error 530 due to cloexec & broken kernel)
Summary: emerge -Duv system results in "'portage' user or group not found" (error 530 ...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Portage team
URL: http://sourceware.org/bugzilla/show_b...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-16 19:29 UTC by c1de0x
Modified: 2009-03-19 09:38 UTC (History)
2 users (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 c1de0x 2009-03-16 19:29:24 UTC
When performing a standard 'emerge -Duv system', on a 2009.03.16 portage sync/snapshot, portage fails just after emerging sys-libs/glibc-2.8_p20080602-r1.

As it attempts to merge  app-admin/python-updater-0.5, portage emits the following error, and halts:

portage: 'portage' user or group missing.
         For the defaults, line 1 goes into passwd, and 2 into group.
         portage:x:250:250:portage:/var/tmp/portage:/bin/false
         portage::250:portage
*** WARNING ***  For security reasons, only system administrators should be
*** WARNING ***  allowed in the portage group.  Untrusted users or processes
*** WARNING ***  can potentially exploit the portage group for attacks such as
*** WARNING ***  local privilege escalation.

Traceback (most recent call last):
  File "/usr/lib/portage/bin/ebuild", line 108, in ?
    if ebuild_portdir not in portage.portdb.porttrees:
  File "//usr/lib/portage/pym/portage/util.py", line 977, in __getattribute__
    result = object.__getattribute__(self, '_get_target')()
  File "//usr/lib/portage/pym/portage/__init__.py", line 7592, in _get_target
    portdb = db[root]["porttree"].dbapi
  File "//usr/lib/portage/pym/portage/util.py", line 1067, in __getitem__
    return value_callable(*pargs, **kwargs)
  File "//usr/lib/portage/pym/portage/util.py", line 1051, in __call__
    self._value = self._callable(*self._pargs, **self._kwargs)
  File "//usr/lib/portage/pym/portage/dbapi/porttree.py", line 922, in __init__
    self.dbapi = portdbapi(
  File "//usr/lib/portage/pym/portage/dbapi/porttree.py", line 121, in __init__
    overlays=self.mysettings["PORTDIR_OVERLAY"].split())
  File "//usr/lib/portage/pym/portage/eclass_cache.py", line 29, in __init__
    self.update_eclasses()
  File "//usr/lib/portage/pym/portage/eclass_cache.py", line 52, in update_eclasses
    eclass_filenames = os.listdir(x)
OSError: [Errno 530] Unknown error 530: '/usr/portage/eclass'

/etc/passwd, and /etc/group DO contain the relevant portage user and group entries.

/usr/portage/eclass appears to be owned by root.root. chown-ing (recursively) /usr/portage to portage.portage, allows emerge to gather metadata, but fails when attempting to merge the first package with the following message:
>>> Emerging (1 of 29) app-admin/python-updater-0.5
Traceback (most recent call last):
  File "/usr/bin/emerge", line 40, in ?
    retval = _emerge.emerge_main()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 14670, in emerge_main
    myopts, myaction, myfiles, spinner)
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 13766, in action_build
    retval = mergetask.merge()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 10246, in merge
    rval = self._merge()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 10488, in _merge
    self._main_loop()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 10614, in _main_loop
    while self._schedule():
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 9093, in _schedule
    return self._schedule_tasks()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 10635, in _schedule_tasks
    if q.schedule():
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 8962, in schedule
    task.start()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 1654, in start
    self._start()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 3762, in _start
    self._start_task(build, self._default_final_exit)
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 1971, in _start_task
    task.start()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 1654, in start
    self._start()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 2533, in _start
    self._prefetch_exit(prefetcher)
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 2557, in _prefetch_exit
    self._start_task(fetcher, self._fetch_exit)
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 1971, in _start_task
    task.start()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 1654, in start
    self._start()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 2326, in _start
    self._build_dir.clean()
  File "//usr/lib/portage/pym/_emerge/__init__.py", line 2455, in clean
    shutil.rmtree(settings["PORTAGE_BUILDDIR"])
  File "/usr/lib/python2.4/shutil.py", line 155, in rmtree
    onerror(os.listdir, path, sys.exc_info())
  File "/usr/lib/python2.4/shutil.py", line 153, in rmtree
    names = os.listdir(path)
OSError: [Errno 530] Unknown error 530: '/var/tmp/portage/app-admin/python-updater-0.5'

The /var/tmp/portage directory is owned by root.portage. chown-ing it to portage.portage has no effect.

My emerge --info is: 
Portage 2.1.6.7 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.18-8.1.10.el5xen i686)
=================================================================
System uname: Linux-2.6.18-8.1.10.el5xen-i686-Intel-R-_Core-TM-2_Quad_CPU_@_2.40GHz-with-glibc2.0
Timestamp of tree: Mon, 16 Mar 2009 01:45:03 +0000
app-shells/bash:     3.2_p39
dev-lang/python:     2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.61-r1
sys-devel/automake:  1.10
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -fomit-frame-pointer -mno-tls-direct-seg-refs"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -fomit-frame-pointer -mno-tls-direct-seg-refs"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://mirror.qubenet.net/mirror/gentoo/ http://gentoo.tiscali.nl/ http://mirror.muntinternet.net/pub/gentoo/"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="berkdb bzip2 cli cracklib crypt cups dri fortran gdbm hpn iconv isdnlog midi mudflap ncurses nls nptl nptlonly openmp pam pcre perl pppd python readline reflection session spl ssl sysfs unicode x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 c1de0x 2009-03-17 13:48:49 UTC
Anyone have any ideas for a workaround on this? It is currently blocking a production server!
Comment 2 Zac Medico gentoo-dev 2009-03-17 20:07:01 UTC
Can you roll back to the previous version of glibc?
Comment 3 SpanKY gentoo-dev 2009-03-18 00:56:01 UTC
you're using 2.6.18 ... that's pretty uncommon nowadays and probably why it's not working

try running:
python -c 'import os; print os.listdir("/");'
Comment 4 c1de0x 2009-03-18 08:19:44 UTC
Zac:
How do I roll back without portage?

SpanKY:
 # python -c 'import os; print os.listdir("/");'
['tmp', 'dev', 'home', 'var', 'sbin', 'lib', 'sys', 'root', 'bin', '.bash_history', 'mnt', 'lost+found', 'usr', 'boot', 'opt', 'proc', 'etc', '.joe_state']

# uname -a
Linux hostname 2.6.18-8.1.10.el5xen #1 SMP Thu Sep 13 13:20:55 EDT 2007 i686 Intel(R) Core(TM)2 Quad CPU @ 2.40GHz GenuineIntel GNU/Linux

As it is a hosted VPS running on xen, I don't think I can easily upgrade the kernel. Or can I? If so, can you point me at some info on how to do so?
Comment 5 SpanKY gentoo-dev 2009-03-18 08:44:16 UTC
yes, but antiquated systems like 2.6.18 means they receive little testing and so you're likely to hit very narrow corner case bugs like this

that listdir working is kind of annoying because it'll be hard to reduce down what is actually failing ... if we can narrow things down on your system, it'll make my search of the source code a lot easier

how about this snippet:
mkdir -p /var/tmp/portage/a/b/c/d/e/f/g
python -c 'import shutil; shutil.rmtree("/var/tmp/portage/a");'
Comment 6 c1de0x 2009-03-18 08:56:59 UTC
# mkdir -p /var/tmp/portage/a/b/c/d/e/f/g
# python -c 'import shutil; shutil.rmtree("/var/tmp/portage/a");'
#

BTW: I'm on the IRC if you prefer to communicate that way.
Comment 7 SpanKY gentoo-dev 2009-03-19 05:48:55 UTC
i booted a 2.6.18 system under qemu and it has glibc-2.8, but i wasnt able to reproduce your error

i dont suppose you can create a non-root account for me to create a test case ?

http://dev.gentoo.org/~vapier/ssh-pub-key
Comment 8 SpanKY gentoo-dev 2009-03-19 08:34:23 UTC
it would seem that your kernel is rejecting open() when O_CLOEXEC is specified

(0x80000 == O_CLOEXEC)

open("/proc/2264/fd", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|0x80000) = -530
open("/etc/passwd", O_RDONLY|0x80000 /* O_??? */) = -530

along those lines, can you try this test:
$ cat test.c
main(){open("/dev/null", 0x80000);}
$ gcc test.c -static
$ strace -eopen ./a.out