danielfullmer / nixos-nvidia-vgpu

NixOS NVIDIA vGPU Module
MIT License
57 stars 27 forks source link

Buid fails in nixOS 22.11 with Kernel 5.4.231 #8

Open Yeshey opened 1 year ago

Yeshey commented 1 year ago

Was trying to make this work on my nixOS machine, changed my kernel to 5.4 to make sure the environment was as close as possible to the tested one:

  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      (builtins.fetchTarball "https://github.com/danielfullmer/nixos-nvidia-vgpu/archive/master.tar.gz")
    ];

  boot.kernelPackages = pkgs.linuxPackages_5_4; # needed for this
  hardware.nvidia.vgpu.enable = true; # Enable NVIDIA KVM vGPU + GRID driver
  hardware.nvidia.vgpu.unlock.enable = true; # Unlock vGPU functionality on consumer cards using DualCoder/vgpu_unlock project.

Added the files NVIDIA-Linux-x86_64-460.32.04-vgpu-kvm.run and NVIDIA-Linux-x86_64-460.32.03-grid.run as the first error logs suggested with the command nix-store --add-fixed sha256 <filename>. But it seems to not be working in nixOS 22.11. I'm using flakes, but also tried in a VM without flakes and the error is the same

these are the error logs:

...
For full logs, run 'nix log /nix/store/qal4yqqph4hipk086jp744pmp72v4my7-nvidia-x11-460.32.04-460.32.03-5.4.231.drv'
...
> nix log /nix/store/qal4yqqph4hipk086jp744pmp72v4my7-nvidia-x11-460.32.04-460.32.03-5.4.231.drv
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
Creating directory NVIDIA-Linux-x86_64-460.32.03-grid
Verifying archive integrity... OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 460.32.03............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
source root is NVIDIA-Linux-x86_64-460.32.03-grid
cp: cannot create regular file 'kernel/common/inc//nv-vgpu-vfio-interface.h': No such file or directory

Could this be a problem related to the nix version?

(Also the link in "Additional Notes" in the README goes to a "PAGE NOT FOUND" error)

system info:

> nix-shell -p neofetch --run neofetch
          ▗▄▄▄       ▗▄▄▄▄    ▄▄▄▖            yeshey@nixos 
          ▜███▙       ▜███▙  ▟███▛            ------------ 
           ▜███▙       ▜███▙▟███▛             OS: NixOS 22.11.20230219.0cf4274 (Raccoon) x86_64 
            ▜███▙       ▜██████▛              Host: LENOVO LNVNB161216 
     ▟█████████████████▙ ▜████▛     ▟▙        Kernel: 5.4.231 
    ▟███████████████████▙ ▜███▙    ▟██▙       Uptime: 1 hour, 24 mins 
           ▄▄▄▄▖           ▜███▙  ▟███▛       Packages: 1885 (nix-system), 1917 (nix-user), 25 (flatpak) 
          ▟███▛             ▜██▛ ▟███▛        Shell: bash 5.2.15 
         ▟███▛               ▜▛ ▟███▛         Resolution: 1920x1080, 1920x1080 
▟███████████▛                  ▟██████████▙   DE: Plasma 
▜██████████▛                  ▟███████████▛   WM: KWin 
      ▟███▛ ▟▙               ▟███▛            Icons: breeze-dark [GTK2/3] 
     ▟███▛ ▟██▙             ▟███▛             Terminal: .konsole-wrappe 
    ▟███▛  ▜███▙           ▝▀▀▀▀              CPU: Intel i7-9750H (12) @ 4.500GHz 
    ▜██▛    ▜███▙ ▜██████████████████▛        GPU: NVIDIA GeForce RTX 2060 Mobile 
     ▜▛     ▟████▙ ▜████████████████▛         Memory: 14204MiB / 15924MiB 
           ▟██████▙       ▜███▙
          ▟███▛▜███▙       ▜███▙                                      
         ▟███▛  ▜███▙       ▜███▙                                     
         ▝▀▀▀    ▀▀▀▀▘       ▀▀▀▘
> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.231, NixOS, 22.11 (Raccoon), 22.11.20230219.0cf4274`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.11.1`
 - channels(root): `"nixos"`
 - channels(yeshey): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Referals

