Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 136404 - [Errno 9] Bad file descriptor during renaming of a package in /var/db/pkg
Summary: [Errno 9] Bad file descriptor during renaming of a package in /var/db/pkg
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
Depends on:
Blocks: 136244 137445
  Show dependency tree
 
Reported: 2006-06-11 06:55 UTC by Alexander Skwar
Modified: 2006-06-20 16:45 UTC (History)
0 users

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


Attachments
test case that closes stdin (bad_file_descriptor.py,356 bytes, text/plain)
2006-06-12 10:18 UTC, Zac Medico
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Skwar 2006-06-11 06:55:41 UTC
I just ran a "emerge --sync" and it failed like this:

alexander@blatt ~ $ sudo eix-sync
 * Running emerge --sync ...
[Errno 9] Bad file descriptor:
   /bin/mv /var/db/pkg/net-libs/nfsidmap-0.10 /var/db/pkg/net-libs/libnfsidmap-0.10
Traceback (most recent call last):
  File "/usr/bin/emerge", line 3023, in ?
    portage.global_updates(
  File "/usr/lib/portage/pym/portage.py", line 7019, in global_updates
    trees["/"]["vartree"].dbapi.move_ent(update_cmd)
  File "/usr/lib/portage/pym/portage.py", line 4535, in move_ent
    write_atomic(os.path.join(newpath, "CATEGORY"), mynewcat+"\n")
  File "/usr/lib/portage/pym/portage_util.py", line 693, in write_atomic
    f = atomic_ofstream(file_path)
  File "/usr/lib/portage/pym/portage_util.py", line 633, in __init__
    super(atomic_ofstream, self).__init__(tmp_name, mode=mode, **kargs)
IOError: [Errno 2] No such file or directory: '/var/db/pkg/net-libs/libnfsidmap-0.10/CATEGORY.18744'
 * Problems running emerge --sync                                         [ !! ]

alexander@blatt ~ $ LANG=C ls -lad /var/db/pkg/net-libs/nfsidmap-0.10 /var/db/pkg/net-libs/libnfsidmap-0.10
ls: /var/db/pkg/net-libs/libnfsidmap-0.10: No such file or directory
drwxr-xr-x 2 root root 712 May  8 13:30 /var/db/pkg/net-libs/nfsidmap-0.10

/var/db/pkg is on a local reiserfs filesystem.

alexander@blatt ~ $ emerge --info
Portage 2.1 (default-linux/x86/2006.0, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.16-suspend2-r8.043.security-models i686)
=================================================================
System uname: 2.6.16-suspend2-r8.043.security-models i686 Intel(R) Celeron(R) M processor         1.50GHz
Gentoo Base System version 1.12.1
ccache version 2.4 [enabled]
dev-lang/python:     2.3.4-r1, 2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     2.4-r1
dev-util/confcache:  0.4.2-r1
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/gcc-config: 1.3.13-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -mtune=pentium-m -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"
CXXFLAGS="-O2 -mtune=pentium-m -pipe -fomit-frame-pointer"
DISTDIR="/Gentoo/Portage/distfiles"
EMERGE_DEFAULT_OPTS="--alphabetical"
FEATURES="autoconfig buildpkg ccache collision-protect confcache distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="        http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/  http://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/     ftp://ftp.tu-clausthal.de/pub/linux/gentoo/     http://distro.ibiblio.org/pub/linux/distributions/gentoo/       ftp://distro.ibiblio.org/pub/linux/distributions/gentoo         http://distfiles.gentoo.org/ "
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="de"
PKGDIR="/Gentoo/Portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/Gentoo/Portage/build"
PORTDIR="/Gentoo/Portage/tree"
PORTDIR_OVERLAY="/Gentoo/Portage/local-tree/misc /usr/portage/local/layman/vmware /usr/portage/local/layman/nx /usr/portage/local/layman/gentoo-de"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="x86 GAPING_SECURITY_HOLE X acpi alsa amd apache2 apm arts artswrappersuid async avi bash-completion bdf berkdb bitmap-fonts bluetooth bootsplash cairo caps cardbus ccache cdda cddb cdio cdparanoia cdr cdrom cle266 cli crypt css curlwrappers dbus devmap dillo divx4linux dlloader dri dvd dvdread emoticon esd exif fam fbcon fbdev firefox fping freetype gdbm gif gnokii gnome gstreamer gtk gtk2 hal hpn icc id3 idn imap imlib imlib2 insecure-drivers insecure-savers isdnlog javascript jikes jpeg kde kdeenablefinal kdehiddenvisibility libedit libwww linuxthreads-tls logrotate lynxkeymap mad madwifi maildir matroska mbox mmx mmxext mozilla moznoirc mozsvg mp3 mpeg mpeg2 mpeg4 mplayer multicall ncurses netboot network new-login nfs nis nls no-old-linux no-suexec noantlr nobcel nobeanutils nobsf nobsh nocd nocommonslogging nocommonsnet nodrm nogg nogulm nojsch nojython nolog4j nomac nooro nopri norhino noxalan noxerces nozaptel nptl nsplugin offensive ogg opengl openssh pam_console pam_timestamp passfile password patented pccts pcmcia pcre perl perlsuid pic player png pnp pppd qt quicktime rar readline real recode reflection reiserfs sdl sendfile sensord session sftp sms spell spf spl sse sse2 ssl startup-notification stream subp subtitles suid symlink sysfs syslog tiff transcode truetype truetype-fonts trusted type1-fonts udev underscores unichrome unicode unsafe usb utf8 uudeview vim vim-pager vlm vorbis wifi win32codecs wma123 x11vnc xinetd xml xmms xorg xpm xprint xscreensaver xv xvid xvmc zlib elibc_glibc input_devices_evdev input_devices_keyboard input_devices_mouse input_devices_-synaptics kernel_linux linguas_de userland_GNU video_cards_fbdev video_cards_vesa video_cards_vga video_cards_via"
Unset:  CTARGET, INSTALL_MASK, LC_ALL, MAKEOPTS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Alexander Skwar 2006-06-11 06:57:46 UTC
alexander@blatt ~ $ df /var
Dateisystem          1K-Bl
Comment 2 Alexander Skwar 2006-06-11 06:57:46 UTC
alexander@blatt ~ $ df /var
Dateisystem          1K-Blöcke   Benutzt Verfügbar Ben% Eingehängt auf
/dev/mapper/sys-Var     565224    417468    147756  74% /var
alexander@blatt ~ $ df -i /var
Dateisystem           INodes  IBenut.  IFrei IBen% Eingehängt auf
/dev/mapper/sys-Var        0       0       0    -  /var

There is enough free space on this filesystem - not exactly "plenty", but certainly enough :)

