Tuesday, 17 January 2012

Installing BT5 from CLI on Machines Running NVidia Graphics Cards with No Networking (n00b friendly version!)

The following blog post has been created to bring together a lot of information (some of which you may already know) pertaining to installing BackTrack 5 successfully onto systems that have NVidia graphics cards. For the Linux pros out there, you may be thinking ‘LOL WTF n00b! That’s easy you just set the boot param ‘nomodeset’ in grub then do ‘apt-get install nvidia-common’, but in a lot of cases that won’t work, due to hardware restrictions (e.g. encrypted drives) and the way that Live CDs work. Plus, not everyone has time to Google every issue or knows GRUB parameters off the top of their head’s.

The main reason for doing this (apart from just wanting BackTrack installed on your machine – too much to ask?) is that for carrying out certain types of protectively marked work (government stuff) you are required to image and re-image a lot and troubleshooting this sort of process is a real pain in the arse, so I thought I would be nice and put it all in one place. I hope it proves useful!

  •  Insert the BT5 Live CD and select the 4th Option on the list (BackTrack Text – Default Boot Text Mode). This differs from the first option as it has ‘nomodeset’ in the Kernel parameters, meaning the system will actually boot!
  • Next, find out what graphics card you have installed on your machine, you can do this by typing the following command.
    $ lspci
  •  Download the corresponding driver from the NVidia website (http://www.nvidia.com/Download/index.aspx).
  • Copy the driver script (.run file) onto a FAT32 formatted USB stick.
  • Double click the ‘Install BackTrack’ icon on the Desktop and install BT on the whole disk (set regional options etc.).
  • Once this is complete and you restart, the problem you’ll have now is that you won’t be able to boot into BackTrack as it doesn’t have the correct graphics card driver installed. So, you will need to follow the following steps.
  • Upon bootstrapping, drop into the GRUB menu (either by hitting shift of the down arrow, it depends on your machine). 
  • From here you need to find the operating system you have just installed (it should be the top option), and with it highlighted, press ‘E’ to edit the script. 
  • Move the cursor with the direction arrows until you get to the line that startslinux /boot’.
  •  Towards the end of the line (or continued onto the next line) where the file readsquiet splashthere may be some code with something similar to ‘VGA 740’, if there is, delete it and replace it withnomodeset’. If there is not, just enternomodesetafterquiet splash’.
  • Press Ctrl+X to boot the modified grub entry. Backtrack should now boot to the familiar text prompt. From here, we need to source and install the NVidia drivers.
  • Insert the USB stick with the drivers on that you copied over earlier.
  •  Mount the USB stick on your machine and copy the file to your Desktop by doing the following steps below.Tail the logs using the command below, so that you can see the USB log entries as it’s plugged in:

         $ tail -f /var/log/messages

  •  Plug in the USB device and Look for a line similar to this:

      Jan 17 11:53:25 <your-hostname> kernel: [81590.537888] sdb: sdb1

  •  Your device name will be named '/dev/<device>' which in this example is '/dev/sdb1'. Create a new directory within /media/ called 'usbdrive' with the following command:

      $ mkdir usbdrive

  • Mount the USB device in this location using:

      $ mount -t vfat /dev/sdb1 /media/usbdrive/

  •  After the USB has been mounted, browse to it to check that the driver file is there, then copy it to your machine:

   $ cp <NVIDIA_Linux_x86_64-XXX.XX.run> /home/root/Desktop

  • Now, you need to install the drivers, this can be a bit tricky so make sure you follow the steps exactly.
  • Type: 'prepare-kernel-sources' as this installation requires the Kernel sources to be unpacked for the driver script to run.
  • Copy the ‘include/generated’ folder and all its contents to ‘include/linux’ with the following commands:

   cd /usr/src/linux
   cp -rf include/generated/* include/linux/

  • Run the NVidia driver script using the following command:

     ./NVIDIA_Linux_x86_64-XXX.XX.run --kernel-source-         path='/usr/src/linux'

  • This will start NVidia driver script. At the first screen click ‘Accept’ in order to accept the install agreement.
  • When the install asks “Install NVIDIA’s 32-bit compatibility OpenGL libraries’, select ‘Yes’.
  • The next prompt will ask if you wish to update your X configuration file, click ‘Yes’.
  • Hopefully, this will now give a successful update message! Click ok and then type ‘startx’ to begin the GUI. 
  • Now, you need to edit '/boot/grub/grub.cfg' to make a permanent to the boot parameter. Locate the first entry and delete 'VGA 740' and replace it with 'nomodeset'. 
  • Reboot the machine.
  • Shout huzzah / WTF!

No comments:

Post a Comment