Solved Nvidia kernel module (web vs pkg), and issues after upgrade

broozar

Member

Reaction score: 8
Messages: 20

Hi everyone, I was installing FreeBSD on a new system with a Nvidia GT 1030. I want to use the 440 graphics driver. As I see it, there are 2 options, a) get the pkg from the repository, or b) get the driver from the Nvidia website, compile the kernel module yourself and then run nvidia-xconfig. I have always had more luck with option b) in the past, but I wanted to try a) this time. Results:

Both a) and b) fail to load their modules automatically. I didn't have this problem with 12.0, but with the fresh 12.1 install, automatic loading fails. Of course I have nvidia_load="YES" set. kldstat shows that it has not loaded. kldload nvidia(-modeset) works without errors, but with option a) Xorg freezes immediately. Option b) does work after manually loading the kernel module.

dmesg output does not reveal anything useful named nvidia, nv or module-related.
Xorg log shows the familiar "(EE) NVIDIA(0): Failed to initialize the NVIDIA kernel module!" error. Remember that manually loading my module after login works without errors.

My questions:
1) Why does 12.1 fail to load the module automatically? This only happens on a fresh 12.1 install. My old system which was upgraded from 12.0 to 12.1 does not exhibit this issue.
2) Why does the kernel module provided by pkg freeze my system and the self-compiled one does not?
3) Has anything changed from 12.0 to recent 12.1 upgrades that would cause trouble with the driver?
4) Should I load both modeset and non-modeset modules?
5) Is the order of commands inside /boot/loader.conf relevant?

Thanks for any suggestions.
 

shkhln

Daemon

Reaction score: 419
Messages: 1,239

As I see it, there are 2 options, a) get the pkg from the repository, or b) get the driver from the Nvidia website, compile the kernel module yourself and then run nvidia-xconfig.
As far as this forum is concerned, there is only option a.

Both a) and b) fail to load their modules automatically. I didn't have this problem with 12.0, but with the fresh 12.1 install, automatic loading fails. Of course I have nvidia_load="YES" set. kldstat shows that it has not loaded. kldload nvidia(-modeset) works without errors, but with option a) Xorg freezes immediately. Option b) does work after manually loading the kernel module.
Read the pkg installation message. Seriously. Who else do you think it is for?

1) Why does 12.1 fail to load the module automatically?
It doesn't. You are doing something incorrectly.

2) Why does the kernel module provided by pkg freeze my system and the self-compiled one does not?
The setup script from the latter adds nvidia-modeset.ko to /boot/loader.conf, while you don't.

3) Has anything changed from 12.0 to recent 12.1 upgrades that would cause trouble with the driver?
No.

4) Should I load both modeset and non-modeset modules?
There is no non-modeset module: nvidia.ko is a dependency of nvidia-modeset.ko.

5) Is the order of commands inside /boot/loader.conf relevant?
That shouldn't matter, the actual loading order is determined by module dependencies.
 
OP
OP
B

broozar

Member

Reaction score: 8
Messages: 20

I did not read it because I simply added the installation command to my setup script, which means it just scrolls by in a sea of other messages. In any case, I deleted the pkg and installed it again, this time reading the message.

Results:
- I adjusted the loader.conf to enable modeset. Auto loading still fails. kldstat still says the module is not loaded.
- No freezing after loading manually, so at least I know now that the modeset module is essential.
- The issues described in the install message text (AGP, Linux, shared memory id) are not covering the problem I have.

I have noticed a nvidia message flashing up under the screen with the freebsd logo and the boot options, just before the screen clears. This message is not captured by dmesg apparently, so I had to film it with my phone. I think it says:
Loading kernel...
[...]
Loading configured modules
[...]
/boot/modules/nvidia-modeset.ko
loading required module linux-common
loading required module linux
loading required module nvidia
efi64_obj_loadimage: read failed
can't load file /boot/modules/nvidia.ko: input/output error