Comment 3 Alec Warner (RETIRED) archtester gentoo-dev Security 2006-06-11 06:59:26 UTC
Axxo has reported the same thing.
Comment 4 Zac Medico gentoo-dev 2006-06-11 07:41:34 UTC
This error happens when `mv /var/db/pkg/net-libs/nfsidmap-0.10 /var/db/pkg/net-libs/libnfsidmap-0.10` fails.  Can you test that operation by hand? Normally, it shouldn't fail...
Comment 5 Alexander Skwar 2006-06-11 12:06:48 UTC
(In reply to comment #3)
> This error happens when `mv /var/db/pkg/net-libs/nfsidmap-0.10
> /var/db/pkg/net-libs/libnfsidmap-0.10` fails.  Can you test that operation by
> hand? Normally, it shouldn't fail...

Sorry, I cannot test anymore. I "just" ran another "emerge --sync", and now everything worked out allright.

Actually, as you might have noticed, in my bug report, I did *not* run "emerge --sync" manually, but had "eix-sync" run it. Now, when everything worked, I ran "emerge --sync" manually (ie. I ran "sudo emerge --sync" on a command line). Another "eix-sync" which I ran just now, worked fine as well.
Comment 6 Patrick McLean gentoo-dev 2006-06-12 09:02:51 UTC
I got something very similar this morning:

   /bin/mv /var/db/pkg/net-misc/resolvconf-gentoo-1.0 /var/db/pkg/net-dns/resolvconf-gentoo-1.0
Traceback (most recent call last):
  File "/usr/bin/emerge", line 3023, in ?
    portage.global_updates(
  File "/usr/lib/portage/pym/portage.py", line 7019, in global_updates
    trees["/"]["vartree"].dbapi.move_ent(update_cmd)
  File "/usr/lib/portage/pym/portage.py", line 4535, in move_ent
    write_atomic(os.path.join(newpath, "CATEGORY"), mynewcat+"\n")
  File "/usr/lib/portage/pym/portage_util.py", line 693, in write_atomic
    f = atomic_ofstream(file_path)
  File "/usr/lib/portage/pym/portage_util.py", line 633, in __init__
    super(atomic_ofstream, self).__init__(tmp_name, mode=mode, **kargs)
IOError: [Errno 2] No such file or directory: '/var/db/pkg/net-dns/resolvconf-gentoo-1.0/CATEGORY.32034'

These appear to be problems with pkg moves, as both the packages mentioned in the errors have moves associated with them:

gentoo-x86/profiles/updates/2Q-2006:
...
move net-libs/nfsidmap net-libs/libnfsidmap
move net-misc/resolvconf-gentoo net-dns/resolvconf-gentoo
Comment 7 Zac Medico gentoo-dev 2006-06-12 10:18:41 UTC
Created attachment 88985 [details]
test case that closes stdin

The problem is that stdin is closed prior to running rsync.  Thankfully this bug is relatively harmless.  The update should proceed normally on the next invocation of emerge.
Comment 8 Zac Medico gentoo-dev 2006-06-12 11:14:20 UTC
I've run the test case with 2.0.54 and it doesn't not have the same problem.  Apparently it is related to changes in the portage_exec module.  I'd say portage_exec is behaving correctly though.  It's just that having a closed file descriptor for stdin has potential to lead to all sorts or problems like this.
Comment 9 Zac Medico gentoo-dev 2006-06-12 11:25:47 UTC
This is fixed in svn r3499.
Comment 10 Zac Medico gentoo-dev 2006-06-16 10:03:05 UTC
This has been released in 2.1.1_pre1.