The interaction between ROOT/--root and pre-existing binpkgs seems to be broken. First, two correct/working cases with ROOT='/': ``` # emerge -pekv --with-bdeps=y sys-apps/portage '<app-arch/zstd-1.5.7' These are the packages that would be merged, in order: Calculating dependencies... done! Dependency resolution took 4.17 s (backtrack: 0/100). [binary R ] sys-devel/gnuconfig-20240728-2::gentoo 0 KiB … [binary R ] sys-apps/portage-3.0.67-1::gentoo USE="(ipc) native-extensions xattr -apidoc -build -doc -gentoo-dev -rsync-verify (-selinux) -test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13)" 0 KiB … [binary R ] app-alternatives/bc-0-2::gentoo USE="gnu -gh" 0 KiB Total: 198 packages (198 reinstalls, 198 binaries), Size of downloads: 0 KiB # emerge -pekv --with-bdeps=y sys-apps/portage '<app-arch/zstd-1.5.7' These are the packages that would be merged, in order: Calculating dependencies... done! Dependency resolution took 2.33 s (backtrack: 0/100). [binary R ] sys-devel/gnuconfig-20240728-2::gentoo 0 KiB … [binary R ] sys-apps/portage-3.0.67-1::gentoo USE="(ipc) native-extensions xattr -apidoc -build -doc -gentoo-dev -rsync-verify (-selinux) -test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13)" 0 KiB … [binary R ] dev-python/setuptools-scm-8.2.0-3::gentoo USE="-test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13) (-python3_13t)" 0 KiB Total: 198 packages (198 reinstalls, 198 binaries), Size of downloads: 0 KiB ``` But then on exactly the same system with no changes and /mnt/root empty: ``` # emerge --root /mnt/root --sysroot / -pekv --with-bdeps=y sys-apps/portage '<app-arch/zstd-1.5.7' These are the packages that would be merged, in order: Calculating dependencies... done! Dependency resolution took 8.11 s (backtrack: 1/100). [binary R ] sys-devel/gnuconfig-20240728-2::gentoo 0 KiB … [ebuild N ] sys-apps/portage-3.0.67::gentoo to /mnt/root/ USE="(ipc) native-extensions xattr -apidoc -build -doc -gentoo-dev -rsync-verify (-selinux) -test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13)" 0 KiB … [binary R ] app-alternatives/bc-0-2::gentoo USE="gnu -gh" 0 KiB Total: 271 packages (80 new, 191 reinstalls, 229 binaries), Size of downloads: 0 KiB WARNING: One or more updates/rebuilds have been skipped due to a dependency conflict: app-arch/zstd:0 (app-arch/zstd-1.5.7:0/1::gentoo, ebuild scheduled for merge) USE="contrib lz4 lzma (split-usr) zlib -static-libs -test" conflicts with <app-arch/zstd-1.5.7:= required by (dev-python/zstandard-0.23.0-r1-1:0/0::gentoo, installed) USE="-debug -test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13)" ^ ^^^^^ <app-arch/zstd-1.5.7:0/1= required by (dev-python/zstandard-0.23.0-r1-1:0/0::gentoo, installed) USE="-debug -test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13)" ^ ^^^^^ # emerge --root /mnt/root --sysroot / -peKv --with-bdeps=y sys-apps/portage '<app-arch/zstd-1.5.7' These are the packages that would be merged, in order: Calculating dependencies... done! Dependency resolution took 0.85 s (backtrack: 0/100). !!! All ebuilds that could satisfy "sys-apps/portage" for /mnt/root/ have been masked. !!! One of the following masked packages is required to complete your request: - sys-apps/portage-3.0.67::gentoo (masked by: use flag configuration mismatch) - sys-apps/portage-3.0.66.1-r1:: gentoo (masked by: use flag configuration mismatch) - sys-apps/portage-3.0.65-r1:: gentoo (masked by: use flag configuration mismatch) - sys-apps/portage-3.0.63-r1:: gentoo (masked by: use flag configuration mismatch) For more information, see the MASKED PACKAGES section in the emerge man page or refer to the Gentoo Handbook. ``` … the first output (without '--root') shows that binary packages exist for every one of the 198 ebuilds required to satisfy this dependency-tree. With '--root' and '--usepkg', several completely valid (as indicated above) binary packages are skipped and so 271 packages (inc, build dependencies) are pulled-in with 229 of these being the binary packages. Additionally, '<app-arch/zstd-1.5.7' seems to have been ignored. Every package to be installed to '/' is using a binary package, but most (although not all) packages to be installed to $ROOT are showing as needing to be rebuilt. Then with '--root' and '--usepkgonly', the whole thing breaks down and a use flag mismatch is flagged - although, unhelpfully, the difference between what was requested and what emerge believes to be present is not revealed. ``` diff <( emerge --info | grep '^USE=' ) <( emerge --root /mnt/root --sysroot / --info | grep '^USE=' ) ``` … shows no differences. ``` # emerge --info sys-apps/portage … ================================================================= Package Settings ================================================================= sys-apps/portage-3.0.67::gentoo was built with the following: USE="(ipc) native-extensions xattr -apidoc -build -doc -gentoo-dev -rsync-verify (-selinux) -test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13)" … # emerge --root /mnt/root --sysroot / -pv --nodeps sys-apps/portage These are the packages that would be merged, in order: [ebuild N ] sys-apps/portage-3.0.67::gentoo to /mnt/root/ USE="(ipc) native-extensions xattr -apidoc -build -doc -gentoo-dev -rsync-verify (-selinux) -test" PYTHON_TARGETS="python3_12 (-pypy3) (-pypy3_11) -python3_10 -python3_11 (-python3_13)" 0 KiB Total: 1 package (1 new), Size of downloads: 0 KiB ``` … so there doesn't appear to any difference in flags between the existing binary package, and what 'emerge' wants to build from scratch.