# NVidia graphics libraries and programs (Linux version) ?



## ziomario (Sep 8, 2021)

Hello.

someone knows when we should use this driver ?


```
marietto:~/Downloads/NVIDIA-FreeBSD-x86_64-470.63.01 # pkg search nvidia
linux-nvidia-libs-460.84       NVidia graphics libraries and programs (Linux version)
```


----------



## zirias@ (Sep 8, 2021)

Most likely, for running Linux binaries using OpenGL et al on a system with nvidia graphics.

BTW, your prompt suggests you downloaded FreeBSD drivers directly from NVidia. Better use the port/package instead.


----------



## ziomario (Sep 8, 2021)

I don't understand the case. You mean that I can install linux inside a jail and then I can run xorg + a desktop manager + the linux version of the nvidia driver ? Yeah,I tried to install it from the nvidia website,but it didn't work :

```
In file included from nvidia_acpi.c:13:


./nv-freebsd.h:17:2: error: This driver does not support FreeBSD 14.x/-CURRENT!
#error This driver does not support FreeBSD 14.x/-CURRENT!
```

BTW I'm not using FreeBSD 14/current,but 13 Release : 


```
marietto:~/Downloads/NVIDIA-FreeBSD-x86_64-470.63.01 # freebsd-version
13.0-RELEASE-p4
```

So,the nvidia installer is not able to detect correctly the version of Freebsd that's running ?


----------



## SirDice (Sep 8, 2021)

Use x11/nvidia-driver. There's no point in using the driver that came from the NVidia website (it's the exact same version).


----------



## ziomario (Sep 8, 2021)

yeah,I've installed the driver from the ports,since the one that comes from the nvidia website can't be installed. It detects a wrong version of Freebsd and it refuses to be installed. Anyway,the version of the driver taken from nvidia website is : 470.63.01,the version of the driver taken from ports is : nvidia-driver-460.84. Versions are different.

marietto:~/Downloads/NVIDIA-FreeBSD-x86_64-470.63.01 # pkg search nvidia


```
linux-nvidia-libs-460.84       NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-304-304.137  NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-340-340.108  NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-390-390.143  NVidia graphics libraries and programs (Linux version)
nvidia-driver-460.84           NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-304-304.137_9    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-340-340.108_3    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-390-390.143_1    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-hybrid-graphics-0.5     NVIDIA secondary GPU configuration - Optimus Technology support
nvidia-hybrid-graphics-390-0.5 NVIDIA secondary GPU configuration - Optimus Technology support
nvidia-secondary-driver-460.84_1 NVidia graphics card binary drivers for hardware OpenGL rendering on secondary device
nvidia-secondary-driver-390-390.143_1 NVidia graphics card binary drivers for hardware OpenGL rendering on secondary device
nvidia-settings-460.73.01_2    Display Control Panel for X NVidia driver
nvidia-texture-tools-2.0.8.1_24 Texture Tools with support for DirectX 10 texture formats
nvidia-xconfig-460.73.01       Tool to manipulate X configuration files for the NVidia driver
nvidia_gpu_prometheus_exporter-g20181028_1 NVIDIA GPU Prometheus exporter
```


----------



## zirias@ (Sep 8, 2021)

It always takes some time to properly port/package the mess coming from upstream  – the port will also be updated eventually.



ziomario said:


> I don't understand the case. You mean that I can install linux inside a jail and then I can run xorg + a desktop manager + the linux version of the nvidia driver ?


Not necessarily. You could just run a Linux binary using the "standard" Centos7 userland in /compat/linux that needs an OpenGL library. It should probably use the nvidia one to take advantage of the graphics card.


----------



## SirDice (Sep 8, 2021)

ziomario said:


> Anyway,the version of the driver taken from nvidia website is : 470.63.01,the version of the driver taken from ports is : nvidia-driver-460.84. Versions are different.


Update your ports tree. It's 460.63.01.






						ports - FreeBSD ports tree
					






					cgit.freebsd.org
				




The quarterly package repository still has 460.84 though, latest has 470.63.01_1.


----------



## eternal_noob (Sep 8, 2021)

SirDice said:


> Update your ports tree. It's 460.63.01


Typo there, it's 470.63.01 in ports.


----------



## SirDice (Sep 8, 2021)

Oops. Yes, it's 470, not 460.


----------



## ziomario (Sep 8, 2021)

# mkdir -p /usr/local/etc/pkg/repos
# cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/FreeBSD.conf

Edited the file /usr/local/etc/pkg/repos/FreeBSD.conf and added the string _quarterly_ in the url: line.

FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

And finally run this command to update from the new repository metadata.

# pkg update -f

Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01    
Fetching packagesite.txz: 100%    6 MiB   6.6MB/s    00:01    
Processing entries: 100%
FreeBSD repository update completed. 30746 packages processed.
All repositories are up to date.

BUT the 470 version is not there :

marietto:/etc/X11 # pkg search nvidia


