Nvidia drivers do not install with Kernel 4.6

No issues at all with 4.5.x but none of 4.6 Kernels allow Nvidia drivers to install.

Also, Nvidia drivers are not clear about which ones DO and which ones DO NOT include Vulkan.

https://devtalk.nvidia.com/default/topic/926824/linux/364-1-2-5-won-t-compile-against-latest-kernel-git-tree-patches-for-4-6-0-rc3-included-/1

It’s realy hard to use the search-function of the forum.

Hey man, pay attention better to what I wrote. I said 4.6, not 4.6 RC3. Ok?

Here are parts of the log for the actual developers and not some trolling Towo guy.
I’m using Kernel 4.6 with NVIDIA drivers 364.16, 364.19 and 361.42. All have the same effect.

CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_lock_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_perf_utils_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_kvmalloc_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_pmm_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_perf_events_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_perf_module_test.o
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_page_tree_test.c: In function ‘pascal_test_page_tree’:
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_page_tree_test.c:1600:1: warning: the frame size of 1232 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_page_tree_test.c: In function ‘kepler_test_page_tree’:
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_page_tree_test.c:1548:1: warning: the frame size of 1200 bytes is larger than 1024 bytes [-Wframe-larger-than=]
}
^
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_get_rm_ptes_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_fault_buffer_flush_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm/uvm8_mmu_test.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-modeset/nvidia-modeset-linux.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-drv.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-utils.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-crtc.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-encoder.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-connector.o
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-drv.c:67:18: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.fb_create = nvidia_drm_framebuffer_create,
^
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-drv.c:67:18: note: (near initialization for ‘nv_mode_config_funcs.fb_create’)
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-gem.o
cc1: some warnings being treated as errors
/home/joel/src/linux-4.6/scripts/Makefile.build:291: recipe for target ‘/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-drv.o’ failed
make[3]: *** [/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-drv.o] Error 1
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-fb.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-modeset.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-mmap.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.o
CC [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nv-pci-table.o
ld -r -o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-interface.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-frontend.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-instance.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-acpi.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-chrdev.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-cray.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-dma.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-gvi.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-i2c.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-mempool.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-mmap.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-p2p.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-pat.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-procfs.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-usermap.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-vm.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-vtophys.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/os-interface.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/os-mlock.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/os-pci.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/os-registry.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/os-usermap.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-modeset-interface.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv-pci-table.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nv_uvm_interface.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nvlink_linux.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/nvlink_pci.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/ebridge_linux.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia/ibmnpu_linux.o
ld -r -o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-modeset/nv-modeset-interface.o /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-modeset/nvidia-modeset-linux.o
LD [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia.o
LD [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-uvm.o
LD [M] /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-modeset.o
In file included from /home/joel/src/linux-4.6/arch/x86/include/asm/processor.h:15:0,
from /home/joel/src/linux-4.6/arch/x86/include/asm/cpufeature.h:4,
from /home/joel/src/linux-4.6/arch/x86/include/asm/thread_info.h:52,
from /home/joel/src/linux-4.6/include/linux/thread_info.h:54,
from /home/joel/src/linux-4.6/arch/x86/include/asm/preempt.h:6,
from /home/joel/src/linux-4.6/include/linux/preempt.h:59,
from /home/joel/src/linux-4.6/include/linux/spinlock.h:50,
from /home/joel/src/linux-4.6/include/linux/seqlock.h:35,
from /home/joel/src/linux-4.6/include/linux/time.h:5,
from /home/joel/src/linux-4.6/include/linux/stat.h:18,
from /home/joel/src/linux-4.6/include/linux/module.h:10,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:23:
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c: In function ‘nvidia_drm_lock_user_pages’:
/home/joel/src/linux-4.6/arch/x86/include/asm/current.h:17:17: warning: passing argument 1 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
#define current get_current()
^
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:124:35: note: in expansion of macro ‘current’
pages_pinned = get_user_pages(current, mm,
^
In file included from /home/joel/src/linux-4.6/include/linux/scatterlist.h:7:0,
from /home/joel/src/linux-4.6/include/linux/dma-mapping.h:11,
from /home/joel/src/linux-4.6/include/drm/drmP.h:37,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-os-interface.h:32,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:27:
/home/joel/src/linux-4.6/include/linux/mm.h:1266:6: note: expected ‘long unsigned int’ but argument is of type ‘struct task_struct *’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:124:44: warning: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast [-Wint-conversion]
pages_pinned = get_user_pages(current, mm,
^
In file included from /home/joel/src/linux-4.6/include/linux/scatterlist.h:7:0,
from /home/joel/src/linux-4.6/include/linux/dma-mapping.h:11,
from /home/joel/src/linux-4.6/include/drm/drmP.h:37,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-os-interface.h:32,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:27:
/home/joel/src/linux-4.6/include/linux/mm.h:1266:6: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:125:57: warning: passing argument 5 of ‘get_user_pages’ makes pointer from integer without a cast [-Wint-conversion]
address, pages_count, write, force,
^
In file included from /home/joel/src/linux-4.6/include/linux/scatterlist.h:7:0,
from /home/joel/src/linux-4.6/include/linux/dma-mapping.h:11,
from /home/joel/src/linux-4.6/include/drm/drmP.h:37,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-os-interface.h:32,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:27:
/home/joel/src/linux-4.6/include/linux/mm.h:1266:6: note: expected ‘struct page **’ but argument is of type ‘int’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:125:64: warning: passing argument 6 of ‘get_user_pages’ makes pointer from integer without a cast [-Wint-conversion]
address, pages_count, write, force,
^
In file included from /home/joel/src/linux-4.6/include/linux/scatterlist.h:7:0,
from /home/joel/src/linux-4.6/include/linux/dma-mapping.h:11,
from /home/joel/src/linux-4.6/include/drm/drmP.h:37,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-os-interface.h:32,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:27:
/home/joel/src/linux-4.6/include/linux/mm.h:1266:6: note: expected ‘struct vm_area_struct **’ but argument is of type ‘int’
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:124:20: error: too many arguments to function ‘get_user_pages’
pages_pinned = get_user_pages(current, mm,
^
In file included from /home/joel/src/linux-4.6/include/linux/scatterlist.h:7:0,
from /home/joel/src/linux-4.6/include/linux/dma-mapping.h:11,
from /home/joel/src/linux-4.6/include/drm/drmP.h:37,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-os-interface.h:32,
from /tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.c:27:
/home/joel/src/linux-4.6/include/linux/mm.h:1266:6: note: declared here
long get_user_pages(unsigned long start, unsigned long nr_pages,
^
/home/joel/src/linux-4.6/scripts/Makefile.build:291: recipe for target ‘/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.o’ failed
make[3]: *** [/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel/nvidia-drm/nvidia-drm-linux.o] Error 1
make[3]: Target ‘__build’ not remade because of errors.
/home/joel/src/linux-4.6/Makefile:1428: recipe for target ‘module/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel’ failed
make[2]: *** [module/tmp/selfgz3493/NVIDIA-Linux-x86_64-364.19/kernel] Error 2
make[2]: Target ‘modules’ not remade because of errors.
make[2]: Leaving directory ‘/home/joel/src/linux-4.6’
Makefile:146: recipe for target ‘sub-make’ failed
make[1]: *** [sub-make] Error 2
make[1]: Target ‘modules’ not remade because of errors.
make[1]: Leaving directory ‘/home/joel/src/linux-4.6’
Makefile:81: recipe for target ‘modules’ failed
make: *** [modules] Error 2
ERROR: The nvidia kernel module was not created.
ERROR: Installation has failed. Please see the file ‘/var/log/nvidia-installer.log’ for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.

Where is your problem with understanding?
If the module can’t build against 4.6-rcX, you can be sure it will not build against the released kernel.
As long nvidia does not release an updated driver, you have to patch the source yurself!

My job is not to fix it, my job is to report it. New Kernel released, Nvidia drivers will not install now, I report it to Nvidia. I’m done. I have done my job and I will accept my pat on the back for my effort.

You’re welcome.

Hey guys, I successfully build & run nvidia driver with these patch. Tested on ArchLinux x86_64. Could be useful for someone else, so I just post it here. Apply this patch like these:

patch -p1 -i file.patch

Hey, i just updated my kernel and i’m having this problem too.

Is there a way to apply that .patch file to the driver downloaded from NVidia’s website (the binary .run file)?

Edit: nvm found it, its the --apply-patch option

Hey thanks Prototik! I’ll try it.

Jcarpenter2: You can do ./NVIDIADRIVERxxxx.run -x to extract it and then edit the code there but the above seems to be a patch for the actual Kernel source code. I guess I could do either one but I rather the Nvidia driver get fixed instead of me having to fuss with the Kernel. I have experienced dozens of Kernel cycles and I think it has broken the Nvidia driver three times now (major version releases) but Nvidia normally fixes it. This time and the last time took way too long though.

Many thanks for this. Patched the DKMS driver on my Arch install and rebuilt it without a problem.

No, you’re wrong. This patch applying on nvidia kernel module sources (extracted from blob with -x flag), not kernel itself. I used official Linux 4.6 kernel from repository.

Hi,

does anyone have a similar patch for driver 340.96 for GeForce GT335M?

Thanks for any help!

Kind regards,

Adrixan

So, I have 4.5.* installed on my laptop using Linux Mint 17.3 MATE, then I installed 364.19, rebooted, both password screens – 1st screen: I use encryption; 2nd screen: is the normal login applet – had oversized entry boxes. When I finally got to the desktop, the display was at 640x480 @ 73Hz and no way to change that…I tried with the display applet and it doesn’t let me choose any settings, I don’t know any other way. So, I am back on the default nouveau driver.

The latest driver, 367.35, still fails with kernel 4.6. The patch mentioned above (thanks for that) fails with this driver as well. I tried manually applying the patch but it still wouldn’t compile. Interestingly, the Nvidia devs seem to have taken this issue into account by adding a variable NV_DRM_MODE_FB_CMD2_T in the relevant spots yet the driver still fails to compile and seems to give the same error log messages as previous drivers.

Can someone give step by step instructions on how to patch the driver?
I have saved this http://pastebin.com/hJ2GuLdB as a text file and name it “patch”, moved from download directory and placed in home directory.

I know i must open terminal and use command
patch -p1 -i file.patch

But i dont know the steps in between ??

Linux kali 4.6.0-kali1-amd64 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86_64 GNU/Linux
Running brand new install of Kali 2016.1 fully updated

00:02.0 VGA compatible controller [0300]: InnoTek Systemberatung GmbH VirtualBox Graphics Adapter [80ee:beef]
I have a P55 GTX 970M

Downloaded 367.35 from nvidia

Cant build kernel, stuck at 5%

I have tried all the guides and 5 hours later i found this thread. seems to be the solution but i need help.

I have previously done this

apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
apt-get install -y linux-headers-$(uname -r)
sed ‘s/quiet/quiet nouveau.modeset=0/g’ -i /etc/default/grub
update-grub
reboot

Switch to virtual console (Ctr+Alt+F2)
service gdm3 stop

sudo sh NVIDIA-Linux-x86_64-367.35.run OR
./NVIDIA-Linux-x86_64-346.72.run

and then reboot after installer failed (breaks Kali and have to re-install)
also tried after installer finishes with errors running

nvidia xconfig install
nvidia xconfig
reboot

@NeuKali

-apply-patch [Patch]
  Apply the patch 'Patch' to the kernel interface files included
  in the .run file, remove any precompiled kernel interfaces
  and then repackage the .run file.  The new .run file will be
  placed in the current directory and the string "-custom"
  appended to its name, unless already present, to distinguish it
  from the original .run file.
$ ./NVIDIA-Linux-x86_64-367.35.run --apply-patch [Patch]

For the future please check

-A, --advanced-options

Thank you blablo, i have only been using Linux for 1 day. I have 0 experience with coding and how to navigate it. I am learning as i go. Please treat me like i need baby steps.

i am not sure why your replies are in 7 different echo’s but can you please dump it down a little for me.

So i need to download 367.35 and what patch do i use, the same one in this thread.

Thank you greatly.

Please see : http://us.download.nvidia.com/XFree86/Linux-x86/367.35/README/index.html
https://devtalk.nvidia.com/default/topic/522835/linux/if-you-have-a-problem-please-read-this-first/
https://forums.kali.org/showthread.php?27288-Guide-Install-any-version-of-NVIDIA-drivers-on-KALI-SANA-2-0-(Solved)

[/quote]

Please see : http://us.download.nvidia.com/XFree86/Linux-x86/367.35/README/index.html
https://devtalk.nvidia.com/default/topic/522835/linux/if-you-have-a-problem-please-read-this-first/
https://forums.kali.org/showthread.php?27288-Guide-Install-any-version-of-NVIDIA-drivers-on-KALI-SANA-2-0-(Solved)

[/quote]

I have read them all, i must be missing something as no one says exactly what the code is… or explains what each part does.

So now i see that when you said check
-A, --advanced-options

I had no idea what i was supposed to do with that… putting -A at the end of the downloaded 364.19.run file shows me 20 pages of different commands to run

./NVIDIA-Linux-x86_64-364.19.run -A

Even the ./ part before the nvidia is not always obvious but that means the home directory and not going to work if the file is still in the download folder…

-x, --extract-only
Extract the contents of ./NVIDIA-Linux-x86_64-364.19.run, but do not
run ‘nvidia-installer’.

so the command is
./NVIDIA-Linux-x86_64-364.19.run -x

so then i get a folder of the download.run file so i can see the contents

Now i have in my home director
extracted folder called
NVIDIA-Linux-x86_64-364

A text document with code to patch the Nvidia 364 driver called
nvidia-patch-364.19_4.6.patch.txt

In command prompt to change the directory im applying commands within the extracted folder i use
cd NVIDIA-Linux-x86_64-364.19

But now i dont know the command to tell the system to apply the patch.txt onto the driver… ?

–apply-patch [Patch]
Apply the patch ‘Patch’ to the kernel interface files included
in the .run file

So what is [Patch], is that saying insert the name of the .txt patch file ie
–apply-patch [nvidia-patch-364.19_4.6.patch.txt] or without brackets i assume
–apply-patch nvidia-patch-364.19_4.6.patch.txt

Well i tried that in the ./ and cd NVIDIA-Linux-x86_64-364.19 directory and nothing happens

you wrote
$ ./NVIDIA-Linux-x86_64-367.35.run --apply-patch [Patch]

and the original guy wrote (i cant find any refrence what -p1 means)
patch -p1 -i file.patch

And on another link i have seen
patch -p1 < …/nvidia-patch-364.19_4.6.patch

But I am not doing something right. It must be so simple once you know… please help fill the missing piece…

Once it is patched do i then run ./nvidia-installer from the ./ home directory or the cd NVIDIA folder dir

Using
patch -p1 -nvidia-patch-364.19_4.6.patch.txt

gives me

GNU patch 2.7.5
Copyright © 2003, 2009-2012 Free Software Foundation, Inc.
Copyright © 1988 Larry Wall

License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Larry Wall and Paul Eggert

Using
./NVIDIA-Linux-x86_64-364.19.run --apply-patch nvidia-patch-364.19_4.6.patch.txt

Gives me

Verifying archive integrity… OK
Uncompressing NVIDIA Accelerated Graphics Driver for Linux-x86_64 364.19…
(Stripping trailing CRs from patch; use --binary to disable.)
can’t find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:

|— a/kernel/nvidia-drm/nvidia-drm-fb.c

+++ b/kernel/nvidia-drm/nvidia-drm-fb.c

File to patch:

Now I noticed :)

How to Install Kali Linux 2016.1 on VirtualBox :
https://www.youtube.com/watch?v=b5oT3gZp_F8

Please see https://forums.virtualbox.org/viewtopic.php?f=6&t=69278