Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: [TUTORIAL] Installing official NVIDIA driver in Optimus laptop

  1. #1
    Junior Member
    Join Date
    Mar 2017
    Posts
    9

    Cool [TUTORIAL] Installing official NVIDIA driver in Optimus laptop

    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:
    Code:
    PCI:10:0:0
    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
    Code:
    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.
    Last edited by TiGER511; 2017-04-04 at 05:59 PM. Reason: Screen tearing fix added.

  2. #2
    Senior Member
    Join Date
    Oct 2016
    Location
    /dev/sda
    Posts
    418
    Thanks for this info. Installing Nvidia drivers is a big overhead for most of the users. The kali-linux documentation has broken tutorial for this. They only tell you how to install it if you have only dedicated Nvidia graphic card. Today's PC comes with both integrated and dedicated Intel HD graphics and Nvidia GEforce. How did you find out that following all those commands would work? There must be something you were able to figure out.

  3. #3
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Quote Originally Posted by _defalt View Post
    Thanks for this info. Installing Nvidia drivers is a big overhead for most of the users. The kali-linux documentation has broken tutorial for this. They only tell you how to install it if you have only dedicated Nvidia graphic card. Today's PC comes with both integrated and dedicated Intel HD graphics and Nvidia GEforce. How did you find out that following all those commands would work? There must be something you were able to figure out.
    I had to spend a lot of time figuring it out.most of the infromations i got was from nvidia dev forum,Nvidia installation guide and the archlinux wiki.I just put togther all the information.

  4. #4
    Junior Member
    Join Date
    Apr 2017
    Posts
    1
    Hi there.
    I want to thank you for this excelente tuto. This was THE ONLY ONE that worked for me.
    I've been searching for the solution for many days, removing and reinstalling nvidia with a low bandwitdth connection. I think the point is the xorg.conf and display manager configuration you found on offical docs.
    Now I have nvidia running on my kali thanks to you.
    Spread the word and make this possible for others.
    Very nice, man. Good job.

  5. #5
    Junior Member
    Join Date
    May 2015
    Posts
    4
    Mate you are an absolute F**kin legend, this has been giving me endless problems and at the end of last year I decided to give up then today I thought I would look to see if anyone had managed to do it and this worked perfectly, thanks for sharing this info THIS needs to be in the documentation!

  6. #6
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    You are welcome mate.Really appreciate it.I've updated the article with screen tearing fix.

  7. #7
    Junior Member
    Join Date
    Apr 2017
    Posts
    2
    Man you really saved me from lots of trouble. but i need to switch between nvidia and intel boards for reasons of battery saving. i cant see PRIME tab on xServer settings how can i switch ?

  8. #8
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Quote Originally Posted by darthsoul View Post
    Man you really saved me from lots of trouble. but i need to switch between nvidia and intel boards for reasons of battery saving. i cant see PRIME tab on xServer settings how can i switch ?
    You can not switch gpu with official nvidia driver on linux.If you wanna switch between gpus,you have to use bumble bee which is unofficial.Nvidia Linux drivers only supports nvidia card to be operated.

  9. #9
    Senior Member
    Join Date
    Oct 2016
    Location
    /dev/sda
    Posts
    418
    What if I blacklist Nvidia driver? Will kali switch to Intel HD graphics?
    Last edited by _defalt; 2017-04-09 at 01:29 PM.

  10. #10
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Maybe you have to use different xorg.conf file. even if you blacklist Nvidia driver, you can not switch graphics card on demand like in windows with this procedure. you have to restart and change xorg.conf everytime you want to change GPU.why would anyone wanna do that?
    If you really want power saving, try bumble bee.There is very good tutorials regarding bumble bee in this forum.
    Last edited by TiGER511; 2017-04-09 at 02:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •