All posts in Linux

Following the official documentation for installing Nvidia driver on Kali 2.0 didn’t work for me. I installed nvidia-kernel-dkms, disabled nouveau driver, and rebooted. Then I had an error saying Something went wrong.. and presented with only a logout button. I was unable to login to the graphical interface. So I dug every bit of information in the internet and finally installed NVIDIA driver (361.28) on Kali (kernel 4.0.0).

Preparation

First, download the driver for your GPU. To know which driver to download, run lspci | grep -E "VGA|3D" command. It will show the GPU you currently have. Mine is GeForce GT 740M. Then look for the appropriate driver for your GPU at Nvidia website. Here are the archives for 64 bit and 32 bit system. After downloading the driver, place it somewhere in your home folder – we will be needing it later. Make it executable chmod +x ~/Downloads/NVIDIAxxxx.run.

Next, install the linux headers:

  • apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
  • aptitude -r install linux-headers-$(uname -r) Where -r means install all recommended packages as well.

 

If you have installed nvidia-kernel-dkms earlier, remove it and all nvidia packages by apt-get remove nvidia* --purge.

Disable nouveau driver

Create a file /etc/modprobe.d/nvidia-installer-disable-nouveau.conf and paste the following lines:

 Stop X server

We need to stop the X server so we can run the Nvidia installer. Kali2.0 uses gdm by default. You can stop the X server by stopping gdm systemctl stop gdm. Another way is to hit Ctrl+Alt+Backspace. You can also try the methods suggestedhere in case previous methods don’t work.

If nothing works then just restart. As you have already disabled nouveau, your kernel won;t be able to load X server or the nouveau driver.

Backup your xorg.conf file (optional)

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

Chances are, there won’t be any file to backup.

Install Nvidia Driver

Now, cd into the directory where the installer is located. Then run the installer ./NVIDIAxxxx.run -a. Just accept whatever the installer asks. For 64 bit systems, you might encounter a question about 32bit libs, just ignore it.

After the installation completes, we need to disable the nouveau driver and configure the X server.

Configure X server

(From the Arch wiki )

Then, configure xorg.conf. You will need to know the PCI address of the NVIDIA card, which you can find by issuing lspci | grep -E "VGA|3D". The PCI address is the first 7 characters of the line that mentions NVIDIA. It will look something like01:00.0. In the xorg.conf, you will need to format it as #:#:#; e.g. 01:00.0 would be formatted as 1:0:0.

In my case, the bus id for my GPU was 04:00.0.

Now, you can take the backup of the conf file created while installing Nvidia driver but it is 100% useless and will not work.

Edit/create the file /etc/X11/xorg.conf and add the following lines after removing any other text that is there in that file.

Then create a file /usr/share/gdm/greeter/autostart/display_setup.desktop and paste the following lines:

Reboot and you should be good to go.

Sources

If during the installation of Kali Linux 2.0, you have chose to not use any network mirrors, chances are you  will be using a pretty basic version of the sources.lst file. For those of you don’t know, sources.lst file determines the software repositories from where you can install packages using “apt”. If you have a minimal version of “sources.lst”, you won’t be able to install many of the packages. For example, if you try to install “htop”, you will get an error saying “package not found”. Follow the instructions below to get a full sources.lst file

First of all, let’s move the previous sources.lst file to backup location and then let’s create a new one with needed repositories.

mv /etc/apt/sources.list /etc/apt/sources.list-backup

Now open up a text editor of your choice and open the /etc/apt/sources.list file.

nano /etc/apt/sources.list

Now, copy the following content and paste it in the leafpad window, and save it.

The following is the Kali rolling repository. You should be using this unless you have some reasons to use the old repo.

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

The following is the old repositories. Use this only if you know what you are doing.

deb http://http.kali.org/kali sana main non-free contrib
deb http://security.kali.org/kali-security sana/updates main contrib non-free
deb-src http://http.kali.org/kali sana main non-free contrib
deb-src http://security.kali.org/kali-security sana/updates main contrib non-free

That’s it, you should now have access to most of the packages. Once you save the file, do the following command once,

And you’re good to go.

