If you do not set STAGE1_PATH manually, it does not correctly write the gcc shell wrapper. See: https://gitweb.gentoo.org/repo/proj/prefix.git/tree/scripts/bootstrap-prefix.sh#n1478 This uses the variable, but the variable is only set up the interactive installation function. In manual installation, the variable goes unset, thus breaking the installation. Either the variable should have a fallback, or the manual should indicate STAGE1_PATH must be set at stage1 bootstrap time.
Could we have a log from when this fails (and emerge --info from within the working Prefix, for the hell of it?)
Repro Dockerfile: FROM ubuntu:focal RUN apt-get update && apt-get install -y curl build-essential RUN mkdir -p /titus/linux ENV EPREFIX /titus/linux ENV PATH /titus/linux/usr/bin:/titus/linux/bin:/titus/linux/tmp/usr/bin:/titus/linux/tmp/bin:/usr/bin:/bin #ENV STAGE1_PATH /titus/linux/usr/bin:/titus/linux/bin:/titus/linux/tmp/usr/bin:/titus/linux/tmp/bin:/usr/bin:/bin RUN curl -o /titus/linux/bootstrap-prefix.sh https://gitweb.gentoo.org/repo/proj/prefix.git/plain/scripts/bootstrap-prefix.sh RUN chmod 755 /titus/linux/bootstrap-prefix.sh RUN bash -x /titus/linux/bootstrap-prefix.sh /titus/linux stage1 RUN /titus/linux/bootstrap-prefix.sh /titus/linux stage2
The log: /usr/bin/install -c -m 644 -o root -g root -t /titus/linux/tmp/etc ./dispatch-conf.conf ./etc-update.conf ( cd /titus/linux/tmp/etc && ln -s /titus/linux/tmp/usr/share/portage/config/make.globals ) make[1]: Leaving directory '/titus/linux/var/tmp/portage-3.0.12.0.2/prefix-portage-3.0.12.0.2/cnf' make[1]: Entering directory '/titus/linux/var/tmp/portage-3.0.12.0.2/prefix-portage-3.0.12.0.2' make[2]: Entering directory '/titus/linux/var/tmp/portage-3.0.12.0.2/prefix-portage-3.0.12.0.2' make[2]: Nothing to be done for 'install-exec-am'. make[2]: Nothing to be done for 'install-data-am'. make[2]: Leaving directory '/titus/linux/var/tmp/portage-3.0.12.0.2/prefix-portage-3.0.12.0.2' make[1]: Leaving directory '/titus/linux/var/tmp/portage-3.0.12.0.2/prefix-portage-3.0.12.0.2' + cd /titus/linux + rm -Rf /titus/linux/var/tmp/portage-3.0.12.0.2 + mkdir -p /titus/linux/tmp/var/log + rm -f /titus/linux/tmp/usr/lib/portage/bin/ebuild-helpers/sed + local tmpportdir=/titus/linux/tmp//var/db/repos/gentoo + [[ -e /titus/linux/tmp//var/db/repos/gentoo ]] + ln -s /titus/linux/var/db/repos/gentoo /titus/linux/tmp//var/db/repos/gentoo + for d in "${ROOT}"/tmp/usr/lib/python?.? + [[ -e /titus/linux/tmp/usr/lib/python3.8/portage ]] + ln -s /titus/linux/tmp/usr/lib/portage/lib/portage /titus/linux/tmp/usr/lib/python3.8/portage + [[ -e /titus/linux/tmp/usr/lib/python3.8/_emerge ]] + ln -s /titus/linux/tmp/usr/lib/portage/lib/_emerge /titus/linux/tmp/usr/lib/python3.8/_emerge + [[ -s /titus/linux/var/db/repos/gentoo/profiles/repo_name ]] + sed -i -e s,gentoo_prefix,gentoo, /titus/linux/tmp/usr/share/portage/config/repos.conf + einfo 'prefix-portage-3.0.12.0.2 successfully bootstrapped' + echo '* prefix-portage-3.0.12.0.2 successfully bootstrapped' * prefix-portage-3.0.12.0.2 successfully bootstrapped + prepare_portage + mkdir -p /titus/linux/bin/. /titus/linux/var/log + [[ -x /titus/linux/bin/bash ]] + ln -s /titus/linux/tmp/bin/bash /titus/linux/bin/bash + [[ -x /titus/linux/bin/sh ]] + ln -s bash /titus/linux/bin/sh + estatus 'stage1 finished' + printf '\033]2;stage1 finished\007' + einfo 'stage1 successfully finished' + echo '* stage1 successfully finished' * stage1 successfully finished Removing intermediate container 5d8edfd839a0 ---> 3eeddf695755 Step 9/14 : RUN /titus/linux/bootstrap-prefix.sh /titus/linux stage2 ---> Running in a9f7b2bb52f3 * Bootstrapping Gentoo prefixed portage installation using * host: x86_64-pc-linux-gnu * prefix: /titus/linux * ready to bootstrap stage2 * Triggering Linux RAP bootstrap USE=-acl -berkdb -fortran -gdbm -git -libcxx -nls -pcre -python -qmanifest -qtegrity -readline bootstrap clang internal-glib PKG=sys-devel/gnuconfig Performing Global Updates (Could take a couple of minutes if you have a lot of binary packages.) .='update pass' *='binary update' #='/var/db update' @='/var/db move' s='/var/db SLOT move' %='binary move' S='binary SLOT move' p='update /etc/portage/package.*' /titus/linux/var/db/repos/gentoo/profiles/updates/1Q-2016............................................ /titus/linux/var/db/repos/gentoo/profiles/updates/2Q-2016........................................................ /titus/linux/var/db/repos/gentoo/profiles/updates/3Q-2016....................... /titus/linux/var/db/repos/gentoo/profiles/updates/4Q-2016............................. /titus/linux/var/db/repos/gentoo/profiles/updates/1Q-2017.............................. /titus/linux/var/db/repos/gentoo/profiles/updates/2Q-2017.... /titus/linux/var/db/repos/gentoo/profiles/updates/3Q-2017........................ /titus/linux/var/db/repos/gentoo/profiles/updates/4Q-2017....... /titus/linux/var/db/repos/gentoo/profiles/updates/1Q-2018..................... /titus/linux/var/db/repos/gentoo/profiles/updates/2Q-2018.................. /titus/linux/var/db/repos/gentoo/profiles/updates/3Q-2018... /titus/linux/var/db/repos/gentoo/profiles/updates/4Q-2018....... /titus/linux/var/db/repos/gentoo/profiles/updates/1Q-2019................. /titus/linux/var/db/repos/gentoo/profiles/updates/2Q-2019... /titus/linux/var/db/repos/gentoo/profiles/updates/3Q-2019...... /titus/linux/var/db/repos/gentoo/profiles/updates/4Q-2019....... /titus/linux/var/db/repos/gentoo/profiles/updates/1Q-2020............ /titus/linux/var/db/repos/gentoo/profiles/updates/2Q-2020........... /titus/linux/var/db/repos/gentoo/profiles/updates/3Q-2020.................................................................................................................................................... /titus/linux/var/db/repos/gentoo/profiles/updates/4Q-2020........ /titus/linux/var/db/repos/gentoo/profiles/updates/1Q-2021...... !!! BINPKG_COMPRESS unsupported zstd. Missing package: app-arch/zstd These are the packages that would be merged, in order: [ebuild N ] sys-devel/gnuconfig-20210107::gentoo 65 KiB Total: 1 package (1 new), Size of downloads: 65 KiB >>> Verifying ebuild manifests >>> Emerging (1 of 1) sys-devel/gnuconfig-20210107::gentoo Warning: File compression unsupported zstd. Missing package: app-arch/zstd Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") Warning: File compression unsupported zstd. Missing package: app-arch/zstd >>> Downloading 'http://distfiles.gentoo.org/distfiles/layout.conf' --2021-03-29 20:13:59-- http://distfiles.gentoo.org/distfiles/layout.conf Resolving distfiles.gentoo.org... 195.181.169.8, 89.187.177.16, 195.181.169.19, ... Connecting to distfiles.gentoo.org|195.181.169.8|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 45 [text/plain] Saving to: ‘/titus/linux/var/cache/distfiles/.layout.conf.distfiles.gentoo.org.__download__’ 0K 100% 8.67M=0s 2021-03-29 20:13:59 (8.67 MB/s) - ‘/titus/linux/var/cache/distfiles/.layout.conf.distfiles.gentoo.org.__download__’ saved [45/45] >>> Downloading 'http://distfiles.gentoo.org/distfiles/48/gnuconfig-20210107.tar.xz' --2021-03-29 20:13:59-- http://distfiles.gentoo.org/distfiles/48/gnuconfig-20210107.tar.xz Resolving distfiles.gentoo.org... 89.187.177.16, 195.181.169.8, 195.181.169.19, ... Connecting to distfiles.gentoo.org|89.187.177.16|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 65944 (64K) [application/x-xz] Saving to: ‘/titus/linux/var/cache/distfiles/gnuconfig-20210107.tar.xz.__download__’ 0K .......... .......... .......... .......... .......... 77% 335K 0s 50K .......... .... 100% 687K=0.2s 2021-03-29 20:13:59 (379 KB/s) - ‘/titus/linux/var/cache/distfiles/gnuconfig-20210107.tar.xz.__download__’ saved [65944/65944] * gnuconfig-20210107.tar.xz BLAKE2B SHA512 size ;-) ... [ ok ] Unable to unshare: EPERM (for FEATURES="pid-sandbox") Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Unpacking source... >>> Unpacking gnuconfig-20210107.tar.xz to /titus/linux/tmp/var/tmp/portage/sys-devel/gnuconfig-20210107/work >>> Source unpacked in /titus/linux/tmp/var/tmp/portage/sys-devel/gnuconfig-20210107/work Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Preparing source in /titus/linux/tmp/var/tmp/portage/sys-devel/gnuconfig-20210107/work ... * Applying 0001-add-ps2-targets-to-config.sub.patch ... [ ok ] >>> Source prepared. Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Configuring source in /titus/linux/tmp/var/tmp/portage/sys-devel/gnuconfig-20210107/work ... >>> Source configured. Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Compiling source in /titus/linux/tmp/var/tmp/portage/sys-devel/gnuconfig-20210107/work ... >>> Source compiled. Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Test phase [not enabled]: sys-devel/gnuconfig-20210107 Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Install sys-devel/gnuconfig-20210107 into /titus/linux/tmp/var/tmp/portage/sys-devel/gnuconfig-20210107/image >>> Completed installing sys-devel/gnuconfig-20210107 into /titus/linux/tmp/var/tmp/portage/sys-devel/gnuconfig-20210107/image * Final size of build directory: 324 KiB * Final size of installed tree: 128 KiB /titus/linux/tmp/usr/lib/portage/bin/estrip: line 38: scanelf: command not found /titus/linux/tmp/usr/lib/portage/bin/estrip: line 335: scanelf: command not found >>> Installing (1 of 1) sys-devel/gnuconfig-20210107::gentoo Warning: File compression unsupported zstd. Missing package: app-arch/zstd Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") Warning: File compression unsupported zstd. Missing package: app-arch/zstd * checking 3 files for package collisions >>> Merging sys-devel/gnuconfig-20210107 to / --- /titus/linux/tmp/usr/ --- /titus/linux/tmp/usr/share/ --- /titus/linux/tmp/usr/share/doc/ >>> /titus/linux/tmp/usr/share/doc/gnuconfig-20210107/ >>> /titus/linux/tmp/usr/share/doc/gnuconfig-20210107/ChangeLog.bz2 >>> /titus/linux/tmp/usr/share/gnuconfig/ >>> /titus/linux/tmp/usr/share/gnuconfig/config.guess >>> /titus/linux/tmp/usr/share/gnuconfig/config.sub >>> sys-devel/gnuconfig-20210107 merged. Warning: File compression unsupported zstd. Missing package: app-arch/zstd Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Auto-cleaning packages... >>> No outdated packages were found on your system. * GNU info directory index is up-to-date. USE=-acl -berkdb -fortran -gdbm -git -libcxx -nls -pcre -python -qmanifest -qtegrity -readline bootstrap clang internal-glib PKG=sys-apps/gentoo-functions !!! BINPKG_COMPRESS unsupported zstd. Missing package: app-arch/zstd These are the packages that would be merged, in order: [ebuild N ] sys-apps/gentoo-functions-0.14::gentoo 12 KiB Total: 1 package (1 new), Size of downloads: 12 KiB >>> Verifying ebuild manifests >>> Emerging (1 of 1) sys-apps/gentoo-functions-0.14::gentoo Warning: File compression unsupported zstd. Missing package: app-arch/zstd Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") Warning: File compression unsupported zstd. Missing package: app-arch/zstd >>> Downloading 'http://distfiles.gentoo.org/distfiles/48/gentoo-functions-0.14.tar.gz' --2021-03-29 20:14:02-- http://distfiles.gentoo.org/distfiles/48/gentoo-functions-0.14.tar.gz Resolving distfiles.gentoo.org... 89.187.177.16, 195.181.169.19, 195.181.169.8, ... Connecting to distfiles.gentoo.org|89.187.177.16|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 11330 (11K) [application/x-gzip] Saving to: ‘/titus/linux/var/cache/distfiles/gentoo-functions-0.14.tar.gz.__download__’ 0K .......... . 100% 5.31M=0.002s 2021-03-29 20:14:03 (5.31 MB/s) - ‘/titus/linux/var/cache/distfiles/gentoo-functions-0.14.tar.gz.__download__’ saved [11330/11330] * gentoo-functions-0.14.tar.gz BLAKE2B SHA512 size ;-) ... [ ok ] Unable to unshare: EPERM (for FEATURES="pid-sandbox") Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Unpacking source... >>> Unpacking gentoo-functions-0.14.tar.gz to /titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work >>> Source unpacked in /titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Preparing source in /titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work/gentoo-functions-0.14 ... >>> Source prepared. Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Configuring source in /titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work/gentoo-functions-0.14 ... >>> Source configured. Unable to unshare: EPERM (for FEATURES="ipc-sandbox network-sandbox pid-sandbox") >>> Compiling source in /titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work/gentoo-functions-0.14 ... make SHELL=/titus/linux/tmp/bin/bash gcc -O2 -pipe -O2 -pipe -I/titus/linux/tmp/usr/include -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -L/titus/linux/tmp/usr/lib -Wl,-rpath=/titus/linux/tmp/usr/lib consoletype.c -o consoletype /titus/linux/tmp/usr/local/bin/gcc: 3: exec: gcc: not found make: *** [<builtin>: consoletype] Error 127 * ERROR: sys-apps/gentoo-functions-0.14::gentoo failed (compile phase): * emake failed * * If you need support, post the output of `emerge --info '=sys-apps/gentoo-functions-0.14::gentoo'`, * the complete build log and the output of `emerge -pqv '=sys-apps/gentoo-functions-0.14::gentoo'`. * The complete build log is located at '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/temp/build.log'. * The ebuild environment file is located at '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/temp/environment'. * Working directory: '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work/gentoo-functions-0.14' * S: '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work/gentoo-functions-0.14' >>> Failed to emerge sys-apps/gentoo-functions-0.14, Log file: >>> '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/temp/build.log' * Messages for package sys-apps/gentoo-functions-0.14: * ERROR: sys-apps/gentoo-functions-0.14::gentoo failed (compile phase): * emake failed * * If you need support, post the output of `emerge --info '=sys-apps/gentoo-functions-0.14::gentoo'`, * the complete build log and the output of `emerge -pqv '=sys-apps/gentoo-functions-0.14::gentoo'`. * The complete build log is located at '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/temp/build.log'. * The ebuild environment file is located at '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/temp/environment'. * Working directory: '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work/gentoo-functions-0.14' * S: '/titus/linux/tmp/var/tmp/portage/sys-apps/gentoo-functions-0.14/work/gentoo-functions-0.14' The command '/bin/sh -c /titus/linux/bootstrap-prefix.sh /titus/linux stage2' returned a non-zero code: 1
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7ca9acf145b59b0efb129a52788308e7764971bf commit 7ca9acf145b59b0efb129a52788308e7764971bf Author: Fabian Groffen <grobian@gentoo.org> AuthorDate: 2021-03-31 06:51:08 +0000 Commit: Fabian Groffen <grobian@gentoo.org> CommitDate: 2021-03-31 06:51:08 +0000 scripts/bootstrap-prefix: ensure stage1 gcc wrapper is functional In the these days quite uncommon case of calling the stage functions directly, stage1's gcc wrapper would use the unset variable STAGE1_PATH. This variable is normally set in the interactive proze that re-defines PATH to remove any unwanted stuff. Avoid this dependency by storing the original value of PATH right at the startup of the script, such that stage1 can refer to it, whether or not called from the interactive wrapper or not. Thanks Sargun Dhillon in bug #779145. Closes: https://bugs.gentoo.org/779145 Signed-off-by: Fabian Groffen <grobian@gentoo.org> scripts/bootstrap-prefix.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)