Solved Nvidia broken after pkg upgrade (depends on kernel - not available or version mismatch)

Hey.

A random "pkg uprade" bumped nvidia drivers and now:

Code:
doas dmesg | grep nvidia
KLD nvidia-modeset.ko: depends on kernel - not available or version mismatch
KLD nvidia-drm.ko: depends on drmn - not available or version mismatch

----

I'm running

Code:
uname -a
FreeBSD voyager.local 14.3-RELEASE-p4 FreeBSD 14.3-RELEASE-p4 releng/14.3-n271447-7f1785f09fb2 GENERIC amd64

and

Code:
 pkg info | grep nvidia
nvidia-driver-580.95.05        NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-drm-61-kmod-580.95.05.1403000 NVIDIA DRM Kernel Module
nvidia-drm-kmod-580.95.05      NVIDIA DRM Kernel Module
nvidia-kmod-580.95.05.1403506  kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-xconfig-580.95.05       Tool to manipulate X configuration files for the NVidia driver

----

other than that my pkg config:

Code:
cat /etc/pkg/FreeBSD.conf
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

FreeBSD: {
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
FreeBSD-kmods: {
  mirror_type: "srv",
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/kmods_latest",
  #url: "pkg+https://pkg.FreeBSD.org/${ABI}/kmods_latest_${VERSION_MINOR}",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

I'm running pkgbase:

Code:
 cat /usr/local/etc/pkg/repos/FreeBSD-base.conf
FreeBSD-base: {
# I changes urls trying to fix nvidia.
 # url: "pkg+https://pkg.FreeBSD.org/${ABI}/base_release_3",
  url: "pkg+https://pkg.FreeBSD.org/${ABI}/base_latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

and my rc.conf:

Code:
cat /etc/rc.conf | grep kld
kld_list="nvidia-modeset coretemp ums"
 
Code:
pkg -vv | sed -nE -e '/OSVERSION|ABI/ p' -e '/^Repositories:/,$ p'

IGNORE_OSVERSION = false;
ABI = "FreeBSD:14:amd64";
ALTABI = "freebsd:14:x86:64";
OSVERSION = "1403000";
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",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  FreeBSD-base: {
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/base_latest",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
 
Code:
 pkg info | grep nvidia
nvidia-driver-580.95.05        NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-drm-61-kmod-580.95.05.1403000 NVIDIA DRM Kernel Module
nvidia-drm-kmod-580.95.05      NVIDIA DRM Kernel Module
nvidia-kmod-580.95.05.1403506  kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-xconfig-580.95.05       Tool to manipulate X configuration files for the NVidia driver

Why do you have the native driver *and* the linux/drm variant installed?

Usually for nvidia only the native driver x11/nvidia-driver is required. No need to fiddle around with drm, which AFAIK is only required for cuda (which IIRC doesn't fully work anyways even with linux-drm/kmod) and/or wayland (which breaks a lot of other things)

Regardless which way you go - the kernel module always has to match the kernel version, so you have to either re-install the pkg or re-build the port after upgrading the kernel to a new version (patch versions are usually unaffected, only minor/major release updates).
 
I have no idea to be frank, but it was working till yesterday (the reboot day).

I don't use ports. Everything here is from pkg? Anyway, trying to
Code:
pkg upgrade -f
 
I don't have much experience in running pkgbase on 14.3-RELEASE.

However, Packaging FreeBSD base states:
Rich (BB code):
BranchFrequencyURLkmods
maintwice daily – 12:00 and 00:00 UTChttps://pkg.freebsd.org/${ABI}/base_latesthttps://pkg.freebsd.org/${ABI}/kmods_latest
[...]
releng/14.3 twice daily – 12:00 and 00:00 UTChttps://pkg.freebsd.org/${ABI}/base_release_3https://pkg.freebsd.org/${ABI}/kmods_latest_3

Code:
Code:
uname -a
FreeBSD voyager.local 14.3-RELEASE-p4 FreeBSD 14.3-RELEASE-p4 releng/14.3-n271447-7f1785f09fb2 GENERIC amd64
Code:
pkg -vv | sed -nE -e '/OSVERSION|ABI/ p' -e '/^Repositories:/,$ p' 
IGNORE_OSVERSION = false; 
ABI = "FreeBSD:14:amd64"; 
ALTABI = "freebsd:14:x86:64"; 
OSVERSION = "1403000";
   [...]
These two quotes from your messages show that you are running 14.3-RELEASE, that is using the releng/14.3 branch. Given the active settings as shown by your output of pkg -vv [...] you have not set them accordingly. I suggest you change them as shown in the last row of the quoted table; then you have the correct settings.

Recent Nvidia driver(s) port settings have seen major changes. I don't have an active Nvidia card at the moment. As I understand it dependencies have changed and with the fully native Nvidia (fully proprietary driver) you'll also get the accompanying opensource nvidia-drm-x-kmod driver. This has just started as of 2025Q4. You probably should look for more detailed comments in recent forum messages about that, or wait for more detailed comments, likely coming from T-Aoki.
 
  • Thanks
Reactions: mer
I had a similar problem with 15.0-BETA1 and my Nvidia card. The problem was that the driver and module were changed from version 580.82.07 to 580.95.05 which isn't supported by my xorg installation.

The solution for me (in BETA1) was to disable the FreeBSD-ports-kmods repository and then do pkg upgrade -f -r FreeBSD-kmods. This reverted the version change and restored the window environment.

I don't know if this is the right solution for 14.3-RELEASE as that was broken by the upgrade too and I haven't tried reinstalling it yet. Don't trust my advice though because I don't really fully understand repository configuration or the development process.

For what it's worth, here are my current settings on 15.0-BETA1:
Code:
~ $ pkg -vv | sed -nE -e '/(OSVERSION|ABI)/ p' -e '/^Repositories:/,$ p'
IGNORE_OSVERSION = false;
ABI = "FreeBSD:15:amd64";
ALTABI = "freebsd:15:x86:64";
OSVERSION = "1500067";
Repositories:
  FreeBSD-ports: {
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/quarterly",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  FreeBSD-base: {
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:15:amd64/base_release_0",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
~ $ pkg info nvidia*
nvidia-driver-580.82.07_1
nvidia-kmod-580.82.07.1500066
~ $ uname -KrU
15.0-BETA1 1500067 1500067
~ $

Update: Maybe it should be base_release_3 in your case. :-/
 
To be honest, I don't understand what's going on on official pkg builders for both regular ones and kmod ones. But as at least the combination with
builds on ports-mgmt/poudriere-devel, installs and runs fine for stable/14 and stable/15 for me. And currently both master ports and -devel variants points to 580.95.05, as no newer New Feature Branch of drivers are released upstream.

Thus, cannot understand what's the problem on builders.
kmod builder seem to pick x11/nvidia-kmod but not others for at least 15.0.
And regular pkg builder does not yet pick 580.95.05.

Code:
# pkg search -r FreeBSD-ports-kmods nvidia
nvidia-kmod-580.95.05.1500500  kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
# pkg search -r FreeBSD-ports nvidia
libva-nvidia-driver-0.0.14_2   NVDEC-based backend for VAAPI
linux-nvidia-libs-580.82.07    NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-304-304.137  NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-340-340.108  NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-390-390.157  NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-470-470.256.02 NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-devel-580.82.07 NVidia graphics libraries and programs (Linux version)
nvidia-driver-580.82.07_1      NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-304-304.137_11   NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-340-340.108_5    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-390-390.157_1    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-470-470.256.02_2 NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-devel-580.82.07_1 NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-drm-61-kmod-580.82.07.1500066_5 NVIDIA DRM Kernel Module
nvidia-drm-61-kmod-devel-580.82.07.1500066_5 NVIDIA DRM Kernel Module
nvidia-drm-66-kmod-580.82.07.1500066_5 NVIDIA DRM Kernel Module
nvidia-drm-66-kmod-devel-580.82.07.1500066_5 NVIDIA DRM Kernel Module
nvidia-drm-kmod-580.82.07_1    NVIDIA DRM Kernel Module
nvidia-drm-kmod-devel-580.82.07_1 NVIDIA DRM Kernel Module
nvidia-kmod-580.82.07.1500066  kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-kmod-304-304.137.1500066 kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-kmod-340-340.108.1500066 kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-kmod-390-390.157.1500066 kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-kmod-470-470.256.02.1500066 kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-kmod-devel-580.82.07.1500066 kmod part of NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-settings-580.82.07      Display Control Panel for X NVidia driver
nvidia-texture-tools-2.1.2     Texture Tools with support for DirectX 10 texture formats
nvidia-xconfig-580.82.07       Tool to manipulate X configuration files for the NVidia driver
nvidia_gpu_prometheus_exporter-g20181028_31 NVIDIA GPU Prometheus exporter

And in freebsd-pkg-fallout ML archive for this October, I cannot find any fallouts for 580.95.05. So builds somehow not yet started.

Note that, as I've been testing 580.95.05 through before and after upgrading from stable/14 to stable/15, both could be tested (unintentionally).

The workaround now for pkg users would be to deinstall x11/nvidia-kmod and run pkg upgrade -r FreeBSD (for any of 15.0 and main [aka -Current], pkg upgrade -r FreeBSD-ports) again.
 
because the last bulk job for 15 ran on 9.10.2025 and the update to version 580.95.05 got committed on 10.10.2025.
Packages for all supported releases are already on 580.95.05
Ah, thanks!
Looking into FreshPorts again, found most ones except some of variants (especially -devel variants which are not built for everything nvidia-related) are at 580.95.05 except 15.0 (both latest and quarterly).

And anyone using non-legacy versions of drivers are encouraged to upgrade to 580.95.05, as it includes security fix (what's listed for Unix'ish OS'es are only Linux, but as most of codes are shared between Linux and other Unix'ish OS'es including FreeBSD), and FreeBSD can be affected.
Legacy versions are not entitled to be vulnerable, as oldest listed branch is 535.

So time would help for 15.0. But if I understand correctly, FreshPorts does not pick kmod repo.
 
1. I tried with changing repos:

Code:
pkg -vv | sed -nE -e '/(OSVERSION|ABI)/ p' -e '/^Repositories:/,$ p'
IGNORE_OSVERSION = false;
ABI = "FreeBSD:14:amd64";
ALTABI = "freebsd:14:x86:64";
OSVERSION = "1403000";
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"
  }
  FreeBSD-base: {
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/base_release_3",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }

after updating all packages - still no working nvidia

(I did got the "transaction within transaction" error though -> https://github.com/freebsd/pkg/issues/2522.
I got it when running with '-f', and then passed when I re-run pkg update without "-f")

2. I disabled FreeBSD-kmods repo:
Code:
pkg -vv | sed -nE -e '/(OSVERSION|ABI)/ p' -e '/^Repositories:/,$ p'

IGNORE_OSVERSION = false;
ABI = "FreeBSD:14:amd64";
ALTABI = "freebsd:14:x86:64";
OSVERSION = "1403000";
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         : no,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }
  FreeBSD-base: {
    url             : "pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/base_release_3",
    enabled         : yes,
    priority        : 0,
    mirror_type     : "SRV",
    signature_type  : "FINGERPRINTS",
    fingerprints    : "/usr/share/keys/pkg"
  }

and got the transaction error, but this time I can not finish it?

Code:
....
[987/2506] Deleting files for gegl-0.4.64: 100%
[988/2506] Reinstalling libnsgif-1.0.0...
pkg: sqlite error while executing BEGIN IMMEDIATE TRANSACTION  in file pkgdb.c:1206: cannot start a transaction within a transaction
13:18:56 voyager ~ > doas pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating FreeBSD-base repository catalogue...
FreeBSD-base repository is up to date.
All repositories are up to date.
Checking for upgrades (121 candidates): 100%
Processing candidates (121 candidates): 100%
Checking integrity... done (0 conflicting)
Your packages are up to date.
 
ok, I
Code:
pkg upgrade -f -r FreeBSD-kmods
with disabled kmods repo. This time no transaction error.

Nvidia now works just fine. Thanks!

conclusion:

what has helped me:
1. Disable kmods repo in /etc/pkg/FreeBSD.comf
2. pkg upgrade -f -r FreeBSD-kmods
3. reboot (maybe not needed?)
 
ok, I
Code:
pkg upgrade -f -r FreeBSD-kmods
with disabled kmods repo. This time no transaction error.

Nvidia now works just fine. Thanks!

conclusion:

what has helped me:
1. Disable kmods repo in /etc/pkg/FreeBSD.comf
2. pkg upgrade -f -r FreeBSD-kmods
3. reboot (maybe not needed?)
Good! The reboot was not needed, a kldload of the modules would have worked just fine.
 
what has helped me:
1. Disable kmods repo in /etc/pkg/FreeBSD.comf
2. pkg upgrade -f -r FreeBSD-kmods
3. reboot (maybe not needed?)
You should/need not have disabled the FreeBSD-kmods repository: you need and will be needing packages from that repository.
In exceptional circumstances you may need to use -f when using pkg-upgrade(8); one example of this is when having done a major version update of your FreeBSD OS.

Using # pkg upgrade -r FreeBSD-kmods does two things:
  1. enables the FreeBSD-kmods repository when you have it disabled in your settings
  2. limits any upgrades of your installed packages (it does not matter from what repository they were installed) to packages in the remote FreeBSD-kmods repository

pkg-upgrade(8):
Code:
   -r reponame, --repository reponame
	   Install  packages from only the named repository, irrespec-
	   tive	of the configured "enabled" status from	repo.conf.

For upgrading of packages using 14.3-RELEASE in a pkgbasified environment I recommend using:
pkg upgrade -r FreeBSD-base
pkg upgrade -r FreeBSD
pkg upgrade -r FreeBSD-kmods
 
Good! The reboot was not needed, a kldload of the modules would have worked just fine.
Don't attempt to kldunload GPU related kmods (not limited with nvidia related ones) while Xorg or Wayland session is running!
Maybe trying before starting / after quitting Xorg / Wayland would be fine, though. But if I recall correctly, at least at past, unloading kmods from graphics/drm-*-kmod caused panic.
 
  • Like
Reactions: mer
Don't attempt to kldunload GPU related kmods (not limited with nvidia related ones) while Xorg or Wayland session is running!
Maybe trying before starting / after quitting Xorg / Wayland would be fine, though. But if I recall correctly, at least at past, unloading kmods from graphics/drm-*-kmod caused panic.
The module was not loaded, that's the very point of this thread...
 
Two days ago, there was an Nvidia update. I dealt with it in my usual manner, after upgrading, got out of X and then tried to startx with no luck. So, I did a gitup on ports, and then did portmaster install nvidia-drm-kmod. That fixed everything as usual. Then yesterday pkg upgrade did another update on one of the nvidia kmods. I did it, got of X and ran startx and all was fine. To be sure nothing had been messed up, I did a full reboot, and again no issues. I also have the linux-nvidia libs, so I thought the new upgrade would be an issue, but this time, at least, it wasn't.
 
Back
Top