LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Troubles when installing Wi-Fi card drivers on Kali 4.9: kernel, gcc (https://www.linuxquestions.org/questions/linux-newbie-8/troubles-when-installing-wi-fi-card-drivers-on-kali-4-9-kernel-gcc-4175612833/)

Vel_ 08-29-2017 06:18 AM

Troubles when installing Wi-Fi card drivers on Kali 4.9: kernel, gcc
 
I recently created a dual-boot partition of Kali on my Asus laptop. Its native card, an Atheros ath9k, has a weird reaction to airmon-ng and rfkill, showing it always hard-blocked on Linux but running perfectly on Windows, with no blocking switch at all.
To avoid this, I bought an AC-51 Wi-Fi card, working with a MediaTek driver, mt7610u.
I first installed it on Windows with the setup CD (still no problem in one week), and then booted Linux. A readme file is present in the Linux folder in the CD, along with a .tar archive of the driver, though the readme seems to be mainly for Fedora/RedHat-like distros (yum).

1>Install compile tool
$yum install gcc-c++

2>check kernel source code exists /usr/src/kernels/ "kernel name"
Download your kernel source code
or
$yum install kernel-devel


The said kernel source code wasn't existing, so I tried to install it when I had access to an Ethernet cable, and I think it is installed in /usr/src/kernels/ .

Build instructions:
1> $tar -xvf mt7610u_wifi_sta_vxxxx_dpo_xxxxxxxx.tar.bz2
go to "mt7610u_wifi_sta_vxxxx_dpo_xxxxxxxx" directory.
No problem with that part.


2> In Makefile
set the "MODE = STA" in Makefile and chose the TARGET to Linux by set "TARGET = LINUX
define the linux kernel source include file path LINUX_SRC
modify to meet your need.
None either, except I am not sure what is and how to manipulate the kernel source.


3> In os/linux/config.mk
define the GCC and LD of the target machine
define the compiler flags CFLAGS
modify to meet your need.
** Build for being controlled by NetworkManager or wpa_supplicant wext functions
Please set 'HAS_WPA_SUPPLICANT=y' and 'HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y'.
=> $wpa_supplicant -Dwext -ira0 -c wpa_supplicant.conf -d
** Build for being controlled by WpaSupplicant with Ralink Driver
Please set 'HAS_WPA_SUPPLICANT=y' and 'HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n'.
=> $wpa_supplicant -Dralink -ira0 -c wpa_supplicant.conf -d
( Note: in the .mk file, they were different platforms (defined by the TARGET var of the 2nd step), and in the PC part, CFLAGS=WFLAGS,
so I didn't modify the CFLAG var. I also choosed the option to control the card with Network manager (the first option), because HAS_NATIVE_WPA_SUPPLICANT_SUPPORT defaultly equaled 'y'. Therefore, the two lines of codes (-Dwext, -Dralink) didn't worked. I'll retype them if that was an important part, but I'm writing this by memory (no Internet in Linux). )


4> $make
# compile driver source code, need administrator.
# To fix "error: too few arguments to function ¡¥iwe_stream_add_event"
=> $patch -i os/linux/sta_ioctl.c.patch os/linux/sta_ioctl.c (This error didn't happened.)

This is the most problematic part. The error is something like:
make -C /lib/modules/4.9.x-kalix-amd64/build SUBDIRS=/root/mt7610u_wifi_sta_v3xxx_dpo_xxxxxxxxx/os/linux modules
make[1]: Entering directory '/lib/modules/4.9.x-kali1-amd64/build'
something I forgot >.<
make[1]: Leaving directory '/lib/modules/4.9.x-kali1-amd64/build'
Makefile:393: recipe for target 'LINUX' failed
make *** [LINUX] Error 2
This is an other error I found on the Internet that I got too :o
cp -f os/linux/Makefile.6 /usr/src/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux/Makefile
make -C /lib/modules/4.1.13-v7+/build SUBDIRS=/usr/src/mt7610u_wifi_sta_v3002_dpo_20130916/os/linux modules
make[1]: *** /lib/modules/4.1.13-v7+/build: No such file or directory. Stop.
Makefile:393: recipe for target 'LINUX' failed
make: *** [LINUX] Error 2


5> $make install
#install driver
#copy RT2870STA.dat to /etc/Wireless/RT2870STA/RT2870STA.dat
I did this part too instead of the simple make (some forums user said to =/, and the error is relatively similar (another line of a sub-makefile is bugging, but due to the use of the same variable).


6>$vi /etc/rc.d/rc.local
#input "ifconfig ra0 up"
** Ubuntu 13.04 don't have this file.
$reboot
7> unload driver
$ifconfig ra0 down
$make uninstall
$reboot
I wish I could have reached these parts '-'


TL;DR: make doesn't work
I currently can't provide an Ethernet link, so Linux is totally off the network; I can still download packages under Windows an access them in Linux.
These are two links I found, I do not know precisely which file to download (I guess it is 'linux-4.9.45.tar.gz' for the first list, being the most recent version today) although, I have Kali 4.9, and an Intel amd64 processor.
https://www.kernel.org/pub/linux/kernel/v4.x/
http://http.kali.org/pool/main/l/linux/

As the category of the post mentions it, I'm relatively new to Linux, so excuse my confusion and length to describe the problem.
Vel_

Emerson 08-30-2017 12:28 AM

OK, nobody is responding ... you may not want to read what I have to say.
First, there are two categories of Kali users. Experienced sysadmins and kids, wannabe hackers. Sysadmins generally have no reason to install Kali on the hard drive, it is a specialized distro and not suitable for everyday use. Sysadmins do not litter forums with trivial problems they may have with Kali. Kiddos who run Kali because "it is cool" do litter.
Second, Kali kernel is patched for packet injection. Thus, switching to vanilla kernel does not make much sense. If Kali is used on purpose, that is.
Third, there may be XY problem. No telling, because the USB ID of wireless device in use was not revealed. Generally the first step is checking if there is a kernel driver for given USB ID. This is before one starts downloading out of kernel driver sources.
Fourth, there are Kali forums. It seems there is not much love for kiddies on Kali forums, though.
Fifth, there is Kali documentation. I'd be surprised if getting Kali kernel sources is not covered. But of course, "real hackers" have no time nor desire to read boring manuals.

!!! 08-30-2017 01:19 AM

Practice the device install using Debian first. Then, that word won't occur!!!

Welcome to LQ; apply 'thick skin' to cold-www-reality, and try again!!! ;)

p.s. I'd wild-guess that a little web-research of ath9k linux might get the live usb working.
IF you'll post the lsusb (or relevant inxi &laptop model) maybe you'll get a lmgtfy offer.

Vel_ 08-30-2017 10:02 AM

Thank you for your replies.

Every sysadmin has a past of work, failures and experiences. Most of 'wannabe hackers' stay so for life, others gain this experience (and eventually become sysadmins), hence the 'Newbie' sub-forum where I legitimely posted this thread.
So, yes, I came to ask info about a problem which could have been solved alone (like every problem), but I never post in forums (this is litteraly my first help thread).
So at an individual scale, I do not litter this forum as some do :
(https://www.linuxquestions.org/quest...ux-4175612120/
https://www.linuxquestions.org/quest...2-file-161371/ , the first two I took in the Newb sub).
I do not use Kali because of its presumed coolness or as !!! mentioned, because of Mr Robot or any external influence. It is true that I could have started with Debian, but its relative simplicity is not as much valuable as the 'wholeness' of Kali (the native tools, in particuliar).
They are no newbie sections on Kali forums, and I think this issue is not restricted to Kali.
I am not reluctant at all to read 'boring documentations', and do not consider myself in any way as a (real) hacker.

Bus 002 Device 003: ID 0b05:17d1 ASUSTek Computer, Inc. AC51 802.11a/b/g/n/ac Wireless Adapter [Mediatek MT7610/Ralink RT2870]
Here is what lsusb tells about the Wi-Fi card (plus, I have an Asus X75VC).
As you both said, I researched (again) issues with the useful USB ID, and the solution is often a git or some workaround specifically made for these situations (all on other distros).

About the XY problem (a very interesting pattern, and far too frequent): I would like to use the Wi-Fi card, so proceed an installation of its drivers. The make command doesn't work, probably because of wrong indications I gave in the config.mk file.
I'll gladly describe other points if needed.

John VV 08-30-2017 01:25 PM

Have you read the kali docs ?
i ask because this issue IS covered
https://docs.kali.org/installation/t...-driver-issues

Vel_ 08-30-2017 08:40 PM

I actually read this before. According to it, I am at step 2: 2. Interface But Can’t Do Anything (since lsusb recognize the card). I used dmesg, and will post tomorrow the actual result if needed; even with -x and -H functions, I roughly understand it, and do not see anything in relation with this wifi card (except a kind of lsusb at the beginning of dmesg).
How should I use tail in this situation ?
"Firmware might be missing" is what I think is the problem. How to complete/add it ?

AwesomeMachine 08-31-2017 12:10 AM

I believe all the tools in Kali are also available in Debian. Kali is based on Debian. It has some forked packages, and some new ones. And, I believe networking is disabled by default in Kali. I tend to agree with Emerson.

Kali doesn't help anyone learn anything. I've used Linux since 2000. I have no use for Kali, because I use my operating system for things other than pen testing. I use it for pen testing also, but I don't need Kali for that.

And even if I did use Kali, I wouldn't install it on a hard drive. That just makes it vulnerable to attack. If you use an optical media, you know no malware went in and changed your tools to hide itself.

If it's on a hard drive, malware can do whatever it wants, because hard drives are writable. You would know that if you were a candidate for Kali use. So, I hope you get on well with Linux. But seriously, you can do everything with Ubuntu that you can do with Kali, without the hassle.

Vel_ 09-03-2017 01:37 PM

Sorry for the late reply.

Alright, after some complementary researches, I did download the iso of Debian stable.
I agree with the unsecurity of a dual-boot of Kali, I only did it because I lacked of a compatible USB stick, and it was a month ago.
Now, I will indeed mount Debian on a bootable one; this should avoid the drivers issues (since I do not have access to Ethernet, and the wi-fi card would not be blocked).
Thank you for your advices; should I mark this subject as solved ?


All times are GMT -5. The time now is 11:11 AM.