@danielfullmer

Yeshey commented 1 year ago

Can confirm that builds fine in nixOS 21.05 (where nix version is 2.3.16)

> nix --version          
nix (Nix) 2.3.16
Yeshey commented 1 year ago

One problem seems to be that the folder is one level up too many. It's like this now:

.
|-- NVIDIA-Linux-x86_64-460.32.03-grid
|   |-- 10_nvidia.json
|   |-- 10_nvidia_wayland.json
|   |-- 32
|   |   |-- libEGL.so.1.1.0
|   |   |-- libEGL_nvidia.so.460.32.03
|   |   |-- libGL.so.1.7.0
|   |   |-- libGLESv1_CM.so.1.2.0
|   |   |-- libGLESv1_CM_nvidia.so.460.32.03
|   |   |-- libGLESv2.so.2.1.0
|   |   |-- libGLESv2_nvidia.so.460.32.03
|   |   |-- libGLX.so.0
|   |   |-- libGLX_nvidia.so.460.32.03
|   |   |-- libGLdispatch.so.0
|   |   |-- libOpenCL.so.1.0.0
|   |   |-- libOpenGL.so.0
|   |   |-- libcuda.so.460.32.03
|   |   |-- libglvnd_install_checker
|   |   |   |-- glvnd_check
|   |   |   `-- libGLX_installcheck.so.0

When in the 21.05 version it is like this:

.
|-- 10_nvidia.json
|-- 10_nvidia_wayland.json
|-- 32
|   |-- libEGL.so.1.1.0
|   |-- libEGL_nvidia.so.460.32.03
|   |-- libGL.so.1.7.0
|   |-- libGLESv1_CM.so.1.2.0
|   |-- libGLESv1_CM_nvidia.so.460.32.03
|   |-- libGLESv2.so.2.1.0
|   |-- libGLESv2_nvidia.so.460.32.03
|   |-- libGLX.so.0
|   |-- libGLX_nvidia.so.460.32.03
|   |-- libGLdispatch.so.0
|   |-- libOpenCL.so.1.0.0
|   |-- libOpenGL.so.0
|   |-- libcuda.so.460.32.03
|   |-- libglvnd_install_checker
|   |   |-- glvnd_check
|   |   `-- libGLX_installcheck.so.0
|   |-- libnvcuvid.so.460.32.03
|   |-- libnvidia-allocator.so.460.32.03
|   |-- libnvidia-compiler.so.460.32.03

after fixing that though, by moving the contents one level up, I get another error:

setting SOURCE_DATE_EPOCH to timestamp 1609097498 of file NVIDIA-Linux-x86_64-460.32.03-grid/.manifest
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
applying patch /nix/store/k8fdj3kbshy7nz2ri0sb3w3nfpal4jfb-nvidia-vgpu-merge.patch
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -Naur NVIDIA-Linux-x86_64-460.32.03-grid/kernel/conftest.sh NVIDIA-Linux-x86_64-460.32.03-grid-new/kernel/conftest.sh
|--- NVIDIA-Linux-x86_64-460.32.03-grid/kernel/conftest.sh      2020-12-27 11:31:38.000000000 -0800
|+++ NVIDIA-Linux-x86_64-460.32.03-grid-new/kernel/conftest.sh  2021-04-16 20:45:13.893946912 -0700
--------------------------
File to patch: 
Skip this patch? [y] 
Skipping patch.
2 out of 2 hunks ignored

Don't know what's this patchPhase, can't find it in this repo. And the patch seems to be in the referenced path /nix/store/k8fdj3kbshy7nz2ri0sb3w3nfpal4jfb-nvidia-vgpu-merge.patch, don't know why it's not finding it if it is

Yeshey commented 1 year ago

I made Vgpu work for me in a very hacky way. My module is not in a very good state so I don't dare to make a pull request, it needs a nix guy to check and fix a lot of stuff about it. But it is a better bet on making vgpu work on recent versions of nixOS than this repo https://github.com/Yeshey/nixos-nvidia-vgpu_nixOS22.11_WIP/tree/master