Page 1 of 1

NVIDIA Madness on 11.1

Posted: Tue Dec 05, 2017 12:28 am
by TheLonelyAdventurer
Hi all, I'm kind of a newbie on BSDs, I begun my journey just about a few weeks ago after being a linux user.


I was trying to install the nvidia driver for my GeForce 610M (yes, it is a hybrid gpu with the Optimus technology).

So, at first I tried installing nvidia-driver-384.90 from the default repoes (pkg search shown many entries, I chose the one that supported my graphics card according to freebsd's online pages and nvidia's specification - in particular I should use the 384.98 driver which is the latest recommended), but had little luck the first time: Xorg showed a blank screen, so I ran nvidia-xconfig to fix it. It messed up Xorg more and it didn't even load.

OK, so I deleted the xorg.conf created by nvidia and replaced it with the one created by Xorg -configure (which showed failure messages about incorrect display numbers) but worked changing the gpu driver from nv to vesa (which sadly does not support my gpu).

Then, according to many threads in the freebsd forums, I added nvidia's and linux compatibility layers' modules to the /boot/loader.conf:

Code: Select all

I also added nvidia nvidia-modeset linux linsysfs linprocfs via sysrc (after installing the linux modules, setting the fstab entries properly and mounting the paths shown by the warnings of pkg, obviously).

