When running stage2 in catalyst, at the very end of the stage run, this error can happen: > >>> sys-apps/texinfo-7.0 merged. > > * Messages for package sys-apps/baselayout-2.9: > > * After updating /etc/profile, please run > * env-update && . /etc/profile > * Please run env-update then log out and back in to > * update your path. > ------------------------------------------------------------------------------- > * Executing: emerge --oneshot -v --usepkg --buildpkg --prune sys-devel/gcc > > Calculating dependencies... done! > sys-devel/gcc-12.2.0 pulled in by: > @system requires sys-devel/gcc > sys-libs/glibc-2.36-r5 requires >=sys-devel/gcc-6.2 > > >>> No packages selected for removal by prune > >>> To ignore dependencies, use --nodeps > 18 Nov 2022 04:46:50 EST: ERROR : CatalystError: cmd(['/usr/share/catalyst/targets/stage2/stage2-controller.sh', 'run']) exited 1 > ERROR:catalyst:CatalystError: cmd(['/usr/share/catalyst/targets/stage2/stage2-controller.sh', 'run']) exited 1 > 18 Nov 2022 04:46:50 EST: NOTICE : /nas/catalyst/tmp/n32/stage2-mips3_n32-20221112/var/tmp/portage is not a mount point. Skipping > NOTICE:catalyst:/nas/catalyst/tmp/n32/stage2-mips3_n32-20221112/var/tmp/portage is not a mount point. Skipping > 18 Nov 2022 04:46:50 EST: ERROR : CatalystError: Stage build aborting due to error. > ERROR:catalyst:CatalystError: Stage build aborting due to error. > 18 Nov 2022 04:46:50 EST: ERROR : Exception running action sequence run_local > Traceback (most recent call last): > File "/usr/lib/python3.10/site-packages/catalyst/base/stagebase.py", line 1392, in run_local > cmd([self.settings['controller_file'], 'run'], > File "/usr/lib/python3.10/site-packages/catalyst/support.py", line 53, in cmd > raise CatalystError('cmd(%r) exited %s' % (args, ret), > catalyst.support.CatalystError: cmd(['/usr/share/catalyst/targets/stage2/stage2-controller.sh', 'run']) exited 1 The trigger is scripts/bootstrap.sh running this command on line 349: # Make sure we get the old gcc unmerged ... ${V_ECHO} emerge ${STRAP_EMERGE_OPTS} --prune sys-devel/gcc || cleanup 1 The return code of '1' will cause the stage2-chroot.sh script in catalyst to bail out. I am thinking that bootstrap.sh needs to be changed to not return '1' when the pruning of other sys-devel/gcc instances fails, since the intent is to remove all BUT the latest version (which is what emerge's manpage says about --prune). If the stage2 chroot already has all of the other gcc's removed, that command is going to return '1' because of @system requiring at least one sys-devel/gcc to be merged. I suggest making this change: --- scripts/bootstrap.sh.orig 2022-11-18 18:13:44.762079000 -0500 +++ scripts/bootstrap.sh 2022-11-18 18:13:56.330250000 -0500 @@ -346,7 +346,7 @@ if [[ -n ${STRAP_RUN} ]] ; then if [[ -x ${GCC_CONFIG} ]] && ${GCC_CONFIG} --get-current-profile &>/dev/null then # Make sure we get the old gcc unmerged ... - ${V_ECHO} emerge ${STRAP_EMERGE_OPTS} --prune sys-devel/gcc || cleanup 1 + ${V_ECHO} emerge ${STRAP_EMERGE_OPTS} --prune sys-devel/gcc # Make sure the profile and /lib/cpp and /usr/bin/cc are valid ... ${GCC_CONFIG} "$(${GCC_CONFIG} --get-current-profile)" &>/dev/null fi Another approach may be to run 'emerge --depclean --deep' instead of --prune. I've witnessed that older gcc's will typically get removed by a --depclean, even when stepping up a major version. That way, the "|| cleanup 1" bit can be retained to catch any failures by emerge.
Created attachment 838047 [details, diff] scripts/bootstrap.sh: don't fail on --prune of sys-devel/gcc (In reply to Joshua Kinard from comment #0) > Another approach may be to run 'emerge --depclean --deep' instead of > --prune. I've witnessed that older gcc's will typically get removed by a > --depclean, even when stepping up a major version. That way, the "|| > cleanup 1" bit can be retained to catch any failures by emerge. I tried testing using '--depclean --deep' recently and it still fails, so it's not viable. The only working solution, it seems, is to remove the "|| cleanup 1" bit from line #349. Attached an actual patch for that.