```
linux-nvidia-libs-460.84       NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-304-304.137  NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-340-340.108  NVidia graphics libraries and programs (Linux version)
linux-nvidia-libs-390-390.143  NVidia graphics libraries and programs (Linux version)
nvidia-driver-460.84           NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-304-304.137_9    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-340-340.108_3    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-driver-390-390.143_1    NVidia graphics card binary drivers for hardware OpenGL rendering
nvidia-hybrid-graphics-0.5     NVIDIA secondary GPU configuration - Optimus Technology support
nvidia-hybrid-graphics-390-0.5 NVIDIA secondary GPU configuration - Optimus Technology support
nvidia-secondary-driver-460.84_1 NVidia graphics card binary drivers for hardware OpenGL rendering on secondary device
nvidia-secondary-driver-390-390.143_1 NVidia graphics card binary drivers for hardware OpenGL rendering on secondary device
nvidia-settings-460.73.01_2    Display Control Panel for X NVidia driver
nvidia-texture-tools-2.0.8.1_24 Texture Tools with support for DirectX 10 texture formats
nvidia-xconfig-460.73.01       Tool to manipulate X configuration files for the NVidia driver
nvidia_gpu_prometheus_exporter-g20181028_1 NVIDIA GPU Prometheus exporter
```

maybe I can use latest instead of quarterly ?


----------



## SirDice (Sep 8, 2021)

SirDice said:


> The quarterly package repository still has 460.84 though, latest has 470.63.01_1.



/usr/local/etc/pkg/repos/FreeBSD.conf:

```
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}
```


----------



## zirias@ (Sep 8, 2021)

Do you want the latest driver for a new feature introduced there or "just because"? If the latter, think about it. I guess the general decision whether you want "latest" or "quarterly" packages is much more important.


----------



## ziomario (Sep 8, 2021)

ok. latest works great.


----------



## eternal_noob (Sep 8, 2021)

Zirias said:


> I guess the general decision whether you want "latest" or "quarterly" packages is much more important.


Sometimes the package in quarterly is more recent than the one in latest. For example sysutils/u-boot-rpi-arm64 for aarch64 architecture. Got fooled by this one already.


----------



## ziomario (Sep 8, 2021)

Zirias said:


> Do you want the latest driver for a new feature introduced there or "just because"? If the latter, think about it. I guess the general decision whether you want "latest" or "quarterly" packages is much more important.



good observation. but sometimes to accomplish a task it needs the latest features added. And I'm making an experiment. I would like to passthru my rtx 2080 ti to a linux guest. Until now I haven't been able to do that because the nvidia driver installed inside the VM has some problem. But I've thought : maybe it does not work because I haven't installed the Nvidia driver on the FreeBSD host OS. For example In Linux I should do it even if the primary graphic card is the intel. In Linux the nvidia driver should be installed and the next steps are to put it in the blacklist and to give to linux some parameters that the nvidia mechanisms need to put the card in an inactive state. Probably we don't need the driver,but some components that are inside the package. So I need the latest version of the nvidia driver to be sure that it supports the latest fixes.  And I will use this xorg.conf file :

taken from here : https://download.nvidia.com/XFree86/Linux-x86_64/465.31/README/randr14.html



```
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Inactive "nvidia"
    Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
EndSection

Section "Device"
    Identifier "intel"
    Driver "modesetting"
    BusID "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection
```


It seem perfect for this situation,according to what is written by Nvidia :

To use the NVIDIA driver as an RandR 1.4 output sink provider, also known as “Reverse PRIME”, the X server needs to be configured to use the “modesetting” driver for its primary screen and to use the NVIDIA driver for the other graphics device.

It seems that I will continue to use the intel driver,but the nvidia driver will be kept as secondary. Exactly what I want to do.


----------



## SirDice (Sep 8, 2021)

ziomario said:


> I would like to passthru my rtx 2080 ti to a linux guest. Until now I haven't been able to do that because the nvidia driver installed inside the VM has some problem. But I've thought : maybe it does not work because I haven't installed the Nvidia driver on the FreeBSD host OS.


If you passthrough a card or device to the VM then the host doesn't have access to it anymore. So this is an exercise in futility.


----------



## ziomario (Sep 8, 2021)

SirDice said:


> If you passthrough a card or device to the VM then the host doesn't have access to it anymore. So this is an exercise in futility.





ziomario said:


> good observation. but sometimes to accomplish a task it needs the latest features added. And I'm making an experiment. I would like to passthru my rtx 2080 ti to a linux guest. Until now I haven't been able to do that because the nvidia driver installed inside the VM has some problem. But I've thought : maybe it does not work because I haven't installed the Nvidia driver on the FreeBSD host OS. For example In Linux I should do it even if the primary graphic card is the intel. In Linux the nvidia driver should be installed and the next steps are to put it in the blacklist and to give to linux some parameters that the nvidia mechanisms need to put the card in an inactive state. Probably we don't need the driver,but some components that are inside the package. So I need the latest version of the nvidia driver to be sure that it supports the latest fixes.  And I will use this xorg.conf file :
> 
> taken from here : https://download.nvidia.com/XFree86/Linux-x86_64/465.31/README/randr14.html
> 
> ...



I'm not sure of this. At least on Linux the nvidia driver should be installed and then put it in the blacklist. Why this ? Maybe because inside the nvidia driver package there isn't only the driver,but different components that should be there. On linux these components (some of them are related to the power management of the card) are handled by Linux inside the proper configuration files. I suppose that I should do the same thing on FreeBSD.


----------



## ziomario (Sep 8, 2021)

The first part of  my plan worked. This xorg.conf file has been accepted :


```
Section "ServerLayout"
    Identifier "layout"
    Screen 0 "intel"
    Inactive "nvidia"
    Option "AllowNVIDIAGPUScreens"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
EndSection

Section "Screen"
    Identifier "nvidia"
    Device "nvidia"
EndSection

Section "Device"
    Identifier "intel"
    Driver "intel"
    BusID "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "intel"
    Device "intel"
EndSection
```


----------

