HOWTO: Setup Xorg with NVIDIA's driver

Lucky

New Member


Messages: 5

Why won't you just tell which laptop model (looks like METABOX, but which one?) you are using? In your previous log NVIDIA driver showed a lot, now it says the above...

I suspect you have a laptop with two graphical adapters. If so, their usage must be configurable via BIOS.
I got this one... http://www.metabox.com.au/store/b218/Metabox-Alpha-N850HJ-laptop

btw... Thank you FaB. Seems that you help a lot of people in this area. You're a good man :) It's truly appreciated (I'm sure by all)
 

free-and-bsd

Aspiring Daemon

Reaction score: 72
Messages: 657

[ 38.905] (II) NVIDIA(0): NVIDIA GPU GeForce GTX 1050 (GP107-A) at PCI:1:0:0 (GPU-0)
This is from your previous X log. And NOW it doesn't detect devices at PCI:1:0:0? Funny. Can it be the nvidia-modeset.ko module is not loaded this time?
 

free-and-bsd

Aspiring Daemon

Reaction score: 72
Messages: 657

OK, may try to remove the line containing "PCI:1:0:0" from nvidia.conf and see what happens.
 

ShelLuser

Son of Beastie

Reaction score: 1,669
Messages: 3,509

Most of you probably already know this but I figured it still makes a good addition to this awesome guide.

If you're using a port to enhance your kernel then you might be interested in PORTS_MODULES.

If you add PORTS_MODULES to /etc/make.conf then this will instruct your system to grab and build the specified port(s) every time you recompile your kernel, thus ensuring that your system remains fully intact.

So to add to the example in the guide, if you're using the NVidia module then you might want to add:

Code:
PORTS_MODULE=x11/nvidia-driver
... to your /etc/make.conf.
 

Robert Kopp

New Member


Messages: 5

I made a fresh install of 11.1 (AMD) before I read this post. I have a GTX970 display adapter. I downloaded software from Nvidia's Website (384.98, instead of 384.90 that is currently in the ports tree) instead of using the port. But such Linux-based applications as linux-unigine-heaven will not work. When I built that application, I built the required environment to support Linux, but it should have been done before the Nvidia driver was installed. And perhaps the Nvidia driver should have been installed from ports. What should I do now? Will installing the driver from ports fix the problem, or do I need to uninstall something first?
 

coyote_trackz

New Member


Messages: 14

It seems that these instructions don't seem to work with 11.2. I started getting error messages (of which I neglected to write down) in regards to the nvidia driver. Are there any modifications that need to be made to the instructions?
 

scottro

Daemon

Reaction score: 463
Messages: 1,328

There are some issues with 11.2 and NVidia. Firstly, it has to be installed from ports for the moment, not packages.
Depending upon your card, you'll either want x11/nvidia-driver or, if it's an older card (you have to hunt around if it's a card that uses the legacy driver--NVidia has a list, but the model numbers sometimes differ, so you may have to look) use the nvidia-driver-340. If it's the 340, then in /boot/loader.conf you put nvidia_load="YES" if it's the newer driver then
nvidia_modeset_load="YES"

If X won't start, at this point, you can try running the nvidia-xconfig program which usually gives you a working xorg.conf that will work with your card. If it still won't start, the only time that this has happened to me was because there was no BusID entry in the xorg.conf created nvidia-xconfig, so look for a BusID line and if not, you'll have to add it.
To get the BusID, you can use nvidia-smi -q |grep Bus and you might get something like

Code:
Bus Id                      : 00000000:01:00.0
So you would put in /etc/X11/xorg.conf
Code:
 BusID          "PCI:1:0:0"
in the Device section.

But sometimes, you don't even need an xorg.conf. I've never really noticed a pattern, and even if you do, you could cut out a lot of what nvidia-xconfig puts in there and get by with a few lines, but I've never cared enough, I fear, to see how much I can leave out.
 

clawhammer

Active Member

Reaction score: 6
Messages: 157

There are some issues with 11.2 and NVidia. Firstly, it has to be installed from ports for the moment, not packages.
Depending upon your card, you'll either want x11/nvidia-driver or, if it's an older card (you have to hunt around if it's a card that uses the legacy driver--NVidia has a list, but the model numbers sometimes differ, so you may have to look) use the nvidia-driver-340. If it's the 340, then in /boot/loader.conf you put nvidia_load="YES" if it's the newer driver then
nvidia_modeset_load="YES"

If X won't start, at this point, you can try running the nvidia-xconfig program which usually gives you a working xorg.conf that will work with your card. If it still won't start, the only time that this has happened to me was because there was no BusID entry in the xorg.conf created nvidia-xconfig, so look for a BusID line and if not, you'll have to add it.
To get the BusID, you can use nvidia-smi -q |grep Bus and you might get something like

Code:
Bus Id                      : 00000000:01:00.0
So you would put in /etc/X11/xorg.conf
Code:
BusID          "PCI:1:0:0"
in the Device section.

But sometimes, you don't even need an xorg.conf. I've never really noticed a pattern, and even if you do, you could cut out a lot of what nvidia-xconfig puts in there and get by with a few lines, but I've never cared enough, I fear, to see how much I can leave out.
I get command not found for nvidia-smi. I have the nvidia-driver installed and what ive read is that nvidia-smi should be included with that. Did you download nvidia-smi from some other source?
 

Chris_H

Daemon

Reaction score: 190
Messages: 1,076

That probably should have read: pciconf -lv
Generally speaking. I've usually found it easier after loading the nvidia kernel module. To just exec startx.
Which produces a logfile as /usr/log/Xorg.0.log
opening that log file provides the BusID number that you can add as necessary. For example mine was: 0:2:0:0. As I don't need an /etx/X11/xorg.conf file. I simply created a
/usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf file that looke like this:
Code:
# /usr/local/etc/X11/xorg.conf.d/
Section "Device"
        Option  "DRI"   "True"
        Identifier      "Card0"
        Driver          "nvidia"
        BusID           "PCI:0:13:0"
        #BusID  "PCI:0:2:0:0"
EndSection
HTH!

--Chris
 

clawhammer

Active Member

Reaction score: 6
Messages: 157

That probably should have read: pciconf -lv
Generally speaking. I've usually found it easier after loading the nvidia kernel module. To just exec startx.
Which produces a logfile as /usr/log/Xorg.0.log
opening that log file provides the BusID number that you can add as necessary. For example mine was: 0:2:0:0. As I don't need an /etx/X11/xorg.conf file. I simply created a
/usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf file that looke like this:
Code:
# /usr/local/etc/X11/xorg.conf.d/
Section "Device"
        Option  "DRI"   "True"
        Identifier      "Card0"
        Driver          "nvidia"
        BusID           "PCI:0:13:0"
        #BusID  "PCI:0:2:0:0"
EndSection
HTH!

--Chris
I'm sorry but ive been modifying rc.conf, nvidia config files for the past couple days. I have an gtx 1060 that I can get to boot in x server. the only way I can get x server to work with kde is with the intel integrated chipset. Ive tried all the way ive seen on the forums to have the config files but it wont boot lol. Am I dumb or just missing something?
 

scottro

Daemon

Reaction score: 463
Messages: 1,328

I get command not found for nvidia-smi. I have the nvidia-driver installed and what ive read is that nvidia-smi should be included with that. Did you download nvidia-smi from some other source?
No, perhaps it was included with nvida-xconfig? I had it installed.
As Chris_H points out, pciconf -lv will also give you a busid, but the simplest (as also mentioned in their post) is probably to just run startx and see if Xorg.0.log gives it.

In my case, I've only had to find it on one occasion, and nvidia-smi was my first google hit, and when I ran it, it was on my machine.
 

coyote_trackz

New Member


Messages: 14

There are some issues with 11.2 and NVidia. Firstly, it has to be installed from ports for the moment, not packages.
Depending upon your card, you'll either want x11/nvidia-driver or, if it's an older card (you have to hunt around if it's a card that uses the legacy driver--NVidia has a list, but the model numbers sometimes differ, so you may have to look) use the nvidia-driver-340. If it's the 340, then in /boot/loader.conf you put nvidia_load="YES" if it's the newer driver then
nvidia_modeset_load="YES"

If X won't start, at this point, you can try running the nvidia-xconfig program which usually gives you a working xorg.conf that will work with your card. If it still won't start, the only time that this has happened to me was because there was no BusID entry in the xorg.conf created nvidia-xconfig, so look for a BusID line and if not, you'll have to add it.
To get the BusID, you can use nvidia-smi -q |grep Bus and you might get something like

Code:
Bus Id                      : 00000000:01:00.0
So you would put in /etc/X11/xorg.conf
Code:
BusID          "PCI:1:0:0"
in the Device section.

But sometimes, you don't even need an xorg.conf. I've never really noticed a pattern, and even if you do, you could cut out a lot of what nvidia-xconfig puts in there and get by with a few lines, but I've never cared enough, I fear, to see how much I can leave out.
Is it possible to do this from packages at the moment?
 

Sevendogsbsd

Well-Known Member

Reaction score: 150
Messages: 340

I seem to remember not long ago (before building my new box), that the nvidia driver pkg worked fine. I may have had to build custom configs under /usr/local/etc/X11/xorg.conf.d/ but maybe only one for resolution and DPMS. I would have been using the latest driver since I had a 1050Ti card. I did use
nvidia-modeset_load="YES" though.
 

scottro

Daemon

Reaction score: 463
Messages: 1,328

So Sevendogsbsd, at this point (early December, 2018) you are able to use packages for NVidia? (I don't even have a test box to try it on right now.)
Thanks.
 

Sevendogsbsd

Well-Known Member

Reaction score: 150
Messages: 340

Actually, I haven't tried this month, BUT, you are in luck! I am standing up my ports build server again tonight/tomorrow so will do an install of the nvidia driver as a test for you - I need to rebuild the box anyway (switch to zfs) and before I do, I'll install xorg and nvidia from pkgs and see if I can get a twm session. Shouldn't take long.
 

Sevendogsbsd

Well-Known Member

Reaction score: 150
Messages: 340

I can happily report that the nvidia pkg works fine, at least X comes up and displays twm, anyway. The resolution is wrong on my monitor but that takes a config file to correct in my case, because I have a very large monitor. The nvidia kernel module is loaded with the statement in my earlier post, at least for the version 390.xx driver (latest). One caveat is that the pkg has Linux support as required so you will have to load that prior to installing the nvidia driver: linux_enable="YES" in /etc/rc.conf After that, you can either bounce the machine or run kldload linux and the linux module will be loaded without rebooting. After the Linux module is loaded, you can do the nvidia driver install via pkg.

Sorry - forgot, this is a fresh install of 11.2-RELEASE-p-5
 

meine

Member

Reaction score: 28
Messages: 71

There is also a very simple way to use your nvidia card, for those (including myself) that have trouble and/or impatience getting the nvidia driver to work properly:

# pkg install -y xf86-video-nv

Put the following in /usr/local/etc/X11/xorg.conf.d/driver-nv.conf
Code:
Section "Device"
    Identifier "Card0"
    Driver     "nv"
EndSection
There is no need for further adding of lines to any config file.

This xf86-video-nv is just a straightforward nvidia driver for basic use. Probably you won't get the performance you need when doing heavy graphical stuff, but for text processing, internet use etc it works fine.
 

free-and-bsd

Aspiring Daemon

Reaction score: 72
Messages: 657

This xf86-video-nv is just a straightforward nvidia driver for basic use. Probably you won't get the performance you need when doing heavy graphical stuff, but for text processing, internet use etc it works fine.
Oh, it's the good old Xorg, formerly X11R6, NV driver, isn't it? Old friend :)
I remember trying to use this one some *-teen years ago, the graphics quality was rather low.

Moreover, I also seem to remember some statements to the effect that its development had been dropped... but I may be mistaken. It was back at the time of switching from X11R6 over to Xorg as default.
But if it indeed was dropped back at the time I seem to remember, then the modern framebuffer driver shall be far more useful here, right?

EDIT: it wasn't dropped, it was deprecated in 2010 in favour of nouveau. There are some fresh commits there, but there doesn't seem to be much of development there anyway.
 

Ogis

Member

Reaction score: 52
Messages: 51

Thanks for this instruction. I'll add that I additionally installed nvidia-settings and nvidia-xconfig. At this time, everything works normally.

 
Top