NVIDIA Madness on 11.1

Help with graphics cards on GhostBSD.
Post Reply
TheLonelyAdventurer
Posts: 3
Joined: Mon Dec 04, 2017 11:00 pm

NVIDIA Madness on 11.1

Post 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.

Premise:

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

# NVIDIA DRIVER
linux_enable="YES"
linux_load="YES"
nvidia_load="YES"
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

nvidia_modeset_load="YES"
nvidia_modeset_name="nvidia-modeset"
Edited the rc.conf accordingly:

Code: Select all

# Enable linux compatibility
linux_enable="YES"

# 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.
User avatar
NevilleGoddard
Developer
Posts: 517
Joined: Thu Dec 22, 2016 10:30 pm
Location: Japan

Re: NVIDIA Madness on 11.1

Post by NevilleGoddard »

nvidia_modeset_load="YES"
nvidia_modeset_name="nvidia-modeset"
I think the top line is incorrect.

It should be ;

nvidia-modeset_load="YES".

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;

nvidia-modeset_name="nvidia-modeset"

Hope this helps
TheLonelyAdventurer
Posts: 3
Joined: Mon Dec 04, 2017 11:00 pm

Re: NVIDIA Madness on 11.1

Post by TheLonelyAdventurer »

I just noticed that, but even if I type it with the dash, nothing changes: nvidia-modeset is not found by X.

UPDATE
I'm now following this thread: https://forums.freebsd.org/threads/57477/

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

Code: Select all

nvidia_load="YES"
nvidia-modeset_load="YES"
So I'm trying this way.

UPDATE 2
That didn't change anything.
User avatar
NevilleGoddard
Developer
Posts: 517
Joined: Thu Dec 22, 2016 10:30 pm
Location: Japan

Re: NVIDIA Madness on 11.1

Post by NevilleGoddard »

User avatar
ericbsd
Developer
Posts: 2052
Joined: Mon Nov 19, 2012 7:54 pm

Re: NVIDIA Madness on 11.1

Post 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. https://wiki.freebsd.org/OptimusVideoSupport
TheLonelyAdventurer
Posts: 3
Joined: Mon Dec 04, 2017 11:00 pm

Re: NVIDIA Madness on 11.1

Post by TheLonelyAdventurer »

NevilleGoddard wrote:Perhaps this may help

https://forums.freebsd.org/threads/49130/
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. https://wiki.freebsd.org/OptimusVideoSupport
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: https://ghostbin.com/paste/3c6hq
But, this is probably because X -conf etc failed.

UPDATE

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)
Weird...
Jes
Posts: 42
Joined: Sun Dec 25, 2016 2:43 pm
Location: Spain
Contact:

Re: NVIDIA Madness on 11.1

Post 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).

BR
Post Reply