Googling this error suggested that loading these modules via rc.conf would be better. So the solution for me is this:
Delete all references to nvidia in /boot/loader.conf and instead add this to /etc./rc.conf: kld_list="nvidia-modeset nvidia"

Beats me why or when this has changed. But it works now.
 

shkhln

Daemon

Reaction score: 419
Messages: 1,239

efi64_obj_loadimage: read failed
can't load file /boot/modules/nvidia.ko: input/output error
elf64_obj_loadimage? Interesting…

Googling this error suggested that loading these modules via rc.conf would be better. So the solution for me is this:
Delete all references to nvidia in /boot/loader.conf and instead add this to /etc./rc.conf: kld_list="nvidia-modeset nvidia"
I believe the current recommendation is indeed rc.conf instead of loader.conf. The actual reason is lost on me, though.
 

wolffnx

Well-Known Member

Reaction score: 32
Messages: 265

Hi broozar , why not compile from ports?
/usr/ports/x11/nvidia-(version)
is the easiest thing in the world
one of these should work with your card
efi64_obj_loadimage: read failed
can't load file /boot/modules/nvidia.ko: input/output error


maybe someting related to 64 bits reference?
dont load nvidia at boot and first
try load the linux64 modules
is a shoot in the dark..but maybe works
 

wolffnx

Well-Known Member

Reaction score: 32
Messages: 265

There is PR 201679 and multiple subsequent commits increasing EFI_STAGING_SIZE. It's somewhat difficult, but evidently not impossible to run into this limit.



No more shots in the dark please :rolleyes:
😁 , I'l change the expression then..
I bet that if you compile the nvidia driver from ports It will work
if not recompile the kernel(dont ask me why) and then the nvidia driver from ports
for me in one machine I have to do that for the nvidia to work(recompile the kernel and then the driver)
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,487
Messages: 32,559

You don't need to recompile your kernel but you do need to make sure the sources (/usr/src/) match the exact version you have running.
 

mickey

Well-Known Member

Reaction score: 122
Messages: 478

Googling this error suggested that loading these modules via rc.conf would be better. So the solution for me is this:
Delete all references to nvidia in /boot/loader.conf and instead add this to /etc./rc.conf: kld_list="nvidia-modeset nvidia"
Yes, remove all references to the nvidia driver from your /boot/loader.conf, then only add nvidia-modeset to the kld_list in your /etc/rc.conf file. Everything else should be loaded automatically as a dependency.

I believe the current recommendation is indeed rc.conf instead of loader.conf. The actual reason is lost on me, though.
I believe the reason behind this was that you should only load stuff via loader.conf(5) that is essential to booting up the kernel, like harddisk controller/filesystem drivers, etc. Modules listed in kld_list are loaded much later in the boot process.
 

shkhln

Daemon

Reaction score: 419
Messages: 1,239

I believe the reason behind this was that you should only load stuff via loader.conf(5) that is essential to booting up the kernel, like harddisk controller/filesystem drivers, etc.
You might have noticed the manual page doesn't actually support this opinion. Nor any other piece of official documentation for that matter.

Modules listed in kld_list are loaded much later in the boot process.
And how exactly is this beneficial?
 

mickey

Well-Known Member

Reaction score: 122
Messages: 478

And how exactly is this beneficial?
You'd have to ask the developers who implemented kld_list in the first place, but I am pretty sure they did it for one reason or the other.
 

Criosphinx

Member

Reaction score: 35
Messages: 83

The man page for rc.conf says:

kld_list (str) A list of kernel modules to load right after the local
disks are mounted. Loading modules at this point in the boot
process is much faster than doing it via /boot/loader.conf
for those modules not necessary for mounting local disk.


When I upgraded to 12.1 I moved a few things from loader.conf to rc.conf:

kld_list="fuse coretemp nvidia-modeset cx23885 cx23885avfw cuse4bsd"

And indeed it is faster.

Details about the format are still missing in 12.1 documentation:

 
Top