Loading kernel modules automatically

I installed the nvidia driver for my graphics card and it works well with the system. The nvidia install scripts added the following to /boot/loader.conf:

Code:
nvidia_load="YES"

However, the driver module (/boot/modules/nvidio.ko) does not load automatically when the system is booting. If I load the driver manually,

[cmd=]kldload /boot/modules/nvidio.ko[/cmd]

then X11 comes up via XDM after the module loads. I checked /var/run/dmesg.boot, and there was nothing in there regarding the nvidia driver.

How can I set up FreeBSD to load this driver during boot? Do I need to add the kldload command to a RC script?

My platform is FreeBSD 8.2 on i386. My video card is also an AGP card if that matters.
 
The install-script does NOT add that line automatically to /boot/loader.conf. You have to add it manually.

The nvidia kernel module loads just fine during boot.
 
Well, I may have added that line while I was trying to get the driver to work (last week's efforts). HOWEVER, the driver is not loading at boot-time. I have to manually load the module with kldload even with
Code:
nvidia_load="YES"
in /boot/loader.conf. I can confirm the module is not loading with kldstat. After manually loading the module, rerunning kldstat shows the module is loaded.

Is there another FreeBSD log file that I would be able to look at to see which kernel modules are loaded at boot time and whether or not the failed?
 
During the boot process you can interact with the loader that would be responsible for reading /boot/loader.conf and loading the kernel and modules. When you get to the countdown screen choose the option to "escape to loader prompt" and poke around there to see if you can get it to load in the loader. Once you think you're done, type "boot" and hit enter and it will boot your system. There is some limited help available from the interactive loader prompt.
 
The most common cause is either a typo or a space where there shouldn't be any.

For example:
Code:
nvidia_load = "YES"
This will fail. There shouldn't be any spaces around the equal (=) sign.
 
So I've tried messing around a bit more. I have six lines in my loader.conf file, 5 wlan modules and then this nvidia module. There are no spaces around the equal sign. I noticed that the wlan modules had single quotes rather than double quotes, so I tried changing to single quotes:

Code:
nvidia_load='YES'

However, same result. nvidia.ko was not loaded upon boot and had to be manually loaded with kldload.

I then tried the method that Zhwazi mentioned. At the boot prompt, I tried lsmod, but the nvidia module was not present. In the output the only things of interest were agp.1 and ata-nvidia.1, but I don't know what these are.

I verified that the nvidia.ko module was available with ls boot/modules. I then manually loaded the module:

[cmd=]load boot/modules/nvidia.ko[/cmd]

The module was loaded as well as the Linux ABI module, and no errors were reported. When I then booted into the system with the boot command, XDM came up automatically as I expected.

I suppose I'll try to take out all of the wlan stuff and just try to load this nvidia driver.
 
Check the module_path option in /boot/defaults/loader.conf and /boot/loader.conf to make sure that /boot/modules/ is included.

Add/update module_path in your /boot/loader.conf if that directory is missing from the path.

The loader checks module_path for modules, and nowhere else.
 
@wblock:

Here are the contents of my /boot/loader.conf file:

Code:
wlan_wep_load='YES'
wlan_tkip_load='YES'
wlan_ccmp_load='YES'
wlan_xauth_load='YES'
wlan_acl_load='YES'
nvidia_load='YES'

I'd do an md5sum, but I don't seem to have it installed nor is it available with pkg_add. I've been spoiled by apt-get for way too long... :e
 
@phoenix:

/boot/defaults/loader.conf has the following for my module_path:

Code:
module_path="/boot/modules"     # Set the module search path

However, /boot/loader.conf has no such path. The contents of the directory /boot/modules:

Code:
bsd# ls /boot/modules/
linker.hints	nvidia.ko
 
watsonandholmes said:
@wblock:

Here are the contents of my /boot/loader.conf file:

Code:
wlan_wep_load='YES'
wlan_tkip_load='YES'
wlan_ccmp_load='YES'
wlan_xauth_load='YES'
wlan_acl_load='YES'
nvidia_load='YES'

Is that the actual file or retyped? My idea was mixed single and double quotes, or one missing. Either way, at least the first three can go, probably the other wlan entries too.

Don't know if single or double quotes are significant, but I've only ever used double quotes there.

I'd do an md5sum, but I don't seem to have it installed nor is it available with pkg_add.

It's just md5(1) on FreeBSD. But it won't help without something to compare.
 
From time to time, I got stuck at unvisible character in config file or missing new line. So first thing I will try in your case is start editing at end of last wlan line, ENTER, manually retype nvidia..., ENTER, delete rest of file, reboot. Maybee moving nvidia module to first line may also help in case that any of previous modules causes error which stop loading of next module, but that is only speculation.
 
% hd /boot/loader.conf
can be used to look for extra characters. Since the wlan modules aren't needed, the easiest way is just to delete the file and recreate it. Also, check the path. I always seem to type "/etc", but it's not in there.
 
wblock@ said:
It's just md5(1) on FreeBSD. But it won't help without something to compare.

I usually do an md5sum of the file when I paste things online. That way, anyone can copy/past it into a file and do an md5sum to make sure they match. Perhaps I've just been working with regional encodings for too long... (Big5, Shift-JIS, etc.)
 
OK, so I deleted the file and created a new one from scratch that has only the following:

Code:
nvidia_load="YES"

I used double quotes and removed all of the wlan entries. To my surprise, XDM now comes up upon boot and my wireless NIC still works with no issues. I suppose that one of the wlan entries in the file was causing an error and preventing the nvidia module from being loaded. Of perhaps the single quotes for the wlan plugins were causing the issues? XDM works upon boot now, so I am now quite satisfied with the setup.

"Mission Accomplished" everyone. :) Thank you for your time and help in resolving this issue.
 
Back
Top