On 2026-02-09, Alan Mackenzie wrote:
> Hello, Nuno.
>
> On Mon, Feb 09, 2026 at 15:44:49 +0000, Nuno Silva wrote:
>> On 2026-02-09, Alan Mackenzie wrote:
[...]
>> >
>> > I think I know now what the cause of my problems is. The ebuild file for
>> > dev-libs/php-8.2.28-r1 had been removed (probably by emerge --sync)
>> > despite there still being a package (media-libs/libvpx) using it. This
>> > may be a bug in portage, I'm not sure.
>> >
>> > When I try # USE='-avif -webp' emerge -pqeO @preserved-rebuild (following
>> > the directions in the sets page of the wiki), I get
>> >
>> > [ebuild U ] dev-lang/php-8.2.30 [8.2.28-r1]
>> >
>> > .. When I follow up with # equery depends dev-lang/php-8.2.28-r1, I get
>> >
>> > * These packages depend on dev-lang/php-8.2.28-r1:
>> > media-libs/libvpx-1.15.2 (doc ? dev-lang/php)
>> >
>> > .. There is something funny, here. libvpx never had the doc USE flag, so
>> > why does it want php? Also, in the last day or so, I've rebuilt libvpx
>> > which now "uses" php-8.3.29 (for some value of "uses").
>
>> Wasn't the way to check for reverse dependencies affecting the graph of
>> installed packages
>
>> emerge -pvc atom
>
>> ?
>
> # USE='-avif -webp' emerge -pvc =dev-lang/php-8.2.28-r1
>
> proposes exactly one package to delete, php-8.2.28-r1 itself. There are
> no dependencies on this version of php.
Meaning nothing depends on it on that system.
I say that again below, but let me stress here, this is the --pretend
version of the command, replace -p by -a to have it ask for removal and
that's one way to uninstall it. But do read the rest because there's one
tidbit in need of clarification about portage (the distinction between
ebuild repositories and the database of installed packages).
>> > So, the question remains, why is emerge @preserved-rebuild trying to
>> > merge php-8.2.30? Nothing uses it.
>
>> Because it is installed.
>
> php-8.2.30 is not installed, but php-8.2.28-r1 is, sort of (see next
> paragraph). Nothing uses either of them.
Oh, right, "U". It's pulling that, I guess, because that's what's
now available from the tree/repository.
Again: this is not about something *needing* dev-lang/php, this is about
dev-lang/php being *installed*. It doesn't matter if it was installed
intentionally, if it was installed without adding it to @world
(i.e. emerge -1), or if it was installed as a dependency of some other
package, what matters is that it is installed and is relying on old
files from another package which are waiting to be cleaned.
This is why it needs to be rebuilt (or, lacking that possibility,
reinstalled in some other version).
> It took me some while to work out what you meant by "installed",
> especially given that the ebuild for php-8.2.28-r1 has been deleted
> (from /usr/portage/dev-lang/php/...). I think you mean that there is a
> directory /var/db/pkg/dev-lang/php-8.2.28-r1, which is indeed the
> case.
It means it is installed on that system. /var/db/pkg is the database of
installed packages. So yes, it has to have an entry there.
(The online manual page for portage(5) says, succintly:
«/var/db/pkg/
database to track installed packages»)
> [ Yes, I know /usr/portage is no longer the canonical place for ebuilds
> to live, but this is a system from 2017, originally. ]
>
> So emerge @preserved-rebuild is getting its information from
> /var/db/pkg, it seems.
>
> It is surely a bug that the ebuild can be removed from /usr/portage/...
> whilst leaving that orphan directory in place under /var/db/.... It is
> true that there is a second copy of the ebuild under /var/db/.... but
> emerge doesn't look there for ebuilds.
No, one thing is the ebuild tree where portage can install from, another
thing is the information about an installed package.
It's possible to have a package with a different ebuild between the
portage tree and /var/db/pkg, even for the same category, package name
and version, so even in that case the distinction is important.
>> If you don't need this package and emerge -pvc shows nothing requiring
>> it, maybe you can just remove it (e.g. with emerge -avc)?
>
> I can't use emerge, because there's no ebuild for php-8.2.28-r1. It's
> looking as though I'll have to delete the directory under /var/db/... by
> hand, together with all the associated files throughout the system.
Yes, you can. Removing installed packages operates on installed packages,
not on the current ebuild tree (it'd not make sense otherwise -
among other things, how would the portage tree know exactly which files
have been installed, for example?).
Also, if you were able to execute the -pvc invocation before, you can
remove it, that's the -p/--pretend version of one of the commands that
can remove it (-c/--depclean).
> Or, maybe if I let # USE='...' emerge =dev-lang/php-8.2.30 go ahead, it
> will clear out the old directory in /var/db/... Maybe.
It will be "replaced" with one for the newly installed version. The
package probably won't be pulled anymore by @preserved-rebuild, at least
arising out of this situation, as emerge will be able to clean these old
files after removing the old version.
... but, if you don't need it installed at all, you can also just remove
8.2.28-r1.
> Is this worth a bug report, or have I misunderstood something else?
--
Nuno Silva