I’m building new focal web servers to replace our current bionic servers, which use Varnish in front of Nginx. We’re installing Varnish 6.5 from the repo at http://varnish-cache.org, and that package now includes libvarnishapi.so.2 directly rather than relying on an external libvarnishapi2 package. However, since collectd gets installed, which causes the Ubuntu libvarnishapi2 package, which is built against Varnish 6.2, to also be installed, that is causing Varnish CLI binaries like /usr/sbin/varnishadm to use the Ubuntu package’s version out of /usr/lib/x86_64-linux-gnu/ rather than the Varnish package’s version under /usr/lib.
It turns out that I can subsequently remove the Ubuntu libvarnishapi2 package and restart collectd, causing it to use the .so file under /usr/lib, which seems to work okay with the 6.5 version of the library. However, this is a bit of a contortion and took a while to figure out. Is there a way to resolve this conflict, perhaps with a virtual package?