HOWTO: Setup Xorg with NVIDIA's driver

kpedersen

Son of Beastie

Reaction score: 2,091
Messages: 2,951

Intel's GPUs are bundled with almost all of their consumer processors.
Yep and people are much less likely to install a dedicated card anymore because things just work with the onboard intel. Especially for Linux where graphics aren't typically the focus (until recently with crap like Gnome 3).

Contrast this with ~10 years ago with the GMA9xx era. Many people would still opt for a dedicated amd/nvidia gpu because the Intel driver was still seen as inferior (remember the fun that was 915resolution?).

We aren't at the whims anymore of things like fglrx (thankfully!) and blobs and Nvidia might hopefully realise this and try to gain some loyalty by working on an open driver (with no real loss, it isn't like AMD could steal parts). But perhaps I am dreaming ;)

What do you mean "so much"? Intel doesn't sell any server GPUs at the moment.
Sloppy language on my part. Decent Intel support on servers (onboard) is nice (Think replacement of Matrox G-series. Nothing fantastic for 3D but it still works better than nvidia GPU + vesa driver.) But Intel in general has been successful with their GPU, that is why they are also going to be moving into the dedicated GPU space.
 

mkru

Member

Reaction score: 2
Messages: 25

I have tried the method described in this post with my GeForce GTX 1060 card. When I startx xorg returns (EE) no screens found(EE), xrandr returnsCan't open display. Does anyone know what might be wrong? I have one display embedded in the laptop and one external connected via HDMI.
 

free-and-bsd

Daemon

Reaction score: 164
Messages: 1,000

I have tried the method described in this post with my GeForce GTX 1060 card. When I startx xorg returns (EE) no screens found(EE), xrandr returnsCan't open display. Does anyone know what might be wrong? I have one display embedded in the laptop and one external connected via HDMI.
What does kldstat command show?
 

scottro

Daemon

Reaction score: 902
Messages: 2,050

I've found that in some, not all, cases, installing the nvidia-xconfig package will fix that problem. Install the package, then run with root privilege nvidia-xconfig and it backs up an existing xorg.conf if one exists and creates one. Usually, in my case, it's been a matter of xorg.conf needing (again, this is on some machines, not all) BusID information.
 

free-and-bsd

Daemon

Reaction score: 164
Messages: 1,000

I've found that in some, not all, cases, installing the nvidia-xconfig package will fix that problem. Install the package, then run with root privilege nvidia-xconfig and it backs up an existing xorg.conf if one exists and creates one. Usually, in my case, it's been a matter of xorg.conf needing (again, this is on some machines, not all) BusID information.
Yes, it's easier than hacking /var/log/Xorg.0.log for the IDs, monitor resolutions etc.
 

mkru

Member

Reaction score: 2
Messages: 25

kldstat shows that linux.ko, nvidia.ko nvidia-modeset.ko are loaded. I have installed nvidia-xconfig and run it with root privilege, but still the same result, no screens found. I have also tried rebooting after running nvidia-xconfig, but the result is the same, no screens found.
 

LordInateur

Member

Reaction score: 4
Messages: 31

Might be unrelated, and I'm not sure if you're already doing this (and perhaps someone already said something to this effect), but I definitely ran into similar issues with `nvidia-modeset` being loaded through /boot/loader.conf... I had to take it out and explicitly set it in /etc/rc.conf instead.

In /etc/rc.conf:

Code:
kld_list="nvidia-modeset"

(Note that if you've got `kld_list` already set you can append `nvidia-modeset`, delimited by a space).

Could be unrelated, but at least I'll have this here when I inevitably run into this issue again in the future.
 

mkru

Member

Reaction score: 2
Messages: 25

Ok, my /boot/loader.conf is now clean. Still the same info no screens found ... I have tried regenerating config with nvidia-xconfig, did not help.
Here is some config and modules info:
some_info.png
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,323
Messages: 38,841

Remove any of those generated xorg.conf files. You don't need them. Please stop generating these files with any kind of tool ( Xorg -configure, nvidia-xconfig).

Create a /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf:
Code:
Section "Device"
        Identifier "Card0"
        Driver     "nvidia"
EndSection

Then run startx. Look in /var/log/Xorg.0.log if you get errors.
 

mkru

Member

Reaction score: 2
Messages: 25

I finally managed to get it to work. I had to add BusID to the driver-nvidia.conf.
So in my case driver-nvidia.conf file looks like this:
Code:
Section "Device"
    Identifier "Card0"
    Driver "nvidia"
    BusID "PCI:1:0:0"
EndSection
Why did I have to add BusID? I have no idea.
How did I get the idea to add BusID? I have checked how the configuration file looks like on Linux.

One more remark. Do not add linux to the kld_list, it is obsolete. Instead just set linux_enable="YES".
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,323
Messages: 38,841

Why did I have to add BusID? I have no idea.
Should only be necessary if you have more than one graphics card.

One more remark. Do not add linux to the kld_list, it is obsolete. Instead just set linux_enable="YES".
You don't need it at all for the driver to work. The port/package depends on it so you can use the NVidia driver with the Linux compatibility layer, not because the driver needs it.
 

mkru

Member

Reaction score: 2
Messages: 25

There is
Code:
       product: UHD Graphics 630 (Mobile)
       vendor: Intel Corporation
does it count?

If it counts, I think it should be noted somewhere in the installation guides, that the BusID is necessary in such case. I have spent 2 days to figure this out.
 

scottro

Daemon

Reaction score: 902
Messages: 2,050

I only have one graphics card in my work worstation. It has multple ports, a VGA, HDMI and DVI. In my particular case, I think something's slightly wrong with the machine, as on another machine, with the same card, I didn't have to do that. Anyway, as I've said, I've often found that nvidia-xconfig gets a card working for me, IF it doesn't work with more minimal configuration. In most cases, it seems to be the BUSID added by nvidia-xconfig that helps.

IMPORTANT NOTE: Most of my FreeBSD experience is on servers, so this isn't based on tons of experience, probably 6 or 7 machines in the last 5 years.
 

debguy

Well-Known Member

Reaction score: 24
Messages: 275

I have both i5 w/intel video usesless and nvidia 1050 useless (still today not released i think). WIIl they ever, they are working on googleTV instead.

Here's what I do it works "great unless your a #3dgamr"

I use may previous 'nix box (any having a supported AGP card or PCI card running 'nix)

