Solved FreeBSD 15 Nvidia issue

Hi all,

I have done a new install of FreeBSD 15 and also the Nvidia driver for my GPU.

I followed the handbook and guide to get to this point, I have done the following so far:

1. Installed Xorg, i3, Nvidia-driver, nvidia-settings
2. added 'kld_list="nvidia-modeset nvidia" to /etc/rc.conf
3. ensure bus is running
4. created a machine id

when trying to launch i3 via startx I get the following error:

(EE) NVIDIA: Failed to initialise the Nvidia kernel module.

So I don't understand why the module is not being loaded.

Any help here would be greatly appreciated, driver version of Nvidia is the 580 version.

Thanks
 
You've not at all described about your hardware, so everything below are all by uncertain predictions.

First of all, you can confirm whether nvidia-modeset.ko and nvidia.ko are loaded or not with kldstat(8).

And you need to add your local user you're logged in is needed to be a member of video group (not all X11 WMs/DEs require it, but Wayland should, and some display manager could require it, too. But I've never tried i3).

Assuming the above are OK, are you sure your GPU is supported by 580 series of drivers?

And as you're not using any of graphics/nvidia-drm-*-kmod (default for 15.0-Release is graphics/nvidia-drm-66-kmod), you need manual configuration.

If you're running on notebooks with hybrid graphics (Optimus), graphics/nvidia-drm-66-kmod should be mandatory unless you can completely disable iGPU.

Some notebooks have external monitor port (HDMI or DP, depends on the hardware design) dedicated for nvidia dGPU.

This is because x11-servers/xorg-server hesitates to auto-configure proprietary nvidia driver and only looks for x11-drivers/xf86-video-nv and nonexisitent nouveau driver for nvidia GPUs.

Follow Example 3 in Chapter 5.5.2 of the Handbook.

Note that you need x11/nvidia-kmod, too, but it should be automatically pulled in as a dependency when you installed x11/nvidia-driver.
 
Hi thanks for the response.

Yes I have the above and I know my GPU is supported by the 580 driver.

In my terminal I have just done 'kldload nvidia-modeset'

Then I ran 'startx' and it's working.

What is confusing me now is that in /etc/rc.conf I have the following line:

kld_list="nvidia-modeset nvidia"

But it's obviously not being loaded on boot.

Thanks
 
Hi thanks for the response.

Yes I have the above and I know my GPU is supported by the 580 driver.

In my terminal I have just done 'kldload nvidia-modeset'

Then I ran 'startx' and it's working.

What is confusing me now is that in /etc/rc.conf I have the following line:

kld_list="nvidia-modeset nvidia"

But it's obviously not being loaded on boot.

Thanks
So, if the kld_list line you've written is NOT actually copy&pasted from your /etc/rc.conf, are you sure there's no typo?

And if you have another (or more) kld_list line in your /etc/rc.conf AND it's actually in the same form as the line for nvidia-modeset, it would simply override any prior kld_list lines.

If it's the case, all kld_list lines other than exactly the first one should be in the form like below (assuming you have one prior to nvidia-modeset one).
Code:
kld_list="${kld_list} nvidia-modeset nvidia"

And note that nvidia.ko should be pulled in as the dependency by nvidia-modeset.ko. So
Code:
kld_list="${kld_list} nvidia-modeset"
should be sufficient here.
 
So, if the kld_list line you've written is NOT actually copy&pasted from your /etc/rc.conf, are you sure there's no typo?

And if you have another (or more) kld_list line in your /etc/rc.conf AND it's actually in the same form as the line for nvidia-modeset, it would simply override any prior kld_list lines.

If it's the case, all kld_list lines other than exactly the first one should be in the form like below (assuming you have one prior to nvidia-modeset one).
Code:
kld_list="${kld_list} nvidia-modeset nvidia"

And note that nvidia.ko should be pulled in as the dependency by nvidia-modeset.ko. So
Code:
kld_list="${kld_list} nvidia-modeset"
should be sufficient here.
Thanks I wasn't aware this was the case with kld_list, did your solution and it's worked, thanks again.
 
