PDA

View Full Version : Install Nvidia 340.76 Driver in Kali Linux 2.0



ColForbin
2015-08-13, 15:27
I have an older laptop in which the usual methods of installing an Nvidia driver do not work. The last driver supporting the laptop's gpu is 340.76. In case anyone runs across this problem, I hope this will help. References are at the end.

- Install Kali

- Install kernel headers, and dkms

apt-get update
apt-get dist-upgrade
apt-get install -y linux-headers-$(uname -r) dkms

- Download Nvidia driver installation, and change its permissions to executable

wget http://us.download.nvidia.com/XFree86/Linux-x86_64/340.76/NVIDIA-Linux-x86_64-340.76.run
chmod +x NVIDIA-Linux-x86_64-340.76.run

- Prevent nouveau from loading

sed 's/quiet/quiet nouveau.modeset=0/g' -i /etc/default/grub
update-grub
reboot

- Once rebooted, switch to a virtual console (ctrl+alt+f1 for instance) and stop the gdm3 service

service gdm3 stop

- Run the nvidia driver installation

./NVIDIA-Linux-x86_64-340.76.run

- During the installation, choose yes to register the kernel module with DKMS, and no to install 32-bit compatibility libraries. The installation errors out. This is fine

- Edit /usr/src/nvidia-340.76/nv-pat.c, then use dkms to fix things up, then use nvidia-xconfig to generate an /etc/X11/xorg.conf file, then reboot

nano /usr/src/nvidia-340.76/nv-pat.c
- "about 35 line change "read_cr4" to "__read_cr4" and "write_cr4" to "__write_cr4" or copy-paste:"

static inline void nv_disable_caches(unsigned long *cr4)
{
unsigned long cr0 = read_cr0();
write_cr0(((cr0 & (0xdfffffff)) | 0x40000000));
wbinvd();
*cr4 = __read_cr4();
if (*cr4 & 0x80) __write_cr4(*cr4 & ~0x80);
__flush_tlb();
}

static inline void nv_enable_caches(unsigned long cr4)
{
unsigned long cr0 = read_cr0();
wbinvd();
__flush_tlb();
write_cr0((cr0 & 0x9fffffff));
if (cr4 & 0x80) __write_cr4(cr4);
}


sudo dkms autoinstall -k 4.0.0-kali1-amd64 -m nvidia-340 -v 340.76
nvidia-xconfig
reboot

- And, you should be ready to drive on.

References:
http://docs.kali.org/general-use/install-nvidia-drivers-on-kali-linux
https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-304-updates/+bug/1431278
https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-304-updates/+bug/1431278/comments/6

raditude
2015-08-13, 22:20
Thanks for the tutorial!

I followed these instructions, however it failed. I was able however to simply download (from www.nvidia.com) driver version 346.72, which worked, and it worked without having to edit the "nv-pat.c" file. This was on an HP laptop with a K3100M GPU.

dciphr
2015-08-14, 04:54
Has anyone tried using apt-get install nvidia-kernel-dkms? I get a 404 not found from the sana repositories.

Ryan
2015-08-14, 11:23
i tried nvidia-kernel-dkms and it succeed , but after reboot a white screen came up with " Oops , Somthing Went Wrong " and thers a logoff button there . anyone else havin the same problem ?

raditude
2015-08-14, 15:53
Yes I had originally attempted the nvidia-kernel-dkms, however it points to *-2kali_amd64.deb, which is for Kali v1, the repos have it listed as -3_amd64.deb (or at least on 8/11/2015 when I did this), and there were about a dozen packages that all listed the same type of issue. I worked my way through all of them, and did get it to install, however when I rebooted I had an issue as well. This tutorial has worked well so far with Kali v2. If you try to install kali-linux-gpu (which includes some of the same packages) it will actually fail as it is looking for version 1.67, yet the repos only have version 1.55. I am hopeful that all of the repos will get upgraded with the version 2 packages before too long.

drapheus
2015-08-16, 02:07
After installing Nvidia drivers it crashed the GUI. When I restarted the last time, GDM3 was blank with a flashing cursor.

