Tuesday 30 April 2019

Installing new driver on Linux, missing the 'Build' directory

I recently installed Kali Linux on a very old PC, and since it doesn't have a wifi card I bought a Realtek USB wifi adapter. The adapter came with a driver to install, and I went to run the "install.sh", but it came back with two types of error:


1) When extracting the driver, it was unable to change the ownership of any of the extracted file from '400' to '401' - Im guessing that is like with chmod ownerships.


This I sort of solved by removing the extraction part of the shell script and extracting/chmodding the file myself. But problem 2 still applied:


2) It was unable to find the directory "/lib/modules/$(uname -r)/build"


I checked the "/lib/modules/$(uname -r)" directory, where, among other things, the drivers are kept: "/lib/modules/$(uname -r)/kernal/drivers", and indeed there is no 'build' directory. Apparently the directory should be 'the path of kernel source used for driver compilation' (taken from the Installation PDF). Now given that this was in the 'make' part of the script, I don't know where to go from here because I'm not remotely knowledgable about driver compilation. I am also not sure if it is a Kali-specific problem, but I can not find a solution anywhere else and it does not provide any help in the manual. If anyone knows where 'the path of kernel source used for driver compilation' is in Kali, or knows how to compile it manually, or even knows specifically how to install wifi adapter drivers on Kali, I would really appreciate it


http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html is among a couple of websites to mention that things to do with compilation require a 'build' directory as stated above, and suggests doing this to obtain the current kernel build directory:


$ ls -d /lib/modules/$(uname -r)/build

which of course is a problem for me, as it doesn't exist for whatever reason. I have tried:


apt-get install linux-headers-$(name -r)

and


apt-get update && apt-get install linux-headers-$(name -r)

with the errors:


'E: Unable to locate package linux-headers-3.18.0-kali3-686-pae'


and


'E: Couldn't find any package by regex linux-headers-3.18.0-kali3-686-pae'


I also used:


apt-get install linux-headers-generic

which failed with:


'E: unable to locate package linux-headers-generic'


And finally I HAVE done:


apt-get install build-essentials

Which said that it is already the newest version


I have checked:


apt-cache search linux-headers-$(name -r)

which came back with no results. And yes, I HAVE tried rebooting my system. Bear in mind that I have no internet on the PC - ethernet or wifi. Sorry for the long post, I felt like I should list the errors as well.


This is a question I asked on Stack Overflow


It was classed as off-topic so I have reopened it here

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...