How to set-up Nvidia graphics card on FreeBSD 11.1?

usernamekiran

Member


Messages: 48

Hello.<br />I am aware this has been asked numerous times before, but the two methods that I tried failed. I had to clean-up after both methods.

I have an Alienware 13 R-2 laptop, with 16GB RAM, and "NVIDIA GeForce GTX 960M". I have been using the OS for a while now (without the drivers), with XFCE.

First of all, after a going through many posts/discussions I went with the method as explained in "HOWTO: Setup Xorg with NVIDIA's driver". After installation, on rebooting I was getting an error regarding X system (unfortunately I cant recall it exactly now). After logging in, I couldnt start XFCE by startx, or by startxfce4. I deleted /usr/local/etc/X11/xorg.conf.d directory along with its content ( /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf
I deleted everything that I had installed, ( pkg delete, then pkg autoremove, and then pkg clean -a.
Then I went with the handbook method, and removed everything again. (unfortunately I cant recall the error this time).

How should I set-up the graphics card? I am willing to try both these methods again if you need to know the exact errors.

Thanks a lot in advance,
usernamekiran.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,678
Messages: 39,278

Setting up the NVidia card has nothing to do with XFCE not starting. Use the HOWTO you used initially. Make sure X works with it (default stuff). Then look at why XFCE isn't working for you. Treat this as two separate issues and fix Xorg first. It's no use trying XFCE if Xorg isn't working.
 

Snurg

Daemon

Reaction score: 594
Messages: 1,349

As I am setting up a new system, too, I did the install steps described here.
xorg does not supply a xorg.conf file anymore.
As I am a obvious jerk, xorg refuses to work without xorg.conf on my computers.
So I copied the one from the old system and adapted it slightly:
Code:
Section "ServerFlags"
Option "DontZap" "false"
EndSection

Section "InputClass"
Identifier "Keyboard Defaults"
MatchIsKeyboard "yes"
Option "XKbOptions" "terminate:ctrl_alt_bksp"
EndSection

Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
EndSection

Section "Files"
# FontPath "/usr/local/share/fonts/Droid/"
EndSection

Section "InputDevice"
# generated from default
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/sysmouse"
Option "Emulate3Buttons" "no"
Option "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
# generated from default
Identifier "Keyboard0"
Driver "keyboard"
EndSection

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
# Option "DPMS"
EndSection

Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1200"
EndSubSection
EndSection
Make sure that the resolution given modeline at the end of the screen section is correct for your computer's display.
If that works, try out if DPMS works by enabling that option. (needed for screen blanking)
If necessary, add your extra font paths.

If this makes xorg start up using startx, you are fine and only need to set your preferable WM respective DM (i.e. startxfce).
HTH.
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

Setting up the NVidia card has nothing to do with XFCE not starting. Use the HOWTO you used initially. Make sure X works with it (default stuff). Then look at why XFCE isn't working for you. Treat this as two separate issues and fix Xorg first. It's no use trying XFCE if Xorg isn't working.

I did what handbook said. There was no /etc/X11/xorg.conf so i created it with using vi, and added Driver "nvidia" (with two tabs in between). Upon rebooting, everything went as usual ("firewalls rules laoded" etc), logged in as normal user (i do not use login manager).

Upon entring startx, and startxfce4; I got the same error:
Code:
Markers: (--) probed, (**) from config file, (==) default setting,
[INDENT](++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[/INDENT]
(==) Log file: "/var/log/Xorg/0/log", Time: Tue Nov 28 00:26:27 2017
(==) Using config file: "/etc/X11/xorg.conf"
Parse error on line 1 of section (null) in file /etc/X11/xorg.conf
[INDENT]Driver is not a valid keyword in this section.[/INDENT]
(EE)
Fatal server error:
(EE) no screens found(EE)
(EE) Please also chack the log file at "/var/log/Xorg.0.log" for additional information
(EE)
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect X server: Connection refused
xinit: server error
usernamekiran@<hostname>:~ %
 

Snurg

Daemon

Reaction score: 594
Messages: 1,349

The Driver line alone is no complete Device section, and you need also the Screens section, as DPMS often does seem not to retrieve the screen data correctly (this why I deactivate for testing), and so xorg server cannot self-configure the screen. Just try copypaste the sample xorg.conf I posted, possibly changing the modeline to your lappy's resolution.
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

I copy-pasted content from snurg's xorg.conf to my file (exluding files/font section), still the same error.
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

The Driver line alone is no complete Device section, and you need also the Screens section, as DPMS often does seem not to retrieve the screen data correctly (this why I deactivate for testing), and so xorg server cannot self-configure the screen. Just try copypaste the sample xorg.conf I posted, possibly changing the modeline to your lappy's resolution.

Also, my /boot/loader.conf contains only one line: nvidia_load="YES".
 

Snurg

Daemon

Reaction score: 594
Messages: 1,349

Ah yes I forgot /boot/loader.conf again although I had it in my hands a few hours ago myself...
Code:
linux_enable="YES"

# nvidia_load="YES"
# use if above fails:
nvidia-modeset_load="YES"
Didn't check whether I need actually linux_enable, as I have to look into the driver Makefile for that.
nvidia_load alone didn't work for me, produced the same results like you experience.
As the nvidia driver built, it posted some message about that problem, suggesting to use nvidia-modeset_load in that case instead of nvidia_load. Which worked fine for me.

And then, if startx fires up the old twm, then you'll need to change .xinitrc to xfwhatever :)
HTH.
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

Ah yes I forgot /boot/loader.conf again although I had it in my hands a few hours ago myself...
Code:
linux_enable="YES"

# nvidia_load="YES"
# use if above fails:
nvidia-modeset_load="YES"

Hi. That gave me error "no screens found". Do you think my screen designation could be different? How do I check that?
 

Snurg

Daemon

Reaction score: 594
Messages: 1,349

Did you change the xorg.conf line Modes "1920x1200" (for my WUXGA monitor) to Modes "1920x1080" (FHD, if this is your display's native resolution)?
 

Snurg

Daemon

Reaction score: 594
Messages: 1,349

The built-in monitor maybe is somewhat different than common standalone monitors. DPMS might help then.
In the monitor section, commenting the sync options and uncommenting DPMS might help.
Code:
# HorizSync 28.0 - 33.0
# VertRefresh 43.0 - 72.0
Option "DPMS"

And, are you sure your laptop has actually FHD? Many laptops are sold in a number of different resolutions, with only top models having FHD.
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

The built-in monitor maybe is somewhat different than common standalone monitors. DPMS might help then.
In the monitor section, commenting the sync options and uncommenting DPMS might help.
Code:
# HorizSync 28.0 - 33.0
# VertRefresh 43.0 - 72.0
Option "DPMS"
The updated section should look like this, right?
Code:
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
# Option "DPMS"
# HorizSync 28.0 - 33.0
# VertRefresh 43.0 - 72.0
Option "DPMS"
EndSection
 

Trihexagonal

Son of Beastie

Reaction score: 2,355
Messages: 2,977

I have a Nvidia box and in the beginning stages of setting up one just like it now.

In /boot/loader.conf on mine I have:
Code:
linux_load="YES"
nvidia_load="YES"
nvidia-modeset_load="YES"
It's my /etc/rc.conf file where I use:
Code:
linux_enable="YES"
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

I was getting bored, and already annoyed. so I ran # pkg install x11/nvidia-driver out of curiosity. It gave me following output:
Code:
Updating FreeBSD repository catalogue...
Fetching meta.txz: 100%    944 B   0.9kB/s    00:01   
Fetching packagesite.txz: 100%    6 MiB 608.4kB/s    00:10   
Processing entries: 100%
FreeBSD repository update completed. 26865 packages processed.
All repositories are up to date.
Updating database digests format: 100%
pkg: gstreamer1-plugins-lame has a missing dependency: lame
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
   nvidia-driver: 375.66 -> 384.59

Number of packages to be upgraded: 1

The process will require 11 MiB more space.
37 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching nvidia-driver-384.59.txz: 100%   37 MiB 666.0kB/s    00:59   
Checking integrity... done (0 conflicting)
[1/1] Upgrading nvidia-driver from 375.66 to 384.59...
Extracting nvidia-driver-384.59: 100%
ELF binary type "3" not known.
/bin/sh: /compat/linux/sbin/ldconfig: Exec format error
Message from nvidia-driver-384.59:
To use these drivers, make sure that you have loaded the NVidia kernel
module, by doing

   # kldload nvidia   (or nvidia-modeset, see below)

or adding

   nvidia_load="YES"   (or nvidia-modeset_load="YES", see below)

to /boot/loader.conf, or putting ``nvidia'' (or ``nvidia-modeset'', see
below again) on ``kld_list'' variable in /etc/rc.conf.

If you build this port with FreeBSD AGP GART driver, make sure you have
agp.ko kernel module installed and loaded, since nvidia.ko will depend
on it, or have your kernel compiled with "device agp".  Otherwise, the
NVidia kernel module will not load.  Also, please set correct value for
``Option "NvAGP"'' in ``Device'' section of your X11 configuration file.

When building with Linux compatibility support, make sure that linux.ko
module is available as well (or have it compiled in kernel).  It can be
loaded via /boot/loader.conf, or later in the boot process if you add

   linux_enable="YES"

to your /etc/rc.conf.

If X.org cannot start and reports

   (EE) NVIDIA(0): Failed to obtain a shared memory identifier.

in /var/log/Xorg.0.log while actually you have ``options SYSVSHM''
enabled in kernel, the sysctl ``kern.ipc.shmall'' should be increased.

Starting with version 358.09, some important functionality of the driver
has been broken out into a separate kernel module, nvidia-modeset.ko.
Users that experience hangs when starting X11 server, or observe

   (II) NVIDIA(0): Validated MetaModes:
   (II) NVIDIA(0):     "NULL"

in /var/log/Xorg.0.log should replace ``nvidia'' with ``nvidia-modeset''
in their /boot/loader.conf or /etc/rc.conf configuration files, depending
on how they prefer to load NVidia driver kernel module.

See /usr/local/share/doc/NVIDIA_GLX-1.0/README for more information.

Whats interesting is, /var/log/Xorg.0.log doesnt exist on my system.
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

I have a Nvidia box and in the beginning stages of setting up one just like it now.

In /boot/loader.conf on mine I have:
Code:
linux_load="YES"
nvidia_load="YES"
nvidia-modeset_load="YES"
It's my /etc/rc.conf file where I use:
Code:
linux_enable="YES"
Tried your way, still the same problem.
 

Snurg

Daemon

Reaction score: 594
Messages: 1,349

I meant disabling the Horiz and Vert options, and instead use DPMS.

For more detailed troubleshooting info, can you please add this
Option "ModeDebug" "True"
to xorg.conf and post the output you get when trying to start X?
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

I meant disabling the Horiz and Vert options, and instead use DPMS.

For more detailed troubleshooting info, can you please add this
Option "ModeDebug" "True"
to xorg.conf and post the output you get when trying to start X?
It says "option" is not valid keyword in this section. o_O
(I had inserted the line at the bottom of the file).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,678
Messages: 39,278

Remove every trace of xorg.conf. You really don't need it and you don't need to create it. Then create /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf
Code:
Section "Device"
        Identifier  "Card0"
        Driver      "nvidia"
        #BusID       "PCI:2:0:0"
EndSection

And in /boot/loader.conf:
Code:
nvidia-modeset_load="YES"

The Linux module is NOT required for the driver to work. It's only needed if you need to have accelerated graphics on Linux applications.
 
OP
usernamekiran

usernamekiran

Member


Messages: 48

Remove every trace of xorg.conf. You really don't need it and you don't need to create it. Then create /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf
Code:
Section "Device"
        Identifier  "Card0"
        Driver      "nvidia"
        #BusID       "PCI:2:0:0"
EndSection

Still the same error. :(
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 12,678
Messages: 39,278

What's the error? Post your /var/log/Xorg.0.log to Pastebin, or a similar service, and provide the link here.
 
Top