Re: kmod ports and conflicts when upgrading

From: Baptiste Daroussin <>
Date: Tue, 12 Sep 2023 09:42:24 UTC
On Tue, Sep 12, 2023 at 10:25:40AM +0100, David Chisnall wrote:
> Hi,
> As part of the work to run FreeBSD containers on other operating systems via Podman, I have written a device driver for the QEMU firmware config interface.  I am currently building this via an overlay port, but aim to upstream it into -CURRENT soonish.  In parallel, I’d like to add a port for it.
> Both ports and base install kernel modules in the same place and so I’m worried that someone will install the port, update FreeBSD to a version that includes the module in base, and then end up with problems when the uninstall the port (or have the upgrade fail because the file already exists).

Base installs modules in /boot/kernel, ports insyall them in /boot/modules so
you don't have the problem.

> I’m sure this problem must have been solved for other things that have migrated in a similar path.  Is there a way to automatically uninstall a port when doing a major version upgrade or when a base-system thing tries to write to the same location (or, at least, ensure that it is not removed when the package is removed later)?

no there is no mecanism for that except if you use pkgbase, in this case if you
have a conflict aka a file installed in the same location (which is not the case
for kernel modules from ports) then it will propose you to remove the
conflicting package.