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
Code:
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
Code:
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
Code:
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
- Run the nvidia driver installation
Code:
./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
Code:
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:"
Code:
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);
}
Code:
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/ins...-on-kali-linux
https://bugs.launchpad.net/ubuntu/+s...s/+bug/1431278
https://bugs.launchpad.net/ubuntu/+s...278/comments/6