Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 267104 - emerge fails with "insufficient space to store ... in /usr/portage/distfiles"
Summary: emerge fails with "insufficient space to store ... in /usr/portage/distfiles"
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: Alpha Linux
: High critical (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 210077 268228
  Show dependency tree
 
Reported: 2009-04-22 15:33 UTC by Rico Poser
Modified: 2009-05-03 21:54 UTC (History)
1 user (show)

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


Attachments
use the f_bfree field when necessary but only if userfetch is not enabled (bfree.patch,848 bytes, patch)
2009-04-29 00:20 UTC, Zac Medico
Details | Diff
use the f_bfree field when necessary but only if userfetch is not enabled (bfree.patch,855 bytes, patch)
2009-04-30 06:36 UTC, Zac Medico
Details | Diff
use the f_bfree field when necessary but only if userfetch is not enabled (bfree.patch,1.43 KB, patch)
2009-04-30 19:55 UTC, Zac Medico
Details | Diff
fix inverted logic (inverted_logic.patch,681 bytes, patch)
2009-05-02 20:51 UTC, Zac Medico
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rico Poser 2009-04-22 15:33:05 UTC
Any try to emerge ebuilds fails due to "insufficient space to store ... in /usr/portage/distfiles" though there is plenty (25GB) of space on that partition and access rights are verified. The problem might be linked to the implementation of the function call "statvfs" to check for free disk space on ALPHA systems.

Reproducible: Always

Steps to Reproduce:
emerge gentoo-sources
(any other ebuild will fail, too)
Actual Results:  
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) sys-kernel/gentoo-sources-2.6.27-r8
!!! Insufficient space to store genpatches-2.6.27-10.extras.tar.bz2 in /usr/portage/distfiles
!!! Couldn't download 'genpatches-2.6.27-10.extras.tar.bz2'. Aborting.
 * Fetch failed for 'sys-kernel/gentoo-sources-2.6.27-r8', Log file:
 *  '/var/tmp/portage/sys-kernel/gentoo-sources-2.6.27-r8/temp/build.log'

>>> Failed to emerge sys-kernel/gentoo-sources-2.6.27-r8, Log file:

>>>  '/var/tmp/portage/sys-kernel/gentoo-sources-2.6.27-r8/temp/build.log'

 * Messages for package sys-kernel/gentoo-sources-2.6.27-r8:

 * Fetch failed for 'sys-kernel/gentoo-sources-2.6.27-r8', Log file:
 *  '/var/tmp/portage/sys-kernel/gentoo-sources-2.6.27-r8/temp/build.log'


Expected Results:  
emerge without failure

The problem occurs on an ALPHA workstation XP1000:

http://www.compaq.com/alphaserver/workstations/retired/xpseries/xp1000/index.html

I suppose problems with the function call "statvfs" (python?) which may not be correctly implemented on ALPHAs to determine free disk space!?

There are no issues when the files to be fetched and emerged are put into /usr/portage/distfiles manually.

beta rico # df -h
Dateisystem          Größe Benut  Verf Ben% Eingehängt auf
/dev/hda3              36G   11G   25G  31% /
udev                   10M  104K  9,9M   2% /dev
/dev/hda1              63M  6,3M   53M  11% /boot
/dev/mapper/vg0-lvhome
                       94G   65G   29G  70% /home
shm                  1012M     0 1012M   0% /dev/shm

