# Nvidia driver



## Petar (Sep 16, 2017)

Hi all. I install freeBSD 11.1 few days ago, but still have some problems with drivers on graphic card. I check and seen that my nvidia driver is 340. When I install driver from pkg, there write "The most recent version of packages are already install" But graphic card didn't work
I add commands "echo ' nvidia_load="YES" >> /boot/loader.conf"  "echo ' linux_enable="YES" >> /etc/rc.conf" and " echo ' hint.agp.0.disable="1"' >> /boot/device.hint"
When I try to install driver from ports there write me " nvidia-driver-340-340.102requires kernel source files in /usr/src.
*** Error code 1"
I don't know what to do anymore. Can someone help me?


----------



## scottro (Sep 16, 2017)

https://forums.freebsd.org/threads/52311/ has worked for me, both with the 340 drivers and the newer ones.


----------



## rufwoof (Sep 16, 2017)

I also have 
`kld_list="nvidia"`
in /etc/rc.conf


----------



## vejnovic (Sep 16, 2017)

rufwoof said:


> kld_list="nvidia"


`kld_list="nvidia linux"`


----------



## rufwoof (Sep 16, 2017)

vejnovic said:


> `kld_list="nvidia linux"`


???

I have just `kld_list="nvidia"` as I'm also running the nvidia 340 based driver

echo 'kld_list="nvidia"' >> /etc/rc.conf
For nvidia drivers later than 367.35 this must be loaded in /etc/rc.conf:
echo 'kld_list="nvidia-modeset"' >> /etc/rc.conf
Using BSD loader or Linux Grub the driver must be loaded in loader.conf:
echo 'nvidia_load="YES"' >> /boot/loader.conf
For the latest nvivia driver (after 367.35) this must be loaded:
echo 'nvidia-modeset_load="YES"' >> /boot/loader.conf


----------



## Petar (Sep 16, 2017)

I try with all that right now but graphic card still doesn't work. May I must add kernel source in /usr/src


----------



## Petar (Sep 16, 2017)

I try all that right now, I add source too but still graphic card doesn't work. I don't what to do anymore


----------



## rufwoof (Sep 16, 2017)

I install freebsd twice ... I use one as a admin type choice and for online banking. For that I install a bare minimum of freebsd 11.1 and then pkg install xorg-minimal twm firefox-esr. After that add `dbus_enable="YES"` to /etc/rc.conf (no need for hald_enable nor linux_enable, no /etc/X11/xorg.conf) ... and just add 
	
	



```
firefox &
exec twm
```
 to ~/.xinitrc and run startx
Unaccelerated, but works for me (I don't load any addons/plugins and erase ~/.cache/mozilla and ~/.mozilla folders after using).

Give that a go and see if you can get to a gui/desktop without nvidia. If you can then its something wrong with how you've configured nvidia. If you can't even get to a gui that way then its something else. Note that twm is spartan and the default is a black screen on which you need to right mouse click and hold to pop the menu. Alternatively you might choose jwm or fluxbox instead of twm ... just change .xinitrc accordingly (exec jwm or exec fluxbox).


----------



## vejnovic (Sep 17, 2017)

rufwoof said:


> ???
> 
> I have just `kld_list="nvidia"` as I'm also running the nvidia 340 based driver
> 
> ...



I also use nvidia 340 based driver and not using package from FreeBSD repository. I build my own package with ports-mgmt/poudriere using default configuration options for x11/nvidia-driver-340.
This is part for nvidia driver from my `/etc/rc.conf`:

```
kld_list="tmpfs linux linprocfs linsysfs nullfs procfs fdescfs imgact_binmisc fuse if_bridge if_tap vmm nmdm coretemp"
linux_enable="YES"
dbus_enable="YES"
hald_enable="YES"
```
and from `/boot/loader.conf`

```
nvidia_load="YES"
```


----------



## rufwoof (Sep 17, 2017)

It would seem my following of installing nvidia instructions resulted in having nvidia being loaded in both /boot/loader.conf (nvidia_load) and /etc/rc.conf (kld_list). I've removed the /etc/rc.conf one now (kld_list was loading nothing else so I've removed that line from rc.conf). I am using fuse (for squashfuse i.e. mounting of squashfs files), but I also have that being loaded in /boot/loader.conf

After seeing your kld_list I had thought that perhaps I'd missed something in having so little in my kld_list, however I see that Poudriere requires kld_list="tmpfs linux linprocfs nullfs procfs fdescfsu" and I'm not using that.

Thanks.


----------



## Petar (Sep 17, 2017)

Today I try that too....but still doesn't work


----------



## antreas_32 (Sep 19, 2017)

Have you try to load the linux 64 binary

https://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html


----------



## SirDice (Sep 20, 2017)

The Linux kernel module (32 or 64 bit) is not required to be loaded for the driver to work. It's only needed for the driver to support Linux compatibility.


----------



## abishai (Sep 20, 2017)

I believe, recent nvidia cards are not supported by nvidia driver.


----------



## SirDice (Sep 20, 2017)

abishai said:


> I believe, recent nvidia cards are not supported by nvidia driver.


No, that's not correct. The FreeBSD driver is up to par with the Windows driver (it's actually the exact same driver, just a different wrapper around it).

Note however that there are different versions of the driver. Some older cards are only supported by the legacy driver versions. You can easily find out which one you need on the Geforce drivers page.


----------



## antreas_32 (Sep 20, 2017)

yes  i had the  same problem with my 9600 gt what about the nouveau driver i didn't tested


----------



## SirDice (Sep 21, 2017)

The nouveau driver has been removed some time ago because it failed to build properly.

x11-drivers/xf86-video-nouveau


```
IGNORE: is marked as broken: Does not build
```

The 9600GT needs the legacy driver: x11/nvidia-driver-340


----------



## Preetpal (Sep 21, 2017)

abishai said:


> I believe, recent nvidia cards are not supported by nvidia driver.



That's not true, I am currently using FreeBSD 11.1 with the latest NVidia driver with a GTX 1050TI (one of their latest graphics cards) on  a desktop machine and I have experienced no issues (Gnome 3 Desktop) with it (video playback works fine) when using it with a 4K monitor. Although I do not believe they support CUDA on FreeBSD unfortunately (which is a shame).


----------



## SirDice (Sep 21, 2017)

Preetpal said:


> Although I do not believe they support CUDA on FreeBSD unfortunately (which is a shame).


Yes, that's my understanding too. That's the only thing that's really "missing".


----------



## Petar (Sep 21, 2017)

antreas_32 said:


> Have you try to load the linux 64 binary
> 
> https://www.freebsd.org/doc/handbook/linuxemu-lbc-install.html


I add 32 binary freeBSD so I don't think i need 64 binary linux


----------



## Petar (Sep 21, 2017)

My card is 9600 GT too and I install nvidia 340 driver, but card doesn't work. Maybe I wrong something in settings


----------



## SirDice (Sep 22, 2017)

Set up the driver with an /usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf as shown in the handbook. Start X, if it doesn't work properly post your /var/log/Xorg.0.log to Pastebin (misc/pastebinit might be useful).


----------

