3

I managed to render my installation of kali linux 2016.2 useless, so I re-installed it, and started the process over again, following the tutorial found under: https://www.blackmoreops.com/2014/03/13/install-proprietary-nvidia-driver-kali-linux/

Here are the steps outlined which can be found in that tutorial.

echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" >> etc/apt/sources.list
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
apt-get install -y aptitude 
aptitude -r install linux-headers-$(uname -r)
apt-get install nvidia-kernel-$(uname -r)
aptitude install nvidia-kernel-dkms
aptitude install nvidia-xconfig
nvidia-xconfig
reboot

Since the installion stalled again on the following step,

aptitude -r install linux-headers-$(uname -r)

with following output

Couldn't find any package whose name or description matched "linux-headers-4.6.0-kali1-amd64" Unable to apply some actions, aborting

I added the recommended repositories to /etc/apt/sources.list

echo "deb http://old.kali.org/kali sana main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://old.kali.org/kali sana main non-free contrib" >> /etc/apt/sources.list
echo "deb http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://http.kali.org/kali kali-rolling main contrib non-free" >> /etc/apt/sources.list

and retried that step, but it still fails and shows the error. I'm totally stuck at this point and I'm not sure what to try next

I figured I have to download the driver manually from NVIDIA this is the file I downloaded "NVIDIA-Linux-x86_64-304.132.run" it is about 69.4 MB large

This is the Info about that driver package: LINUX X64 (AMD64/EM64T) DISPLAY DRIVER Version: 304.132 Release Date: 2016.9.26 Operating System: Linux 64-bit Language: English (US) File Size: 66.21 MB

Supported Products reads: ... GeForce 200 Series: GeForce GTX 295, GeForce GTX 285, GeForce GTX 280, GeForce GTX 275, GeForce GTX 260, GeForce GTS 250, GeForce GTS 240, GeForce GT 230, GeForce GT 240, GeForce GT 220, GeForce G210, GeForce 210, GeForce 205 ...

here is the link http://www.nvidia.com/content/DriverDownload-March2009/confirmation.php?url=/XFree86/Linux-x86_64/304.132/NVIDIA-Linux-x86_64-304.132.run&lang=us&type=GeForce

So my GeForce 210 is supported by this driver package, but how do I install it manuall and after which step should I do so?

Please help! I will compile everything into a tutorial, so other who have the same errors with kali linux 2016.2 are helped too.

Thanks

2
  • Take a look at my answer, I've taken the liberty to write how to get Nvidia drivers working on Desktop computers and NVIDIA Optimus based laptops. Feb 27, 2017 at 23:41
  • To Daniel Lane. I did everything you listed there (laptop options) and my Kali Linux doesn't start. I guess I should reinstall Kali Linux. Apr 19, 2017 at 22:33

4 Answers 4

3

Actually, I just got the propriety Nvidia drivers working myself on both my desktop and my laptop, scroll down the guide for the Laptop guide. It's a little trickier on the Optimus laptop but still quite doable.

NVIDIA Desktop Driver Install

First of all I'm assuming being logged in under root and a clean install of kali 2016.2.

Pre-requisites

leafpad /etc/apt/sources.list

Ensure that sources.list ONLY has the following source:

deb http://http.kali.org/kali kali-rolling main contrib non-free

1. Grab the packages you need

apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get update
apt-get upgrade

2. Unload nouveau from the kernel.

modprobe -r nouveau

3. Install kernel headers

apt-get install gcc make linux-headers-$(uname -r)

4. Install dkms

apt-get install dkms

5. Blacklist the nouveau drivers

leafpad /etc/modprobe.d/nouveau-blacklist.conf

and add the line "blacklist nouveau" sans the quotes to the conf file, save and close.

6. Install the Nvidia drivers and reboot

apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
reboot

Login and you're done. If you need to configure your drivers, run nvidia-settings from terminal.

NVIDIA Setup on Optimus Enabled Laptops M series GPU

First of all, the instructions on the KALI distro website are wrong, they won't work and they're not ever going to work with a Kali install.

Anyway here goes

Step 1.

Once Kali is installed, when GRUB loads, select the kali boot entry and press 'e'.

Go down to the line that loads the linux kernel and append " nomodeset" without the quotes but including the prefixed space after the 'quiet' text, this will allow you to load your display manager.

It should look similar to the following example