beta rico # emerge --info
Portage 2.1.6.7 (default/linux/alpha/2008.0/server, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.26-gentoo-r2 alpha)
=================================================================
System uname: Linux-2.6.26-gentoo-r2-alpha-EV67-with-glibc2.0
Timestamp of tree: Wed, 22 Apr 2009 14:30:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p33
dev-lang/python:     2.4.4-r13, 2.5.4-r2
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r7
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1
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="alpha"
CBUILD="alpha-unknown-linux-gnu"
CFLAGS="-mieee -O2 -mcpu=21264a -pipe"
CHOST="alpha-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-mieee -O2 -mcpu=21264a -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LANG="de_DE.utf8"
LC_ALL="de_DE.utf8"
LDFLAGS="-Wl,-O1"
LINGUAS="de"
MAKEOPTS="-j2"
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"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="7zip acl alpha apache2 asf berkdb bzip2 cjk clamav cli cracklib crypt cups divx4linux dri dynamicplugin exif exiscan-acl ffmpeg fortran ftp gdbm gimpprint gocr gpm gtk gtk2 iconv ieee1394 immqt-bc ipv6 isdnlog javascript jpeg ldap lm_sensors m17n-lib mailwrapper midi mjpeg mp3 mpeg msn mudflap mysql ncurses nls nptl nptlonly nsplugin opengl openmp pam pcre perl png pop3d pppd python pyzor razor readline reflection samba session slang snmp spell spl ssl sysfs tcpd tiff truetype unicode usb userlocales winbind xml xorg xvid zlib" ALSA_CARDS="ali5451 als4000 bt87x ca0106 cmipci emu10k1 ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 maestro3 trident usb-audio via82xx 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" LINGUAS="de" USERLAND="GNU" VIDEO_CARDS="fbdev glint mach64 mga nv r128 radeon savage tdfx vga voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

beta portage # ls -l
...
drwxrwxr-x   3 root portage  1720 22. Apr 17:04 distfiles
...
Comment 1 Allen Brooker (AllenJB) 2009-04-22 16:39:05 UTC
Run "df -i" to check the inodes. This is the usual cause of "disk full" errors when there's still "space" free.
Comment 2 Zac Medico gentoo-dev 2009-04-22 18:04:58 UTC
Also please post the output of this command:

python -c 'import os; st = os.statvfs("/usr/portage/distfiles") ; print st.f_bavail, st.f_bsize'
Comment 3 Rico Poser 2009-04-22 18:29:11 UTC
beta rico # python -c 'import os; st = os.statvfs("/usr/portage/distfiles") ; print st.f_bavail, st.f_bsize'
0 4096

beta rico # df -i
Dateisystem           INodes  IBenut.  IFrei IBen% Eingehängt auf
/dev/hda3                  0       0       0    -  /
udev                  129440    2646  126794    3% /dev
/dev/hda1              16560      25   16535    1% /boot
/dev/mapper/vg0-lvhome
                           0       0       0    -  /home
shm                   129440       1  129439    1% /dev/shm

relevant parts of /etc/fstab:

/dev/hda1         /boot       ext2            defaults            1 2
/dev/hda3         /           reiserfs        defaults            0 0
/dev/vg0/lvhome   /home       reiserfs        defaults            0 0
/dev/hda2         none        swap            sw                  0 0
proc              /proc       proc            defaults            0 0
shm               /dev/shm    tmpfs           nodev,nosuid,noexec 0 0
Comment 4 Zac Medico gentoo-dev 2009-04-22 18:54:20 UTC
(In reply to comment #3)
> beta rico # python -c 'import os; st = os.statvfs("/usr/portage/distfiles") ;
> print st.f_bavail, st.f_bsize'
> 0 4096

So, the f_bavail field appears to be useless on your system. I'm not sure if that is legitimate, or indicates some sort of misbehavior or breakage. There's a f_bfree field that we can also check, so please post the output of this as well:

python -c 'import os; st = os.statvfs("/usr/portage/distfiles") ; print st.f_bfree'
Comment 5 Rico Poser 2009-04-22 18:58:44 UTC
beta rico # python -c 'import os; st = os.statvfs("/usr/portage/distfiles") ; print st.f_bfree'
6420572
Comment 6 Rico Poser 2009-04-22 19:08:35 UTC
Maybe this thread is of interest:

http://markmail.org/message/efg4jre2gczxfqrs
Comment 7 Rico Poser 2009-04-28 19:36:35 UTC
Problem remains unchanged with Portage 2.1.6.11.

I would appreciate any idea to force updating the system without the need to download each distfile manually.
Comment 8 Zac Medico gentoo-dev 2009-04-29 00:20:39 UTC
Created attachment 189788 [details, diff]
use the f_bfree field when necessary but only if userfetch is not enabled

(In reply to comment #5)
> beta rico # python -c 'import os; st = os.statvfs("/usr/portage/distfiles") ;
> print st.f_bfree'
> 6420572

It seems to be reporting space available, but not for non-root users. This patch should make it work, but you'll have to add FEATURES="-userfetch" to /etc/make.conf. If the patch is saved as /tmp/bfree.patch, then it can be applied as follows:

  patch /usr/lib/portage/pym/portage/__init__.py /tmp/bfree.patch
Comment 9 Zac Medico gentoo-dev 2009-04-30 06:36:05 UTC
Created attachment 189921 [details, diff]
use the f_bfree field when necessary but only if userfetch is not enabled

This fixes an incorrect calculation in the first patch.
Comment 10 Rico Poser 2009-04-30 07:37:52 UTC
Your second patch posted on 2009-04-30 06:36 works! Thanks a lot!

Still some questions:

Will this patch (or a modified version of it) be implemented in the stable tree of portage?

Can the need to run the modified code be detected automatically apart from using the "-userfetch" feature?
Comment 11 Zac Medico gentoo-dev 2009-04-30 08:02:22 UTC
(In reply to comment #10)
> Will this patch (or a modified version of it) be implemented in the stable tree
> of portage?

Yes, it will be included in portage-2.1.6.12.

> Can the need to run the modified code be detected automatically apart from
> using the "-userfetch" feature?

Well, if FEATURES=userfetch is enabled (the default) then IMO it should produce an error if it's not able to drop privileges. I'd still like to understand why the f_bfree field reports free space on your system while the f_bavail does not. Perhaps it's something about the way your filesystem is configured. Are you able to create files in /usr/portage/distfiles as a non-root user?
Comment 12 Rico Poser 2009-04-30 09:13:01 UTC
(In reply to comment #11)

> Well, if FEATURES=userfetch is enabled (the default) then IMO it should produce an error if it's not able to drop privileges.
Yes, in that case an error is produced.

> Are you able to create files in /usr/portage/distfiles as a non-root user?
No, files cannot be created as user as expected by the file permissions given in the bug description.
Comment 13 Zac Medico gentoo-dev 2009-04-30 19:55:24 UTC
Created attachment 189997 [details, diff]
use the f_bfree field when necessary but only if userfetch is not enabled

This behave the same as the previous patch and also displays a message to indicate when FEATURES="-userfetch" is usefule.
Comment 14 Rico Poser 2009-05-01 16:55:29 UTC
Unfortunately I cannot apply the third patch from 2009-04-30 19:55.

Applying it directly to a fresh re-emerge of portage 2.1.6.11 results in:
beta portage # patch /usr/lib/portage/pym/portage/__init__.py /tmp/bfree.patch
patching file /usr/lib/portage/pym/portage/__init__.py
Hunk #1 succeeded at 3888 (offset -82 lines).
patch unexpectedly ends in middle of line
Hunk #2 succeeded at 3906 (offset -82 lines).

Applying the second patch from 2009-04-30 06:36 first (after a fresh emerge of portage 2.1.6.11) and then the third patch results in:
beta tmp # patch /usr/lib/portage/pym/portage/__init__.py /tmp/bfree2.patch
patching file /usr/lib/portage/pym/portage/__init__.py
Hunk #1 succeeded at 3897 (offset -82 lines).
beta tmp # patch /usr/lib/portage/pym/portage/__init__.py /tmp/bfree3.patch
patching file /usr/lib/portage/pym/portage/__init__.py
Hunk #1 succeeded at 3888 (offset -82 lines).
patch unexpectedly ends in middle of line
Hunk #2 FAILED at 3906.
1 out of 2 hunks FAILED -- saving rejects to file /usr/lib/portage/pym/portage/__init__.py.rej

How can I apply it correctly?
Comment 15 Zac Medico gentoo-dev 2009-05-01 18:27:16 UTC
(In reply to comment #14)
> Unfortunately I cannot apply the third patch from 2009-04-30 19:55.
> 
> Applying it directly to a fresh re-emerge of portage 2.1.6.11 results in:
> beta portage # patch /usr/lib/portage/pym/portage/__init__.py /tmp/bfree.patch
> patching file /usr/lib/portage/pym/portage/__init__.py
> Hunk #1 succeeded at 3888 (offset -82 lines).
> patch unexpectedly ends in middle of line
> Hunk #2 succeeded at 3906 (offset -82 lines).

You can ignore that error. The patch only contains 2 hunks, so it completely applied, despite the error.
Comment 16 Zac Medico gentoo-dev 2009-05-02 02:36:32 UTC
This is fixed in 2.1.6.12 and 2.2_rc32.
Comment 17 Rico Poser 2009-05-02 17:24:51 UTC
Sorry, but the third patch (2009-04-30 19:55) applied to portage 2.1.6.11 is not working. The same with portage 2.1.6.12.

beta portage # emerge --info
Portage 2.1.6.12 (default/linux/alpha/2008.0/server, gcc-4.3.2, glibc-2.8_p20080602-r1, 2.6.26-gentoo-r2 alpha)
=================================================================
System uname: Linux-2.6.26-gentoo-r2-alpha-EV67-with-glibc2.0
Timestamp of tree: Sat, 02 May 2009 16:30:01 +0000
...

with feature "userfetch":

beta portage # emerge layman
Calculating dependencies... done!
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) app-portage/layman-1.1.1
!!! Insufficient space to store layman-1.1.1.tar.gz in /usr/portage/distfiles
!!! Couldn't download 'layman-1.1.1.tar.gz'. Aborting.
 * Fetch failed for 'app-portage/layman-1.1.1', Log file:
 *  '/var/tmp/portage/app-portage/layman-1.1.1/temp/build.log'
>>> Failed to emerge app-portage/layman-1.1.1, Log file:
>>>  '/var/tmp/portage/app-portage/layman-1.1.1/temp/build.log'
 * Messages for package app-portage/layman-1.1.1:
 * Fetch failed for 'app-portage/layman-1.1.1', Log file:
 *  '/var/tmp/portage/app-portage/layman-1.1.1/temp/build.log'

with feature "-userfetch":

beta etc # emerge layman
Calculating dependencies... done!
>>> Verifying ebuild manifests
>>> Emerging (1 of 1) app-portage/layman-1.1.1
!!! Insufficient space to store layman-1.1.1.tar.gz in /usr/portage/distfiles
!!! Couldn't download 'layman-1.1.1.tar.gz'. Aborting.
 * Fetch failed for 'app-portage/layman-1.1.1', Log file:
 *  '/var/tmp/portage/app-portage/layman-1.1.1/temp/build.log'
>>> Failed to emerge app-portage/layman-1.1.1, Log file:
>>>  '/var/tmp/portage/app-portage/layman-1.1.1/temp/build.log'
 * Messages for package app-portage/layman-1.1.1:
 * Fetch failed for 'app-portage/layman-1.1.1', Log file:
 *  '/var/tmp/portage/app-portage/layman-1.1.1/temp/build.log'
Comment 18 Zac Medico gentoo-dev 2009-05-02 20:51:47 UTC
Created attachment 190169 [details, diff]
fix inverted logic 

The logic was inverted. This patch fixes it (applies to portage-2.1.6.12).
Comment 19 Zac Medico gentoo-dev 2009-05-02 20:53:19 UTC
reopening
Comment 20 Rico Poser 2009-05-03 08:33:02 UTC
The inverted logic patch applied to portage-2.1.6.12 fixes it. It works as intended by using the "-userfetch" feature while showing a hint message if "userfetch" is enabled. Thank you very much for your help!
Comment 21 Zac Medico gentoo-dev 2009-05-03 21:54:30 UTC
This is fixed in 2.1.6.13 and 2.2_rc33.