In this example, the VirtualBox kernel module 6.1.36_1 for VirtualBox 6.1.36_1 on FreeBSD 13.2 is installed from ports to a fix version mismatch.
Finding the cause of the problem.
Research on command line reveals, that the kernel module for VirtualBox can not be loaded, because of a version mismatch. This happens, even though the FreeBSD and its applications is fully updated. The cause of the problem is, that there is a difference from the required version of the kernel module between the one in the pkg package repository and the ports.
# kldload vboxdrv kldload: an error occurred while loading module vboxdrv. Please check dmesg(8) for more details. # dmesg pid 1682 (VirtualBoxVM), jid 0, uid 1001: exited on signal 6 KLD vboxdrv.ko: depends on kernel - not available or version mismatch linker_load_file: /boot/modules/vboxdrv.ko - unsupported file type KLD vboxdrv.ko: depends on kernel - not available or version mismatch linker_load_file: /boot/modules/vboxdrv.ko - unsupported file type KLD vboxdrv.ko: depends on kernel - not available or version mismatch linker_load_file: /boot/modules/vboxdrv.ko - unsupported file type # pkg version | grep virtualbox virtualbox-ose-6.1.36_1 < virtualbox-ose-kmod-6.1.36 <
Installing VirtualBox kernel module from ports.
Remove the kernel module, that was installed from pkg package repository, but make sure, that dependencies are not removed as well. Confirm, that the ports tree is updated. Install the kernel module from ports, while making sure, that dependencies are installed from packages. This is important in this operation, because dependencies, such as the GNU Compiler Collection (GCC) might be installed as well. GCC is a massive port, that not only takes hours to compile, but also consumes all CPU cores.
# pkg remove -f virtualbox-ose-kmod Installed packages to be REMOVED: virtualbox-ose-kmod: 6.1.36 Number of packages to be removed: 1 # portsnap auto # cd /usr/ports/emulators/virtualbox-ose-kmod # env USE_PACKAGE_DEPENDS=1 make install ===> Installing for virtualbox-ose-kmod-6.1.36_1 ===> Checking if virtualbox-ose-kmod is already installed ===> Registering installation for virtualbox-ose-kmod-6.1.36_1 Installing virtualbox-ose-kmod-6.1.36_1... # kldload vboxdrv