After spending 4 days in a row,i was finally able to install and run Official NVIDIA driver on my HP Envy 15 laptop.Here is my specs:
CPU: Intel core i7-4510U CPU
GPU #1: Intel HD Graphics 4400
GPU #2: NVIDIA GeForce GTX 850M
My system:
Code:
root@linux:~# uname -a
Linux linux 4.9.0-kali3-amd64 #1 SMP Debian 4.9.13-1kali3 (2017-03-13) x86_64 GNU/Linux
Code:
root@linux:~# cat /etc/*release*
DISTRIB_ID=Kali
DISTRIB_RELEASE=kali-rolling
DISTRIB_CODENAME=kali-rolling
DISTRIB_DESCRIPTION="Kali GNU/Linux Rolling"
PRETTY_NAME="Kali GNU/Linux Rolling"
NAME="Kali GNU/Linux"
ID=kali
VERSION="2016.2"
VERSION_ID="2016.2"
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.kali.org/"
SUPPORT_URL="http://forums.kali.org/"
BUG_REPORT_URL="http://bugs.kali.org/"
Before we begin,couple of notes:
***USE AT YOUR OWN RISK***
*This tutorial is for official NVIDIA Driver not Bumblebee
*Tutorial found on official Kali website is BROKEN! It never works for optimus/hybrid Graphics enabled laptop
1. Verify you have hybrid graphics
Code:
lspci | grep -E "VGA|3D"
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)
0a:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 850M] (rev a2)
2.Disable nouveau
Code:
echo -e "blacklist nouveau\noptions nouveau modeset=0\nalias nouveau off" > /etc/modprobe.d/blacklist-nouveau.conf
update-initramfs -u && reboot
3.system will reboot and nouveau should be disabled.verify if nouveau is disabled:
Code:
lsmod |grep -i nouveau
If shows nothing,means nouveau successfully disabled.
4.Install nvidia driver from kali repo:
Code:
apt-get install nvidia-driver nvidia-xconfig
You can also download latest .run file from nvidia website.execute and procceed with installation.whether its from kali repo or nvidia website,procedure is same.
5.Now we have to find bus id of our nvidia card:
Code:
nvidia-xconfig --query-gpu-info | grep 'BusID : ' | cut -d ' ' -f6
it should show something like this:This is our Bus ID.
6.Now we generate /etc/X11/xorg.conf file with this bus ID according to nvidia guide http://us.download.nvidia.com/XFree8...E/randr14.html:
Code:
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:10:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration"
EndSection
Section "Device"
Identifier "intel"
Driver "modesetting"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
Replace the bold string with your Bus ID and save it to /etc/X11/xorg.conf
7.Now we have to create some scripts according to our display manager https://wiki.archlinux.org/index.php...splay_Managers.Since im using default Kali linux which is GDM,i created two files:
/usr/share/gdm/greeter/autostart/optimus.desktop
/etc/xdg/autostart/optimus.desktop
with the following content:
Code:
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
8. Now reboot and you should be using Nvidia Driver.Verify if everything is ok:
Code:
root@kali:~# glxinfo | grep -i "direct rendering"
direct rendering: Yes
Optional: you can now install your cuda toolkits:
Code:
apt-get install ocl-icd-libopencl1 nvidia-cuda-toolkit
FIXING SCREEN TEARING ISSUE:
After you successfully boot up with Nvidia Driver, you most probably experiencing screen tearing issue eg: playing videos in VLC,youtube video on Chrome/Firefox etc.Luckily,we can fix this by enabling PRIME Sync.
1.Verify if PRIME is disabled
Code:
xrandr --verbose|grep PRIME
it should output something like this:
PRIME Synchronization: 0
PRIME Synchronization: 1
First one is our connected display.So PRIME sync is disabled.
2. Edit /etc/default/grub and append nvidia-drm.modeset=1 in GRUB_CMDLINE_LINUX_DEFAULT after quiet.Like the following:
Code:
....
GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia-drm.modeset=1"
...
3.Save the changes.Update grub
4.Reboot your system.
5.Verify if PRIME is enabled:
Code:
xrandr --verbose|grep PRIME
Now it should output:
PRIME Synchronization: 1
PRIME Synchronization: 1
If it still shows 0 for you,then there is probably something wrong with your system config/kernel.Since this is still an experimental feature from Nvidia,you are out of luck.
***IF YOU STUCK IN BOOT SCREEN***
Revert what we have done so far:
Press CTRL+ALT+F2 or CTRL+ALT+F3 ,login with your password.
Code:
apt-get remove --purge nvidia*
rm -rf /etc/X11/xorg.conf
Remove those display manager files we created earlier (for GDM):
Code:
rm -rf /usr/share/gdm/greeter/autostart/optimus.desktop
rm -rf /etc/xdg/autostart/optimus.desktop
Now reboot.you should be able get back to your old system.