aetos
2015-08-16, 04:50
After installing Nvidia drivers it crashed the GUI. When I restarted the last time, GDM3 was blank with a flashing cursor.

1.ctrl+alt+F1

login:user pass

2.nvidia-xconfig

3.reboot

drapheus
2015-08-16, 20:43
1.ctrl+alt+F1

login:user pass

2.nvidia-xconfig

3.reboot

unfortunately it didn't work. :(
Same thing on a fresh install and the only change was nvidia driver install.

drewsky
2015-08-17, 08:05
****, This technique posted by ColForbin worked flawless on 1.x

Now i guess i will hang with nouveau till a fix makes itself known.

Quiet sure my card gets no dice in this 2.0 version


02:00.0 VGA compatible controller: NVIDIA Corporation G96 [GeForce 9500 GT] (rev a1)

SiiXFX
2015-08-20, 20:25
I installed the driver this way..

1.

apt-get update
apt-get dist-upgrade
apt-get install -y linux-headers-$(uname -r) dkms
2.

Download the newest driver from the offical nvidia website.

3.

sed 's/quiet/quiet nouveau.modeset=0/g' -i /etc/default/grub
update-grub
reboot

4.

You coming to the login screen. Just don't log in. Press CTRL+ALT+F1

5.

Login in with "root" and your password.

6.

service gdm3 stop

8.

Cd to the place where the nvidia drive is. And..

sudo bash NVIDIA-Linux-x86_64-XXX.XX.run
reboot

Hope that help! :)

Vangelius
2015-08-21, 11:43
Hi Everyone:

I have followed the explanation of ColForbin but there is an error at the end, when i enter:
sudo dkms autoinstall -k 4.0.0-kali1-amd64 -m nvidia-340 -v 340.76

The system says:
"............(bad exit status: 2)
Error! Bad return status for module build on kernel: 4.0.0-kali1-amd64 (x86_64)"

Could you please help me ?

Thanks

wifiuk
2015-08-25, 17:17
i havnt been able to get any nvidia drivers to work for the new kali sana. :(

i had to reinstall after following the kali guide in the kali docs. I dont think they have updated it from kali 1.x

RasterPix
2015-08-26, 14:50
Yep. I followed the various suggestions in this thread and I was unsuccessful. I would try a newer driver; however, I am running an NVS 3100M and 340.76 appears to be the latest that supports my card. So far, my options appear to be to stick with nouveau or use Kali 1.x. ~_~

MrUnruly
2015-08-27, 17:22
I tried the steps and it didn't work, all I got was a black screen with a flashing cursor in the top left.

Rikimaru
2015-08-28, 18:00
I installed the driver this way..

1.

apt-get update
apt-get dist-upgrade
apt-get install -y linux-headers-$(uname -r) dkms
2.

Download the newest driver from the offical nvidia website.

3.

sed 's/quiet/quiet nouveau.modeset=0/g' -i /etc/default/grub
update-grub
reboot

4.

You coming to the login screen. Just don't log in. Press CTRL+ALT+F1

5.

Login in with "root" and your password.

6.

service gdm3 stop

8.

Cd to the place where the nvidia drive is. And..

sudo bash NVIDIA-Linux-x86_64-XXX.XX.run
reboot

Hope that help! :)

It ends with Oh no ! Something has gone wrong.
The same issue when I followed official instruction.

Additionaly I log in to CLI and executed nvidia-xconfig
after reboot last system message was
Started Update UTMP about System Runlevel Changes.
and it stuck there forever.

sihag
2015-09-12, 07:40
The method of of installing Nvidia drivers on Kali Linux 1.0 or 1.1 won't work on Kali Sana 2.0. I made a guide for installing Nvidia drivers on Kali SANA. It works perfectly. Try it.
https://forums.kali.org/showthread.php?27288-Guide-Install-any-version-of-NVIDIA-drivers-on-KALI-SANA-2-0-(Solved)

hydratedscrub
2015-10-16, 16:38
unfortunately it didn't work. :(
Same thing on a fresh install and the only change was nvidia driver install..

I tried the steps and it didn't work, all I got was a black screen with a flashing cursor in the top left.



Same exact issue...
Not sure where to go from here.