Does switching Gentoo profiles preserve per-package USE flag overrides without triggering full rebuilds?
0 reputation · 19 Sept 2026, 17:55 UTC
0 reputation · 19 Sept 2026, 17:55 UTC
Gentoo profiles define baseline USE flags in make.defaults, while administrators set global flags in /etc/portage/make.conf and per-package overrides in /etc/portage/package.use. When migrating from default/linux/amd64/17.1 to default/linux/amd64/17.1/desktop/gnome, the new profile adds flags such as systemd and pulseaudio that may conflict with existing per-package -systemd or -pulseaudio entries.
Portage evaluates the effective USE set after profile change, but documentation does not clearly state whether a per-package package.use entry that negates a newly added profile flag prevents the package from being selected by --changed-use. The emerge --pretend --changed-use @world output shows rebuild candidates, yet it is unclear if the decision logic respects the explicit negation or treats the profile addition as a net change requiring rebuild.
Additionally, binary package caches (PKGDIR) built under the old profile may lack the new USE combination, forcing source rebuilds even when the effective flags match an existing binary.
-flag in package.use suppress --changed-use selection when a new profile adds +flag?emerge --usepkgonly satisfy dependencies after a profile switch without source rebuilds if the effective USE set matches a cached binary?35275 reputation · 20 Sept 2026, 03:00 UTC
Yes, in most cases. A per-package -flag entry in /etc/portage/package.use is preserved across a profile switch and is evaluated after the profile's defaults, so it cancels a profile-added +flag. When the net effective USE set for a package is unchanged, emerge --changed-use @world does not select that package for rebuild. The rebuild candidates you see in the pretend output are the packages whose effective flags actually changed — not every package the new profile touches.
Portage merges USE flags in a defined order: profile make.defaults first, then make.conf globals, then package.use per-package entries (with use.force/use.mask able to override everything). Switching from default/linux/amd64/17.1 to the desktop/gnome sub-profile adds flags like systemd and pulseaudio at the profile layer only. An existing package.use line such as media-sound/foo -pulseaudio still wins for that package, so its effective set is identical before and after the switch, and --changed-use — which compares the symmetric difference of effective sets — skips it.
One caveat: this describes long-standing, well-established Portage behavior, but exact --changed-use edge cases have varied across Portage releases. Treat the pretend output, not assumptions, as authoritative for your installed version.
The definitive query is the pretend merge itself, plus a direct flag dump:
emerge --pretend --verbose --changed-use @world
emerge --info | less # global effective USE
portageq envvar USE # resolved global setFor a single package, emerge -pv category/package shows the resolved per-package flags with their origin (flags from package.use are shown distinctly from profile defaults). If a package you expected to be protected by a negation still appears as a rebuild candidate, check for use.force in the new profile — a forced flag cannot be negated by package.use, and GNOME profiles force some flags.
emerge --usepkgonly can reuse a cached binary only when the binary's recorded USE (and USE_EXPAND values like USE= groups for ABI_X86, PYTHON_TARGETS, etc.) exactly matches the current effective configuration. Matching the visible USE string is not sufficient — binaries built under the old profile may differ in USE_EXPAND settings resolved at build time, in which case Portage correctly falls back to a source build. Inspect a binary's metadata with qxpak or emerge --pretend --usepkgonly --verbose to see why a cached package was rejected.
emerge -pv --changed-use @world immediately after eselect profile set and save the list.package.use, then re-run the pretend merge; packages whose effective set is now unchanged should drop off the list.--usepkg if you want binaries considered, and expect source rebuilds where USE_EXPAND or forced flags genuinely changed.If a package still rebuilds despite a matching negation, the missing diagnostic is whether the flag is use.forced in the new profile — check portageq get_repo_path / gentoo and inspect the profile's use.force files before assuming a Portage bug.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.