I run xdm (the X11 daemon) on the "fast but unsupported pc". On the old PC I run the comand:

# X -query new_host

I get a pretty responsive desktop including smooth scrolling web browser. It's well known not to work with 3D on (older releases of X11, so even that depends). It's a great thing to have working "when things just aren't working".
 

debguy

Well-Known Member

Reaction score: 24
Messages: 275

now if (ubuntu/google) wares android/TV allowed remote X11 query to a fast host with non-supported graphics card, that would be special! they are busy locking out competitors stream icons i think. Really? things are way too deep in 2021 to spend weeks getting nvidia employees driver errata job done. you need an xbox or playstation or 2nd pc for gaming ... unless your actually "working with / for them" to make freeBSD a steam stream tv platform right? then you'd be wasting your time well!
 

free-and-bsd

Daemon

Reaction score: 164
Messages: 1,000

Well, with all said and discussed above, I MUST state this with regard to NVIDIA driver. It works fine for me, yes.
BUT: X never startx without me having driver definition in /usr/local/etc/X11/xorg.conf.d/driver.conf. Nor does i915kms work without it either. WITHOUT that driver definition you get weird error to the effect that "X server must be set root".
So I actually don't know about Xorg "being able to determine" things on its own, except for keyboard & mouse.
 

scottro

Daemon

Reaction score: 902
Messages: 2,050

Summaries are good, but as a thread gets longer, harder and harder to fine. That's why I sometimes put up little pages, almost as much for myself as for others.
NVidia. Usually works for me, but sometimes I have make use of the nvidia-xconfig program, other times, just installing the driver is sufficient. With my workstation, that has a multi-monitor setup, I needed nvidia-settings, though someone more skilled than me can probably get it going by hand.

Dedicated Intel cards on laptops, even on one that's pretty old, like a barebones Clevo, probably from 2012 or so, I needed the drm-kmod module. As has been mentioned many times, right now, on 12.2 or 13-Alpha or whatever 13 is at, and CURRENT which I guess is 14?, you need to build it from portsl
I've only run into an AMD dedicated card on my new laptop, (which is already considered old I think, but that's OK, so am I), a T495 Ryzen 7, and on that, I needed 13-CURRENT to get it to work, and had to build from ports. Now that 13 is alpha, still works. (As dates are hard to readon these forums for my aging eyes, I'll mention that this is of early February, 2021).
All that being said, and remembering that one has to install src to build drm-kmod, it only takes a few minutes. Most Linux distributions use Nouveau, an open source NVidia driver by default, but the majority of distributions have something like rpmfusion (for RH based distributions) that will easily install Nvidia and blacklist the nouveau drivers. (My own experience with nouveau has been poor).
 

free-and-bsd

Daemon

Reaction score: 164
Messages: 1,000

Summaries are good, but as a thread gets longer, harder and harder to fine. That's why I sometimes put up little pages, almost as much for myself as for others.
NVidia. Usually works for me, but sometimes I have make use of the nvidia-xconfig program, other times, just installing the driver is sufficient. With my workstation, that has a multi-monitor setup, I needed nvidia-settings, though someone more skilled than me can probably get it going by hand.

Dedicated Intel cards on laptops, even on one that's pretty old, like a barebones Clevo, probably from 2012 or so, I needed the drm-kmod module. As has been mentioned many times, right now, on 12.2 or 13-Alpha or whatever 13 is at, and CURRENT which I guess is 14?, you need to build it from portsl
I've only run into an AMD dedicated card on my new laptop, (which is already considered old I think, but that's OK, so am I), a T495 Ryzen 7, and on that, I needed 13-CURRENT to get it to work, and had to build from ports. Now that 13 is alpha, still works. (As dates are hard to readon these forums for my aging eyes, I'll mention that this is of early February, 2021).
All that being said, and remembering that one has to install src to build drm-kmod, it only takes a few minutes. Most Linux distributions use Nouveau, an open source NVidia driver by default, but the majority of distributions have something like rpmfusion (for RH based distributions) that will easily install Nvidia and blacklist the nouveau drivers. (My own experience with nouveau has been poor).
I, on the other hand, never (recentlly) needed nvidia-xconfig. However, without defining nvidia in driver.conf Xorg won't find anything. So I would say, it's a bit of exaggeration to say that 'normally you don't need anything in xorg.conf.d directory'. Simple as it is, I still do need something there.
 
Top