Well, I just installed the latest Kali OS, I found out no guide out there is up to date. So here it is, I’ll try to write as much as possible.

 

Step 1: Get the deb file

You need to download the Chrome .deb file to install on your Kali Machine. Go HERE and download the .deb ( Make sure you download the correct one – 32bit or 64bit )

 

Step 2: Installing the deb using dpkg

Let’s install the .deb file. For that, open up a terminal and “cd” to the directory where you have downloaded the deb file. Remember to use “sudo” if you’re not root. As a side not, you can install any .deb file on Kali or any Debian based distro using the following command.

It will probably show you an error saying there is some dependency issue or some stuff like that.

Install the following package

in terminal Do:

nano /etc/apt/sources.list

And make sure these two lines are there:

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

deb http://security.kali.org/kali-security sana/updates main contrib non-free

ctrl + O to save and ctrl+x to close

 

Type:

  1. apt-get update && apt-get upgrade && apt-get dist-upgrade
  2. apt-get -f install
  3. and again type, apt-get update && apt-get upgrade && apt-get dist-upgrade

Now install chrome with commad: dpkg -i chrome*.deb

I guarantee that chrome gets installed now.

 

Now comes another issue, you cannot run Chrome, yet

 

This is where things get ugly. If you try to open up google chrome, it won’t open. Nothing would happen. Actually, you won’t see any error messages. It just won’t open. And there is a reason why it won’t open, that’s because you’re trying to run it as “root”.

Default user in Kali is “root” and it was done for a reason, Kali is not intended to use as a daily OS. But that does not mean that you can’t use it as a daily OS. In fact, Kali 2.0 is my main OS and it runs without any issues.

If you want to use Chrome, you have two options:

In fact there are several methods by which you can use Google chrome. Most of them involve enabling chrome to be run as root. This is not the right way to handle things. There is a reason why chrome refuses to run as root. That’s because, if you run the browser as root, then someone exploiting your browser could get root privileges. But, anyway, let’s cut to the chase.

Option 1. Create a normal user with sudo privileges to use daily, and use “sudo su -” to switch to root whenever you want.

This is the preferred method. This is how I use Kali. If you want to know how to set up a sudo user in Kali, google it:). I’ll probably write about it later.

Option 2. Create another user and switch to that user in a terminal and open up the applications like google chrome or VLC. Let me explain this for you:

This is how it’s done in the second option:

 

<pre class="toolbar:2 lang:default decode:true "># First of all, we need to enable access to X server for all users
# Otherwise, the newly created user won't be able to run applications with GUI
# Issue the following command
xhost +
# Create a new user. Here bob is the username
adduser bob
# Now the program will ask for password etc, provide them
# Once the user is created, you can switch to the new user using the following command 
su - bob
# Now you're in bob's terminal, and you can open google chrome by typing
google-chrome 
# It should open up the chrome browser</pre>

 

That’s it. That way you can run chrome browser, without changing any system files.

This tutorial is applicable to LinuxMint Debian Edition for it doesn’t come with the Hardware Driver option (System->Administration->Hardware Drivers) found in Ubuntu and LinuxMint. Installing LMDE will not automatically install the driver for you so you have to manually do it from the Terminal.

Steps are outlined below:

You are required to connect to the Internet with the LAN interface before proceeding.

1.) After successfully installing LMDE, you have to update it first prior to installing the driver.
sudo apt-get update && sudo apt-get upgrade

2.) After a successful update, we can now install the desired driver for our Broadcom wireless card:

sudo apt-get install b43-fwcutter firmware-b43-installer

All you have to do is wait for the installation to finish and you will be able to use the Broadcom wifi card after a restart.

 

This was one of the easiest fix I’ve ever encountered on a linux machine.

 

If you haven’t tried out Nano editior in linux, please give it a go! It’s brilliant.

Here’s how to search within the file:

 

Ctrl + W is the shortcut for searching. After entering the search term, press Enter. To repeat the search, issue Alt + W. In this menu, you can select earlier searches using the arrow up/ down keys.

To toggle backwards searching, you need to press Alt + B in the search dialog.

For more shortcuts, press F1

 

Happy Searching!