linux /boot/vmlinuz-linux root=/dev/sda3 initrd=/boot/initramfs-linux.img quiet nomodeset

Step 2.

Once you're logged in, open a terminal and issue the following commands:

apt-get update
apt-get dist-upgrade
apt-get upgrade

This will make sure your distro is up to date. Once done, reboot Kali, remember to press e and specify nomodeset again.

Step 3.

apt-get install -y linux-headers-$(uname -r)
apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
apt-get install nvidia-vdpau-driver vdpau-va-driver mesa-utils

This installs the appropriate nvidia drivers, configuration software and mesa-utils to verify driver installation worked via glxgears.

Step 4.

Issue lspci to identify the BusID of your nvidia chip, you'll be needing this for configuring xorg.conf.

In the terminal issue the following command:

lspci | grep "3D"

I get the following output

01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)

Note your BusID for the nvidia card.

Step 5.

leafpad /etc/X11/xorg.conf

Put the following configuration into your xorg.conf, be sure to edit it, replacing <#:#:#> with your BusID from lspci, for example if LSPCI reports 01:00.00 the BusID value should be "1:0:0"

Section "Module"
     Load          "modesetting" 
EndSection

 Section "Device"
     Identifier     "nvidia"
     Driver         "nvidia"
     VendorName     "NVIDIA Corporation"
     BusID          "<#:#:#>"
     Option         "AllowEmptyInitialConfiguration" 
EndSection

In my instance, BusID is set to "1:0:0"

Step 6.

Create a lightdm configuration script, this will execute before the display manager starts and will tell X which output source to use.

leafpad /etc/lightdm/display_setup.sh

paste the following lines into the new file, save and close

#!/bin/sh 
xrandr --setprovideroutputsource modesetting NVIDIA-0 
xrandr --auto

Next, we need to make this script executable from a terminal.

chmod +x /etc/lightdm/display_setup.sh

Step 7.

Finally, lightdm needs to be told to execute the script upon load. You will need to open the lightdm.conf file, scroll down to [Set:*] section and immediately below it, add the following text.

display-setup-script=/etc/lightdm/display_setup.sh

Reboot and you're done. No need to set nomodeset when booting in grub, once you're logged in, pop open a terminal and issue

glxgears

That's it. You're done, you now have 3D acceleration using your nvidia card.

I did this for the XFCE variant of Kali, you'll need to adapt Step 6 and Step 7 for your chosen display manager.

NVIDIA Optimus - Display Managers (Arch Linux) for further info on config of other Display Managers.

1

After spending a few days on how-tos and debugging the black screen issue on boot after installing the NVIDIA drivers, I was finally able to find a solution to all my problems. The main reason I'm writing this post is to let you know that the tutorial found on Kali's official website is broken as of date 11 April 2018. According to he mentioned in their website you might be able to successfully install the packages – ocl-icd-libopencl1, nvidia-driver, nvidia-cuda-toolkit – but you might encounter issues during the reboot. You might get a black screen and won't be able to login via the GUI. So let’s get started:

First of all, here are the specifications of my system:

  • CPU - Intel® Core™ i5-8250U CPU @ 1.60 GHz × 8
  • GPU #1- Intel® UHD Graphics 620
  • GPU #2- Nvidia GeForce MX150
# uname -a
Linux europa 4.14.0-kali3-amd64 #1 SMP Debian 4.14.17-1kali1 (2018-02-16) x86_64 GNU/Linux

Release:

# 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="2018.1"
VERSION_ID="2018.1"
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, a couple of notes:

USE AT YOUR OWN RISK

This tutorial is for the official NVIDIA Driver

The tutorial found on the official Kali website is BROKEN! It never works for optimus/hybrid Graphics enabled laptop.

Step 1: Verify you have hybrid graphics

# lspci | grep -E "VGA|3D"
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 07)
01:00.0 3D controller: NVIDIA Corporation GP108M [GeForce MX150] (rev a1)

Step 2: Disable nouveau

# echo -e "blacklist nouveau\noptions nouveau modeset=0\nalias nouveau off" > /etc/modprobe.d/blacklist-nouveau.conf
# update-initramfs -u && reboot

Step 3: System will reboot and nouveau should be disabled. Verify if nouveau is disabled:

# lsmod | grep -i nouveau

If it shows nothing, that means that nouveau was successfully disabled.