Rebooted, X shows a blank screen, but I can actually type and login showing something like a resetted XFCE environment (I have XFCE ; it showed with no panels and the default's XFCE background with the mouse).

kldstat showed the module was loaded.

Disheartened, I tried to reinstall the driver multiple times and trying different settings for the Xorg.conf (using xorg.conf.orig, xorg.nvidia-something.conf, nvidia-xconfig and such) with no luck.

So, I downloaded the 384.98 driver from the nvidia's website (by choosing freebsd x64 as OS and GeForce 610M as gpu) and extracted FreeBSD 11.1's kernel sources in /usr/src (yes, I have updated my GhostBSD to 11.1 today).
I started building and installing the driver with make install clean as described in some threads of the freebsd forums.

The build log says it has successfully installed the driver, but it also said it couldn't find pkg_info and also the /compat/linux/X11R6 directory.

It seemed to work until after reboot, I got a blank screen again. I realized I didn't uninstall the old drivers, so I did that and reinstalled the new ones.
After a second reboot, I still get the blank screen.

I found some useful info in the Xorg.0.log file, two lines saying something like ModeSet has been set to "NULL".

After some research, I realized I did not read fully the warnings in the README: according to the UPDATING file in the freebsd notes, the newest NVIDIA drivers starting from 385.09 also load a helper engine for the nvidia.ko called nvidia-modeset, which accordingly to the UPDATING, should be loaded instead of nvidia if I experience X hanging or the "NULL" ModeSet.
So I edited /boot/loader.conf replacing all instances of "nvidia" with "nvidia-modeset":

Code: Select all

Edited the rc.conf accordingly:

Code: Select all

# Enable linux compatibility

# Load the following kernel modules
kld_list="geom_mirror geom_journal geom_eli linux fuse ext2fs cuse i915kms nvidia nvidia-modeset linsysfs linprocfs"
And also edited the Xorg.conf so that instead of loading the nvidia driver, it loads the nvidia-modeset one.

At this point I ran nvidia-xconfig again and it correctly configured (finally) the xorg.conf file.

The final xorg.conf works good and I am sure both the drivers are loaded because kldstat shows entries for nvidia.ko and nvidia-modeset.ko (also the linux modules are loaded), but I can read some weird lines when launching glxgears:

Code: Select all

Xlib:  extension "GLX" missing on display "unix:0.0".
Error: couldn't get an RGB, Double-buffered visual
Suspecting some other issue with the nvidia module, I do egrep (WW|EE) /var/log/Xorg.0.log | grep nvidia and got some lines about not finding a compatible driver for my gpu (which is very weird as according to nvidia, I built the right one).

I tried to reboot thinking of a temporal issue, but...

Actual situation and issue:

I got these lines in my Xorg.0.log after a simple reboot:

Code: Select all

[    20.856] (II) LoadModule: "nvidia-modeset"
[    20.898] (WW) Warning, couldn't open module nvidia-modeset
[    20.898] (II) UnloadModule: "nvidia-modeset"
[    20.898] (II) Unloading nvidia-modeset
[    20.898] (EE) Failed to load module "nvidia-modeset" (module does not exist, 0)
This does not make any sense to me, it was loaded in the past step! How did it mess this way up?!

My question
I'd like to get GLX application to work with the proprietary drivers, but at this point I'm really unsure how to proceed.
I upload here my current configs and dmesg, maybe you can help me.
Thank you in advance.

Re: NVIDIA Madness on 11.1

Posted: Tue Dec 05, 2017 8:09 am
by NevilleGoddard
I think the top line is incorrect.

It should be ;


In between nvidia and modeset should be a dash, not an underscore.
I'm not sure what the second line is for but that also probably needs to be changed to;


Hope this helps

Re: NVIDIA Madness on 11.1

Posted: Tue Dec 05, 2017 9:02 am
by TheLonelyAdventurer
I just noticed that, but even if I type it with the dash, nothing changes: nvidia-modeset is not found by X.

I'm now following this thread:

According to the user Snurg, the /boot/loader.conf should contain this:

Code: Select all

So I'm trying this way.

That didn't change anything.

Re: NVIDIA Madness on 11.1

Posted: Tue Dec 05, 2017 9:44 am
by NevilleGoddard

Re: NVIDIA Madness on 11.1

Posted: Tue Dec 05, 2017 9:47 am
by ericbsd
nvidia_load="YES" is not need anymore, but the reading your first post you hybrid GPU with the Optimus might be the problem.

Re: NVIDIA Madness on 11.1

Posted: Tue Dec 05, 2017 11:49 am
by TheLonelyAdventurer
NevilleGoddard wrote:Perhaps this may help
So, is Optimus NOT supported by freebsd? It looks like not according to ericbsd's reply.
ericbsd wrote:nvidia_load="YES" is not need anymore, but the reading your first post you hybrid GPU with the Optimus might be the problem.
Ok, I removed that from the loader.conf and the rc.conf, then I followed the steps in that wiki (so I had to reinstall the driver from the ports).

I needed to install the acpi_call module by compiling it from source because I did not have it (required by the shell script - yes I replaced the OFFs to ON).

Next I ran the script, which succeded without issues, but...

I tried to stop X by killall -15 Xorg, removed the lock file and launched this:

Code: Select all

X -conf xorg.conf.nv -sharevts -noreset :8
It failed saying that "-conf" is not a valid option for the Xorg server.
I tried vglrun too and failed saying that it couldn't connect to :8 (also :0 does not work).
Next I tried again nvidia-xconfig after copying the Xorg -configure but both failed again.

So, I tried copying again a new Xorg -configure and replacing "modesetting" with "intel" and "nv" with "nvidia" to match the drivers.

Xorg -configure always shows the error about the display numbers mismatch, but most importantly, Xorg does not fail to load nvidia anymore.

However the module now is loaded (kldstat confirms that both nvidia and acpi_call are loaded) but the GLX extension does not.

Here is my current config: What I notice is that now nvidia's libglx seems to be loaded by Xorg, but for some reason VirtualGL fails:
But, this is probably because X -conf etc failed.


Here is an interesting line in Xorg.0.log after launching kldload nvidia:

Code: Select all

Failed to initialize GLX extension (Compatible NVIDIA X driver not found)

Re: NVIDIA Madness on 11.1  [SOLVED]

Posted: Fri Jan 05, 2018 12:50 pm
by Jes
My laptop is Optimus too and I must disable Intel card in Bios, letting only the Nvidia card activated. In this way Xorg is able to start using nvidia. If I let both Nvidia and Intel cards activated in Bios, then Xorg refuses to start (with a custom xorg.conf prepared for nvidia). It seems that with both cards activated, Intel card is the default.

So, try to deactivate Intel card in your bios (if possible).