I was close to get package installed fully but pressed ctrl+c as I wanted to see 'emerge -pv' before merging it in. It seems emerge was somewhere abot 'qmerge' and it broke my installation: # emerge =sci-libs/tensorflow-1.8.0 * IMPORTANT: 9 news items need reading for repository 'gentoo'. * Use eselect news read to view new items. Calculating dependencies... done! >>> Verifying ebuild manifests >>> Emerging (1 of 5) dev-python/namespace-google-1::gentoo >>> Unpacking source... >>> Source unpacked in /scratch/var/tmp/portage/dev-python/namespace-google-1/work >>> Preparing source in /scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1 ... >>> Source prepared. >>> Configuring source in /scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1 ... >>> Source configured. >>> Compiling source in /scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1 ... >>> Source compiled. >>> Test phase [not enabled]: dev-python/namespace-google-1 >>> Install namespace-google-1 into /scratch/var/tmp/portage/dev-python/namespace-google-1/image/ category dev-python * python2_7: running python_domodule google * python3_5: running python_domodule google * python3_6: running python_domodule google >>> Completed installing namespace-google-1 into /scratch/var/tmp/portage/dev-python/namespace-google-1/image/ * Final size of build directory: 16 KiB * Final size of installed tree: 100 KiB >>> Installing (1 of 5) dev-python/namespace-google-1::gentoo ^C Exiting on signal 2 Traceback (most recent call last): File "/usr/lib/portage/python2.7/filter-bash-environment.py", line 154, in <module> re.compile(var_pattern), file_in, file_out) File "/usr/lib/portage/python2.7/filter-bash-environment.py", line 74, in filter_bash_environment have_end_quote(quote, line[var_assign_match.end(2)+2:]): KeyboardInterrupt close failed in file object destructor: sys.excepthook is missing lost sys.stderr * ERROR: dev-python/namespace-google-1::gentoo failed (postinst phase): * filter-bash-environment.py failed * * Call stack: * ebuild.sh, line 789: Called __ebuild_main 'postinst' * phase-functions.sh, line 999: Called __filter_readonly_variables '--filter-path' '--filter-sandbox' '--allow-extra-vars' * phase-functions.sh, line 139: Called die * The specific snippet of code: * "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed" * * If you need support, post the output of `emerge --info '=dev-python/namespace-google-1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/namespace-google-1::gentoo'`. * The complete build log is located at '/scratch/var/tmp/portage/dev-python/namespace-google-1/temp/build.log'. * The ebuild environment file is located at '/scratch/var/tmp/portage/dev-python/namespace-google-1/temp/environment'. * Working directory: '/usr/lib64/python2.7/site-packages' * S: '/scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1' ebuild-ipc: during write: subprocess failure: 2 * Messages for package dev-python/namespace-google-1: * ERROR: dev-python/namespace-google-1::gentoo failed (postinst phase): * filter-bash-environment.py failed * * Call stack: * ebuild.sh, line 789: Called __ebuild_main 'postinst' * phase-functions.sh, line 999: Called __filter_readonly_variables '--filter-path' '--filter-sandbox' '--allow-extra-vars' * phase-functions.sh, line 139: Called die * The specific snippet of code: * "${PORTAGE_PYTHON:-/usr/bin/python}" "${PORTAGE_BIN_PATH}"/filter-bash-environment.py "${filtered_vars}" || die "filter-bash-environment.py failed" * * If you need support, post the output of `emerge --info '=dev-python/namespace-google-1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/namespace-google-1::gentoo'`. * The complete build log is located at '/scratch/var/tmp/portage/dev-python/namespace-google-1/temp/build.log'. * The ebuild environment file is located at '/scratch/var/tmp/portage/dev-python/namespace-google-1/temp/environment'. * Working directory: '/usr/lib64/python2.7/site-packages' * S: '/scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1' # emerge =sci-libs/tensorflow-1.8.0 -pv These are the packages that would be merged, in order: Calculating dependencies... done! [ebuild U ] dev-python/protobuf-python-3.5.2-r1:0/15::gentoo [3.5.2:0/15::gentoo] PYTHON_TARGETS="python2_7 python3_5 python3_6* -python3_4" 0 KiB [ebuild R ] dev-python/absl-py-0.1.13::science USE="(-test%)" PYTHON_TARGETS="python2_7 python3_5 python3_6* -python3_4" 0 KiB [ebuild R ] dev-python/wheel-0.30.0::gentoo USE="-doc {-test}" PYTHON_TARGETS="python2_7 python3_5 python3_6* -pypy -pypy3 -python3_4" 0 KiB [ebuild U ] sci-libs/tensorflow-1.8.0::science [1.7.0::science] USE="cxx%* -cuda -mpi (-opencl%)" PYTHON_TARGETS="python2_7 python3_5 python3_6* -python3_4" 0 KiB Total: 4 packages (2 upgrades, 2 reinstalls), Size of downloads: 0 KiB # # emerge -1 dev-python/namespace-google * IMPORTANT: 9 news items need reading for repository 'gentoo'. * Use eselect news read to view new items. Calculating dependencies... done! >>> Verifying ebuild manifests >>> Emerging (1 of 1) dev-python/namespace-google-1::gentoo >>> Unpacking source... >>> Source unpacked in /scratch/var/tmp/portage/dev-python/namespace-google-1/work >>> Preparing source in /scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1 ... >>> Source prepared. >>> Configuring source in /scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1 ... >>> Source configured. >>> Compiling source in /scratch/var/tmp/portage/dev-python/namespace-google-1/work/namespace-google-1 ... >>> Source compiled. >>> Test phase [not enabled]: dev-python/namespace-google-1 >>> Install namespace-google-1 into /scratch/var/tmp/portage/dev-python/namespace-google-1/image/ category dev-python * python2_7: running python_domodule google * python3_5: running python_domodule google * python3_6: running python_domodule google >>> Completed installing namespace-google-1 into /scratch/var/tmp/portage/dev-python/namespace-google-1/image/ * Final size of build directory: 16 KiB * Final size of installed tree: 100 KiB >>> Installing (1 of 1) dev-python/namespace-google-1::gentoo bzip2: Compressed file ends unexpectedly; perhaps it is corrupted? *Possible* reason follows. bzip2: Success Input file = /var/db/pkg/dev-python/namespace-google-1/environment.bz2, output file = (stdout) It is possible that the compressed file(s) have become corrupted. You can use the -tvv option to test integrity of such files. You can use the `bzip2recover' program to attempt to recover data from undamaged sections of corrupted files. !!! FAILED prerm: 2 * ERROR: dev-python/namespace-google-1::gentoo failed (postrm phase): * python-r1.eclass could not be found by inherit() * * Call stack: * ebuild.sh, line 635: Called source '/var/db/pkg/dev-python/namespace-google-1/namespace-google-1.ebuild' * namespace-google-1.ebuild, line 7: Called inherit 'python-r1' * ebuild.sh, line 300: Called die * The specific snippet of code: * [[ -z ${location} ]] && die "${1}.eclass could not be found by inherit()" * * If you need support, post the output of `emerge --info '=dev-python/namespace-google-1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/namespace-google-1::gentoo'`. * The complete build log is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/build.log'. * The ebuild environment file is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/die.env'. * Working directory: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/homedir' * S: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/work/namespace-google-1' * QA Notice: ECLASS 'python-r1' inherited illegally in dev-python/namespace-google-1 * ERROR: dev-python/namespace-google-1::gentoo failed: * python-r1.eclass could not be found by inherit() * * Call stack: * misc-functions.sh, line 17: Called source '/usr/lib/portage/python2.7/ebuild.sh' * ebuild.sh, line 635: Called source '/var/db/pkg/dev-python/namespace-google-1/namespace-google-1.ebuild' * namespace-google-1.ebuild, line 7: Called inherit 'python-r1' * ebuild.sh, line 300: Called die * The specific snippet of code: * [[ -z ${location} ]] && die "${1}.eclass could not be found by inherit()" * * If you need support, post the output of `emerge --info '=dev-python/namespace-google-1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/namespace-google-1::gentoo'`. * The complete build log is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/build.log'. * The ebuild environment file is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/die.env'. * Working directory: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/homedir' * S: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/work/namespace-google-1' !!! FAILED postrm: 1 * The 'postrm' phase of the 'dev-python/namespace-google-1' package has * failed with exit value 1. * * The problem occurred while executing the ebuild file named 'namespace- * google-1.ebuild' located in the '/var/db/pkg/dev-python/namespace- * google-1' directory. If necessary, manually remove the environment.bz2 * file and/or the ebuild file located in that directory. * * Removal of the environment.bz2 file is preferred since it may allow the * removal phases to execute successfully. The ebuild will be sourced and * the eclasses from the current portage tree will be used when necessary. * Removal of the ebuild file will cause the pkg_prerm() and pkg_postrm() * removal phases to be skipped entirely. * Messages for package dev-python/namespace-google-1: * The 'postrm' phase of the 'dev-python/namespace-google-1' package has * failed with exit value 1. * * The problem occurred while executing the ebuild file named 'namespace- * google-1.ebuild' located in the '/var/db/pkg/dev-python/namespace- * google-1' directory. If necessary, manually remove the environment.bz2 * file and/or the ebuild file located in that directory. * * Removal of the environment.bz2 file is preferred since it may allow the * removal phases to execute successfully. The ebuild will be sourced and * the eclasses from the current portage tree will be used when necessary. * Removal of the ebuild file will cause the pkg_prerm() and pkg_postrm() * removal phases to be skipped entirely. * ERROR: dev-python/namespace-google-1::gentoo failed (postrm phase): * python-r1.eclass could not be found by inherit() * * Call stack: * ebuild.sh, line 635: Called source '/var/db/pkg/dev-python/namespace-google-1/namespace-google-1.ebuild' * namespace-google-1.ebuild, line 7: Called inherit 'python-r1' * ebuild.sh, line 300: Called die * The specific snippet of code: * [[ -z ${location} ]] && die "${1}.eclass could not be found by inherit()" * * If you need support, post the output of `emerge --info '=dev-python/namespace-google-1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/namespace-google-1::gentoo'`. * The complete build log is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/build.log'. * The ebuild environment file is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/die.env'. * Working directory: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/homedir' * S: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/work/namespace-google-1' * Messages for package dev-python/namespace-google-1: * ERROR: dev-python/namespace-google-1::gentoo failed: * python-r1.eclass could not be found by inherit() * * Call stack: * misc-functions.sh, line 17: Called source '/usr/lib/portage/python2.7/ebuild.sh' * ebuild.sh, line 635: Called source '/var/db/pkg/dev-python/namespace-google-1/namespace-google-1.ebuild' * namespace-google-1.ebuild, line 7: Called inherit 'python-r1' * ebuild.sh, line 300: Called die * The specific snippet of code: * [[ -z ${location} ]] && die "${1}.eclass could not be found by inherit()" * * If you need support, post the output of `emerge --info '=dev-python/namespace-google-1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-python/namespace-google-1::gentoo'`. * The complete build log is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/build.log'. * The ebuild environment file is located at '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/temp/die.env'. * Working directory: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/homedir' * S: '/scratch/var/tmp/portage/._unmerge_/dev-python/namespace-google-1/work/namespace-google-1' >>> Auto-cleaning packages... >>> No outdated packages were found on your system. # I "fixed" that with unmerging dev-python/namespace-google-1 and a new install of the same, see the attached file also contain 'emerge --info'. Seems emerge can be cancelled in routines which can break the system. I thought it is "atomic" and either I cancel the "installation" in time or not.
Created attachment 529330 [details] umerge_and_emerge # emerge --unmerge dev-python/namespace-google # emerge -1 dev-python/namespace-google # emerge --info
Atomicity really has to be implemented at the filesystem level, and is better delegated to the caller of emerge. *** This bug has been marked as a duplicate of bug 40127 ***
But how about ignoring ctrl+c in the critical parts?
(In reply to Martin Mokrejš from comment #3) > But how about ignoring ctrl+c in the critical parts? There are a number of signals that can't be ignored. The failure already tells you what to do (if you remove the corrupted environment.bz2, it will regenerate it and continue.) I think there is an open question as to whether portage should just do that automatically.
Actually, we can update the enviroment.bz2 file more atomically, by writing it to a temporary file in the same directory and then renaming it. The relevant code uses a PORTAGE_UPDATE_ENV variable to refer to the path, which currently refers directly to environment.bz2 rather than a temporary file.