FreeBSD 14.3 + virtualbox-ose 7.1 kernel module anomaly

Is this another quirk of 14.3's handling of kernel modules, and how can the user get around the problem.

Code:
:> pkg search virtualbox-ose
virtualbox-ose-6.1.50_15       General-purpose full virtualizer for x86 hardware
virtualbox-ose-70-7.0.26_3     General-purpose full virtualizer for x86 hardware
virtualbox-ose-71-7.1.10_1     General-purpose full virtualizer for x86 hardware
virtualbox-ose-additions-6.1.50.1402000_2 VirtualBox additions for FreeBSD guests
virtualbox-ose-additions-legacy-5.2.44.1402000_8 VirtualBox additions for FreeBSD guests
virtualbox-ose-additions-nox11-6.1.50.1402000_1 VirtualBox additions for FreeBSD guests
virtualbox-ose-additions-nox11-legacy-5.2.44.1402000_7 VirtualBox additions for FreeBSD guests
virtualbox-ose-kmod-6.1.50.1402000_1 VirtualBox kernel module for FreeBSD
virtualbox-ose-kmod-70-7.0.26.1402000 VirtualBox kernel module for FreeBSD
virtualbox-ose-kmod-71-7.1.10.1402000 VirtualBox kernel module for FreeBSD
virtualbox-ose-kmod-legacy-5.2.44.1402000_7 VirtualBox kernel module for FreeBSD
virtualbox-ose-legacy-5.2.44_32 General-purpose full virtualizer for x86 hardware
virtualbox-ose-nox11-6.1.50_15 General-purpose full virtualizer for x86 hardware
virtualbox-ose-nox11-70-7.0.26_3 General-purpose full virtualizer for x86 hardware
virtualbox-ose-nox11-71-7.1.10_1 General-purpose full virtualizer for x86 hardware
virtualbox-ose-nox11-legacy-5.2.44_32 General-purpose full virtualizer for x86 hardware
virtualbox-ose-kmod-6.1.50.1403000_1 VirtualBox kernel module for FreeBSD
virtualbox-ose-kmod-70-7.0.26.1403000 VirtualBox kernel module for FreeBSD
virtualbox-ose-kmod-71-7.1.8.1403000 VirtualBox kernel module for FreeBSD
virtualbox-ose-kmod-legacy-5.2.44.1403000_7 VirtualBox kernel module for FreeBSD

Goal is to install virtualbox-ose-71-7.1.10_1 and pkg search shows virtualbox-ose-kmod-71-7.1.8.1403000 compiled against the 14.3 kernel. My expectation was that that is the kernel module that would be installed. Which has generally worked well in the past with earlier versions as long as it was compiled against the corresponding kernel.

But no..

PHP:
Packages installed:

virtualbox-ose-71: 7.1.10_1
virtualbox-ose-kmod-71: 7.1.10.1402000

So pkg installed the kernel module matching the package version number and not the module matching the 14.3 kernel.

==> 7.1.10.1402000 is greater than 7.1.8.140300 right?

Uninstall just the kernel module

Code:
> doas pkg remove virtualbox-ose-kmod-71-7.1.10.1402000
Password:
Checking integrity... done (0 conflicting)
Deinstallation has been requested for the following 2 packages (of 0 packages in the universe):

Installed packages to be REMOVED:
    virtualbox-ose-71: 7.1.10_1
    virtualbox-ose-kmod-71: 7.1.10.1402000

Number of packages to be removed: 2

The operation will free 195 MiB.

Proceed with deinstalling packages? [y/N]:

Logical I guess removed the dependent package .

Is there a way around this problem..?
 
Assuming you haven't deleted it yet. What happens if you force a reinstall; pkg install -f virtualbox-ose-kmod-71
 
I would not worry about minor version differences for the pre-compiled packages for VirtualBox. Just install the stuff, make sure that kernel modules are loaded at boot (there should be something in pkg-message to that effect), and try launching VirtualBox and see if it works.

Edit: Had to cross out that part of the post. Turns out that even minor versions do matter, an exact match is the difference between the whole thing working or not. Figuring out why - that is left as an exercise for the reader of this thread.

Personally, I'd recommend going with ports, and compiling it all from scratch, if possible.

But yeah, don't uninstall the kmods, they are dependencies that you do need if you want VirtualBox to run.
 
Last edited:
Assuming you haven't deleted it yet. What happens if you force a reinstall; pkg install -f virtualbox-ose-kmod-71
Code:
> doas pkg install -f virtualbox-ose-kmod-71-7.1.8.1403000
Password:
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
All repositories are up to date.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be DOWNGRADED:
    virtualbox-ose-kmod-71: 7.1.10.1402000 -> 7.1.8.1403000 [FreeBSD-kmods]

Number of packages to be downgraded: 1

157 KiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching virtualbox-ose-kmod-71-7.1.8.1403000.pkg: 100%  157 KiB 161.1kB/s    00:01   
Checking integrity... done (0 conflicting)
[1/1] Downgrading virtualbox-ose-kmod-71 from 7.1.10.1402000 to 7.1.8.1403000...
[1/1] Extracting virtualbox-ose-kmod-71-7.1.8.1403000: 100%

Seems to work

Code:
> doas kldload vboxdrv

Code:
> cat dmesg

snip..

vboxdrv: XXXXXXXXXXXXXXXX VMMR0.r0
vboxdrv: XXXXXXXXXXXXXXXX VBoxDDR0.r0
vboxdrv: XXXXXXXXXXXXXXXX VMMR0.r0
vboxdrv: XXXXXXXXXXXXXXXX VBoxDDR0.r0
vboxdrv: XXXXXXXXXXXXXXXX VMMR0.r0
vboxdrv: XXXXXXXXXXXXXXXX VBoxDDR0.r0
 
Just install the stuff, make sure that kernel modules are loaded at boot
Kernel module doesn't load at boot because of mismatch

Code:
> cat dmesg

snip..

KLD vboxdrv.ko: depends on kernel - not available or version mismatch

SirDice 's solution forced <downgrade> of kernel module appears to work, off to test and find out ..
 
After a system reboot Virtualbox 7.1 loads and runs a test machine without fault ..

Thank you SirDice

(Reluctant to mark this thread SOLVED as clearly pkg-kmods has issues with package naming and kernel miss matches like this one described above)
 
==> 7.1.10.1402000 is greater than 7.1.8.140300 right?
Oh, I suddenly realized what might be happening here. Your 'FreeBSD' repository is set to 'latest' while the 'FreeBSD-kmods' repository is set to quarterly. That's why the actual version of the port itself doesn't match (7.1.10 in 'latest' and 7.1.8 in quarterly).

The upgrade to 14.3 added a new repository to /etc/pkg/FreeBSD.conf, and on RELEASE version the repositories default to quarterly. If you added /usr/local/etc/pkg/FreeBSD.conf to switch the 'FreeBSD' repository to latest the 'FreeBSD-kmods' repository would still be set at its default. To fix this properly you should also switch the 'FreeBSD-kmods' repository to latest.

(It was so bloody hot yesterday, my brain just stopped working)
 
Kernel module doesn't load at boot because of mismatch
Yeah, that is a problem... I didn't realize that kernel modules for VirtualBox got moved to FreeBSD-kmods repo. I thought those would stay together in the regular pkg repo, and be part of the same packge and live on the same pkg-plist.

This is why I stick with ports - the compilation instructions (a.k.a. Makefiles) take care of everything straight on the machine, no need to specify a separate kmods repo...
 
Your 'FreeBSD' repository is set to 'latest' while the 'FreeBSD-kmods' repository is set to quarterly.
Appears not to be the case ..


> pkg -vv | sed -n '/^Repositories:/,$ p'

Code:
Repositories:
  FreeBSD: { 
    url             : "pkg+http://pkg.freebsd.org/FreeBSD:14:amd64/latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  FreeBSD-kmods: { 
    url             : "pkg+https://pkg.freebsd.org/FreeBSD:14:amd64/kmods_latest_3",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }

/etc/pkg/FreeBSD.conf