Step 4: Install nvidia driver from Kali repo:

# apt-get install  nvidia-driver nvidia-xconfig

You can also download the latest .run file from Nvidia’s website. Execute and proceed with installation. Whether it’s from Kali’s repo or Nvidia’s website, the procedure is same. The command to install the .run file is:

sudo sh ./Nvidia-driver-filename.run

Step 5: Now we have to find the bus ID of our NVIDIA card:

# nvidia-xconfig --query-gpu-info | grep 'BusID : ' | cut -d ' ' -f6

It should show something like this:

PCI:1:0:0

This is our Bus ID.

Step 6: Now we generate the /etc/X11/xorg.conf file with this bus ID according to Nvidia's guide:

Section "ServerLayout"
    Identifier "layout"
    Screen 0 "nvidia"
    Inactive "intel"
EndSection

Section "Device"
    Identifier "nvidia"
    Driver "nvidia"
    BusID "**PCI:1: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 string inside ** ** with your Bus ID and save the file to /etc/X11/xorg.conf.

Step 7: Now we have to create some scripts according to our display manager.
Since I’m using the default Kali Linux, which is GDM, I created two files:  /usr/share/gdm/greeter/autostart/optimus.desktop and /etc/xdg/autostart/optimus.desktop, with the following content:

[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer

Step 8: Now reboot and you should be using Nvidia Driver. Verify if everything is ok: install mesa-utils if not previously installed.

# apt-get install mesa-utils

# glxinfo | grep -i "direct rendering" direct rendering: Yes

Step 9: Now you can install the cuda toolkits and drivers:

# apt install -y ocl-icd-libopencl1 nvidia-driver nvidia-cuda-toolkit

Step 10: Now that our system should be ready to go, we need to verify that the drivers have been loaded correctly. We can quickly verify this by running the nvidia-smi tool.

# nvidia-smi
Wed Apr 11 11:08:55 2018       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.42                 Driver Version: 390.42                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce MX150       Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   60C    P0    N/A /  N/A |    368MiB /  2002MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0       763      G   /usr/lib/xorg/Xorg                            20MiB |
|    0       793      G   /usr/bin/gnome-shell                          19MiB |
|    0      1108      G   /usr/lib/xorg/Xorg                            82MiB |
|    0      1191      G   /usr/bin/gnome-shell                         242MiB |
|    0      2132      G   gnome-control-center                           1MiB |
+-----------------------------------------------------------------------------+

FIXING SCREEN TEARING ISSUE: After you successfully boot up with the Nvidia driver, you most probably would be experiencing screen tearing issue, i.e., glitches while playing videos in VLC, YouTube videos on Chrome/Firefox, etc. Luckily, we can fix this by enabling PRIME Sync.

  1. Verify if PRIME is disabled

    # xrandr --verbose | grep PRIME
    

    it should output something like this:

    PRIME Synchronization: 0
    PRIME Synchronization: 1
    

    The 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:

          ︙
    GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia-drm.modeset=1"
          ︙
    
  3. Save the changes and update grub using the command:

    # update-grub
    
  4. Reboot your system.

  5. Verify that PRIME is enabled:

    # 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 ARE STUCK IN BOOT SCREEN

Revert what we have done so far:

Press Ctrl+Alt+F2 or Ctrl+Alt+F3, login with your password.

# apt-get remove --purge nvidia-*
# rm -rf /etc/X11/xorg.conf

Remove those display manager files we created earlier (for GDM):

# rm /usr/share/gdm/greeter/autostart/optimus.desktop
# rm /etc/xdg/autostart/optimus.desktop

Now reboot. You should be able get back to your old system.

If any issues exist, please post in Kali’s forum.

My sincere thanks to TiGER511 who did all the hard work.

0

I was wondering the same. For same reason the installation step with installing headers always fails. Can you please post the output of echo $(uname -r)

It should be 4.6.0-kali1-amd64

also your sources.list should have the following

deb http://old.kali.org/kali sana main non-free contrib
deb-src http://old.kali.org/kali sana main non-free contrib
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
0

I think you are using kali-rolling release but your sources list contains kali sana repositories which are old. Use these mirrors for kali rolling 2016.2


deb http://http.kali.org/kali kali-rolling main contrib non-free

deb-src http://http.kali.org/kali kali-rolling main contrib non-free

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .