Portage Errors: touch: No such file or directory
After updating coreutils you may encounter a problem using touch. This problem often manifests itself as a loop while trying to update other packages:
* Touching gcc/cstamp-h.in * touch: setting times of `gcc/cstamp-h.in': No such file or directory * make: *** [gcc/cstamp-h.in] Error 1 * Touching gcc/cstamp-h.in * touch: setting times of `gcc/cstamp-h.in': No such file or directory * make: *** [gcc/cstamp-h.in] Error 1 ...
or a one-off event that breaks the merge:
touch: setting times of `config.h.in': No such file or directory make: *** [config.h.in] Error 1 emake failed * ERROR: sys-process/psmisc-22.12 failed (compile phase): * (no error message) * * Call stack: * ebuild.sh, line 56: Called src_compile * environment, line 2663: Called die * The specific snippet of code: * emake || die * * If you need support, post the output of 'emerge --info =sys-process/psmisc-22.12', * the complete build log and the output of 'emerge -pqv =sys-process/psmisc-22.12'. * The complete build log is located at '/var/tmp/portage/sys-process/psmisc-22.12/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/sys-process/psmisc-22.12/temp/environment'. * S: '/var/tmp/portage/sys-process/psmisc-22.12/work/psmisc-22.12' >>> Failed to emerge sys-process/psmisc-22.12,
This problem occurs on systems running kernels older than 2.6.22, where futimesat was introduced. This pops up a lot on my older Gentoo VMs for obvious reasons (wouldn't it be nice if we could have an up-to-date stable xen-sources package one day?).
You have four options:
Upgrade your kernel - this is the ideal solution but in an ideal world we all live forever and make too much money.
Disable sandbox - sandbox is intended to soften poorly written scripts. simply add -sandbox to your FEATURES variable. Not a big fan of this solution.
Replace touch with busybox's implementation - this is a neat trick but I have encountered problems using bb's touch in place of coreutils and the next time you update the symlink may get wiped out.
# rm /bin/touch && ln -s /bin/bb /bin/touch
Mask versions of coreutils newer than 8.5 - this is the ideologically correct way to take care of things if upgrading the kernel is not in your cards today.
# echo ">=sys-apps/coreutils-8.6" >> /etc/portage/package.mask
It's important that you remember to remove the mask once you do. Funnily enough, if you have already installed coreutils-8.6+ emerging 8.5 will fail due to the broken touch, in this case you may wish to temporarily use one of the other solutions to get it installed:
checking for struct utmpx.ut_exit.e_termination... yes checking for struct utmp.ut_exit.e_termination... yes checking for stdlib.h... (cached) yes checking for GNU libc compatible realloc... yes checking for working re_compile_pattern... yes checking whether rename honors trailing slash on destination... touch: setting times of `conftest.f': No such file or directory configure: error: cannot create temporary files !!! Please attach the following file when seeking support: !!! /var/tmp/portage/sys-apps/coreutils-8.5/work/coreutils-8.5/config.log * ERROR: sys-apps/coreutils-8.5 failed (compile phase): * econf failed * * Call stack: * ebuild.sh, line 56: Called src_compile * environment, line 2495: Called econf '--with-packager=Gentoo' '--with-packager-version=8.5 (p1)' '--with-packager-bug-reports=http://bugs.gentoo.org/' '--enable-install-program=arch' '--enable-no-install-program=groups,hostname,kill,su,uptime' '--enable-largefile' '--disable-libcap' '--enable-nls' '--enable-acl' '--disable-xattr' '--without-gmp' * ebuild.sh, line 557: Called die * The specific snippet of code: * die "econf failed" * * If you need support, post the output of 'emerge --info =sys-apps/coreutils-8.5', * the complete build log and the output of 'emerge -pqv =sys-apps/coreutils-8.5'. * The complete build log is located at '/var/tmp/portage/sys-apps/coreutils-8.5/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/sys-apps/coreutils-8.5/temp/environment'. * S: '/var/tmp/portage/sys-apps/coreutils-8.5/work/coreutils-8.5' >>> Failed to emerge sys-apps/coreutils-8.5