Code:
FreeBSD: {
# url: "pkg+[URL]https://pkg.freebsd.org/$[/URL]{ABI}/quarterly",
  url: "pkg+[URL]https://pkg.freebsd.org/$[/URL]{ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
FreeBSD-kmods: {
# url: "pkg+[URL]https://pkg.freebsd.org/$[/URL]{ABI}/kmods_quarterly_${VERSION_MINOR}",
  url: "pkg+[URL]https://pkg.freebsd.org/$[/URL]{ABI}/kmods_latest_${VERSION_MINOR}",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}


/usr/local/etc/pkg/repos/FreeBSD.conf


Code:
FreeBSD: { url: "pkg+http://pkg.freebsd.org/${ABI}/latest" }


Is the anomaly in that final FreeBSD.conf config file and it should include a reference to FreeBSD-kmods??
 
It works as is, but it's better to include the change quarterly -> latest in one or several files in /usr/local/etc/pkg/repos/.

If you leave this, you may have a "conflict" to solve manually during the next FreeBSD upgrade because you altered a base config file.
 
It works as is, but it's better to include the change quarterly -> latest in one or several files in /usr/local/etc/pkg/repos/.
According to man pkg.conf(5)

Repository configuration files are searched for in order of the directories listed in the REPOS_DIR array, which defaults to
/etc/pkg and /usr/local/etc/pkg/repos/.


So pkg *should* find the correct FreeBSD.conf file in /etc/pkg which includes (on this machine, edited to include latest repo) both repositories, which I think is reflected in the fact that pkg -vv reports both FreeBSD & FreeBSD-kmods correctly.

Not clear to me why /usr/local/etc/pkg/repos/FreeBSD.conf should then modify that configuration. Yes, probably(?) it should include the kmods repo as well, but I don't think that's the issue.

Seems more basic in that pkg 2.2.1 picks kernel modules based on matching the package name, and once a matching kmod is found then ignores the rest of the name string which includes the kernel version the module was built against. Maybe this is a one off during the period that Virtualbox 7.1.10 doesn't have a corresponding kernel module for 14.3-Release kernels 🤷‍♂️
 
As /usr/local/etc/pkg/repos/ is the last searched, you can override whatever variable you want. I use the following and /etc/pkg/FreeBSD.conf is untouched:

$ cat /usr/local/etc/pkg/repos/latest.conf
FreeBSD: {
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}
FreeBSD-kmods: {
url: "pkg+https://pkg.FreeBSD.org/${ABI}/kmods_latest_${VERSION_MINOR}"
}


And yes, there is a duplicate:

$ pkg search -Q repository virtualbox-ose-kmod-71
virtualbox-ose-kmod-71-7.1.10.1402000
Repository : FreeBSD [pkg+http://pkg.FreeBSD.org/FreeBSD:14:amd64/latest]
Comment : VirtualBox kernel module for FreeBSD
virtualbox-ose-kmod-71-7.1.8.1403000
Repository : FreeBSD-kmods [pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/kmods_
latest_3]
Comment : VirtualBox kernel module for FreeBSD
 
Man, pkg is just too messy...
Have to agree with you on that

It's somewhat ironic that the VM I test booted following the advice to force <downgrade> the kernel module was an Arch Linux machine which hadn't been booted for nearly 2 years, yet pacman's tools give you options when faced with package conflicts (once the arch-keyring file had been updated). 20 minutes later resulting into a fully updated with latest mainline kernel etc..

Even better was a Opensuse Tumbleweed container running on that Arch VM. Zypper has even better and more granular control when faced with package conflicts. Didn't miss a trick and resulted in a fully operational container with all the userland tools bang up to date..
 
I don't know if Arch is better or not and that's not the point. People here try to help you concerning FreeBSD and your specific question, that's all.

There is a good reason why you have this kernel module (and probably anothers) present both in FreeBSD and FreeBSD-kmods repositories. And why it's not the same version is a matter of circonstances. Furthermore, as you saw, there is no problem to downgrade this package.

You're free to compile yourself the said module, that's an other way, the historic one, to install softwares with FreeBSD.
 
Is there a way around this problem..?
Not at this moment, the 14.3-RELEASE match you are searching for, probably:
virtualbox-ose-kmod-71 7.1.10.1403000

just hasn't landed in the FreeBSD-kmods repository for 14.3-RELEASE Latest. The new quarter has just begun and I think you'll have to wait a bit; or build virtualbox-ose-kmod-71-7.1.10 yourself:
Rich (BB code):
[0-0] # pkg -v; date -u
2.2.1
Thu Jul  3 07:55:26 UTC 2025
[1-0] # pkg -vv | sed -n '/^Repositories:/,$ p'
Repositories:
  FreeBSD: {
    url             : "pkg+https://pkg.freebsd.org/FreeBSD:14:amd64/latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  FreeBSD-kmods: {
    url             : "pkg+https://pkg.freebsd.org/FreeBSD:14:amd64/kmods_latest_3",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
[2-0] # pkg rquery -x '[%R] %n %v' 'virtualbox-ose(-kmod)?(-71)?'| column -t
[FreeBSD]        virtualbox-ose                         6.1.50_16
[FreeBSD]        virtualbox-ose-70                      7.0.26_4
[FreeBSD]        virtualbox-ose-71                      7.1.10_2      <- v. 71-7.1.10_2 - non-kmod; for 14.2 and 14.3 
[FreeBSD]        virtualbox-ose-additions               6.1.50.1402000_2
[FreeBSD]        virtualbox-ose-additions-legacy        5.2.44.1402000_8
[FreeBSD]        virtualbox-ose-additions-nox11         6.1.50.1402000_1
[FreeBSD]        virtualbox-ose-additions-nox11-legacy  5.2.44.1402000_7
[FreeBSD]        virtualbox-ose-kmod                    6.1.50.1402000_1
[FreeBSD]        virtualbox-ose-kmod-70                 7.0.26.1402000
[FreeBSD]        virtualbox-ose-kmod-71                 7.1.10.1402000      <-71-7.1.10.1402000 - kmod; for 14.2
[FreeBSD]        virtualbox-ose-kmod-legacy             5.2.44.1402000_7
[FreeBSD]        virtualbox-ose-legacy                  5.2.44_33
[FreeBSD]        virtualbox-ose-nox11                   6.1.50_16
[FreeBSD]        virtualbox-ose-nox11-70                7.0.26_4
[FreeBSD]        virtualbox-ose-nox11-71                7.1.10_2
[FreeBSD]        virtualbox-ose-nox11-legacy            5.2.44_33
[FreeBSD-kmods]  virtualbox-ose-kmod                    6.1.50.1403000_1
[FreeBSD-kmods]  virtualbox-ose-kmod-70                 7.0.26.1403000
[FreeBSD-kmods]  virtualbox-ose-kmod-71                 7.1.8.1403000      <-71-7.1.8 - kmod; for 14.3 *no-match*
[FreeBSD-kmods]  virtualbox-ose-kmod-legacy             5.2.44.1403000_7
[3-0] #
 
I don't know if Arch is better or not and that's not the point.
It wasn't my point either... The irony probably flew straight over your head. Arch is notorious for being <challenging> if it's not upgraded/updated on a regular basis. (yes, it's a rolling release so somewhat expected) The Arch VM I booted once I had downgraded the vbox kmod had not been booted for two years but was successfully updated in a matter of minutes, due to the power of pacman and it's package resolver.

On the other hand FreeBSD is generally very stable and slow moving but fell over on what appears to be a simple file naming issue for a kernel module required to run Virtualbox 7.1. on Release 14.3 leaving the software unusable. For a new user that would leave a sour taste in the mouth..

People here try to help you concerning FreeBSD and your specific question, that's all.
Down grading the module hadn't crossed my mind yet it's something I've done in the past. So no complaints from me and I'm grateful to SirDice for the idea... And as he said it's been very very hot here the last few days in Northern Europe which frazzled my brain..

There is a good reason why you have this kernel module (and probably anothers) present both in FreeBSD and FreeBSD-kmods repositories. And why it's not the same version is a matter of circonstances.
True, but the simple fact is that the new pkg-kmods <system> for 14.3 falls over at a relatively simple challenge. No doubt if the kmod and the package had identical names there would not have been any issues neither would it have highlighted the problem.. The fact is pkg picked the kernel module based on a simple string search of the module name and not on anything more substantial like checking what version of the kernel was running and then only offering kernel modules compatible with that version, n'est pas?
 
Not at this moment, the 14.3-RELEASE match you are searching for, probably:
virtualbox-ose-kmod-71 7.1.10.1403000
Indeed, but virtualbox works (and has done for previous releases) with earlier versions <as long as its built against the running kernel>
just hasn't landed in the FreeBSD-kmods repository for 14.3-RELEASE Latest. The new quarter has just begun and I think you'll have to wait a bit; or build virtualbox-ose-kmod-71-7.1.10 yourself:
virtualbox-ose-kmod-71-7.1.8.1403000 is working just fine, so I'll continue to test and if/when a matching versions appears the system will be updated. But so far everything works as it did on 14.2-Release ..
 
True, but the simple fact is that the new pkg-kmods <system> for 14.3 falls over at a relatively simple challenge.
"pkg-kmods" means nothing. I wonder if you see what it is... Anyway, it's a new feature that came to life during the 14.2-RELEASE era and just arrived in the default settings with 14.3-RELEASE. So, it needs some times to be mature. And yes, a check of the FreeBSD version of the module should be made. I think bapt@ will do something about this. Note that you can also open your eyes and see there is a rather evident suffix to the name of the pkg.

It's a good improvement compared to times before. Because, then you had no other choice but to compile the module yourself or wait until the repos get compiled on the RELEASE you just installed/upgraded.

That said, I ain't sure it worth something to continue this discussion.
 
"pkg-kmods" means nothing. The right term is the FreeBSD-kmods repository. I wonder if you see what it is...

N'importe quoi..!

Please read back the thread from the beginning and understand I <know what the right term is>. Pretty confident that nobody reading this thread doesn't understand what that shorthand means either..

Looking forward to seeing further improvements in kernel module handling in future releases
 
As if by magic ..

Rich (BB code):
> doas pkg upgrade
Password:
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-kmods repository catalogue...
FreeBSD-kmods repository is up to date.
All repositories are up to date.
Checking for upgrades (6 candidates): 100%
Processing candidates (6 candidates): 100%
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
    drm-61-kmod: 6.1.128.1403000_4 -> 6.1.128.1403000_5 [FreeBSD-kmods]
    virtualbox-ose-kmod-71: 7.1.8.1403000 -> 7.1.10.1403000 [FreeBSD-kmods]

Number of packages to be upgraded: 2

4 MiB to be downloaded.

Proceed with this action? [y/N]:
 
mountain out of a mole hill.

==> 7.1.10.1402000 is greater than 7.1.8.140300 right?

1402 means FreeBSD 14.2. Read the message in the console after installation!! designed for FreeBSD 14.2
for FreeBSD 14.3, you can ony use virtualbox-ose-kmod-71-7.1.8.1403000

virtualbox-ose-kmod-71-7.1.10.1402000
virtualbox-ose-kmod-71-7.1.8.1403000

so simply type pkg install virtualbox-ose-kmod-71-7.1.8.1403000
or use a copy-paste enabled terminator, such as Sakura to copy-paste the package name.
easy. I've already installed this package in 14.3 and it works (somewhat).

man, is this a long thread where logic and common sense would avoid the entire theme.
I cannot stress enough that i have installed VirtualBox in FreeBSD 14.3 and i had no problems.
I can read and the console message output is quite clear.
 

Attachments

  • vbox1.jpg
    vbox1.jpg
    69.5 KB · Views: 36
  • vbox2.jpg
    vbox2.jpg
    66.2 KB · Views: 35
mountain out of a mole hill.
If it were, the VM would have booted no problem for OP. One of those times when kernel module does have to match exactly. Yeah, a small detail, all right, but one that does make a difference in the whole thing either working or not at all.


That's about as crazy as a node.js module, when un-published over an off-line spat, breaks half the Internet. Small detail, but plenty important. And the tech world is full of cautionary tales like that.
 
so simply type pkg install virtualbox-ose-kmod-71-7.1.8.1403000
See post #4.

In fact the problem was solved before even posting by simply renaming the the correct kernel module to match the package name, and what I was searching for was a clean way that wouldn't fall over at the first pkg update

SirDice provided the perfect solution

man, is this a long thread where logic and common sense would avoid the entire theme.
Reading threads & understanding the content doesn't appear to be a strong point amongst the posters on this thread.....

Once again, the issue is that <pkg> in it's current form picks the wrong kernel module based on matching the name of the module against the package. In this case virtualbox-ose-kmod-71-7.1.10 matches the package name before the kernel version that it is built against 402000

So virtualbox-ose-kmod-71-7.1.8.1403000 was ignored, which was the correct module to pick...

If it were, the VM would have booted no problem for OP. One of those times when kernel module does have to match exactly. Yeah, a small detail, all right, but one that does make a difference in the whole thing either working or not at all.
Exactly, bravo!
 
Back
Top