freebsd / pkg

Package management tool for FreeBSD. Help at #pkg on Libera Chat or pkg@FreeBSD.org
Other
740 stars 277 forks source link

pkg upgrade + reverse dep package deletion due to dep change + solver error #1457

Open fichtner opened 8 years ago

fichtner commented 8 years ago

Hi,

We've seen this in OPNsense a couple of times and I think I have the means to reproduce this with a repo setup for further analysis. For now, let me explain what happens.

A library dependency changes, which forces a package reinstall for all top packages. In our case it's about OpenSSL/LibreSSL, and the top package deinstalled is not a direct dependency of said SSL library.

During upgrade pkg deinstalls the offending reverse dependencies, then goes into a solver run and decides not to upgrade due to an error and exits.

Unfortunately, this leaves a broken system with packages having been deinstalled instead of just not doing anything for the upgrade run.

My question is this: why does pkg remove reverse dependencies before it runs the resolver to figure out it can't upgrade? Can this be fixed, or is there an implementation detail I'm missing?

Thanks, Franco

fichtner commented 7 years ago

I have more info on this, this is what happens:

One package in the transition is actually a "downgrade", which is ignored when trying to resolve the conflict. Since it isn't considered for upgrade in the resolver pass, the former library gets a higher priority than the latter library, causing pkg to deinstall all reverse dependencies that it cannot upgrade cleanly due to the downgrade ignore.