IMHO kld_list+="nvidia-modeset" should also work
No. As /etc/rc.conf is sourced into /etc/rc framework, which are /bin/sh shell scripts, the syntax must be in /bin/sh scripting formats only. And "+=" operator does NOT exist.

Although sysrc(8) accept this form, sysrc(8) expands it to existing kld_list variable followed by the specified ones.

For example, if you already have kld_list="smbfs" in your /etc/rc.conf and invoking sysrc kld_list+=nvidia-modeset as root, the kld_list line would become kld_list="smbfs nvidia-modeset" afterwards. This updated line is generated internally by sysrc(8) and added into /etc/rc.conf, with deletion of existed kld_list="smbfs" line.
 
Are you sure? From sh(1)

Code:
Assignment operators
    = += -= *= /= %= <<= >>= &= ^= |=
Have you actually tested?
Relevant part of the manpage belongs to "Arithmetic Expansion" part, not for string like kld_list variable.

Code:
Arithmetic Expansion
     Arithmetic expansion provides a mechanism for evaluating an arithmetic
     expression and substituting its value.  The format for arithmetic
     expansion is as follows:

           $((expression))

     The expression is treated as if it were in double-quotes, except that a
     double-quote inside the expression is not treated specially.  The shell
     expands all tokens in the expression for parameter expansion, command
     substitution, arithmetic expansion and quote removal.

     The allowed expressions are a subset of C expressions, summarized below.

           Values     All values are of type intmax_t.

           Constants  Decimal, octal (starting with 0) and hexadecimal
                      (starting with 0x) integer constants.

           Variables  Shell variables can be read and written and contain
                      integer constants.

           Unary operators
                      ! ~ + -

           Binary operators
                      * / % + - << >> < <= > >= == != & ^ | && ||

           Assignment operators
                      = += -= *= /= %= <<= >>= &= ^= |=

           Conditional operator
                      ? :

     The result of the expression is substituted in decimal.

And simplified test result is as follows.
Code:
% cat /tmp/test.sh       
#!/bin/sh
INTVAR=0
echo "Initial INTVAR=" $((INTVAR))
let INTVAR+=3
echo "INTVAR=" $((INTVAR))
STRVAR="ABC"
echo "Initial STRVER=" ${STRVAR}
STRVAR+=" CDE"
echo "SRTVAR=" ${STRVAR}
% /tmp/test.sh           
Initial INTVAR= 0
3
INTVAR= 3
Initial STRVER= ABC
/tmp/test.sh: STRVAR+= CDE: not found
SRTVAR= ABC

Another test, try abuse let command for string.
Code:
% cat /tmp/test.sh
#!/bin/sh
INTVAR=0
echo "Initial INTVAR=" $((INTVAR))
let INTVAR+=3
echo "INTVAR=" $((INTVAR))
STRVAR="ABC"
echo "Initial STRVER=" ${STRVAR}
let STRVAR+=" CDE"
echo "SRTVAR=" ${STRVAR}
% /tmp/test.sh   
Initial INTVAR= 0
3
INTVAR= 3
Initial STRVER= ABC
let: arithmetic expression: variable conversion error: "STRVAR+= CDE"
SRTVAR= ABC

And add what works for prior one.
Code:
% cat /tmp/test.sh
#!/bin/sh
INTVAR=0
echo "Initial INTVAR=" $((INTVAR))
let INTVAR+=3
echo "INTVAR=" $((INTVAR))

STRVAR="ABC"
echo "Initial STRVER=" ${STRVAR}
STRVAR+=" CDE"
echo "SRTVAR=" ${STRVAR}

STRVAR2="OPQ"
echo "Initial STRVER2=" ${STRVAR2}
STRVAR2="${STRVAR2} RST"
echo "SRTVAR2=" ${STRVAR2}
% /tmp/test.sh   
Initial INTVAR= 0
3
INTVAR= 3
Initial STRVER= ABC
/tmp/test.sh: STRVAR+= CDE: not found
SRTVAR= ABC
Initial STRVER2= OPQ
SRTVAR2= OPQ RST
 
Back
Top