14

Hi I am new to Ubuntu and Linux. As I am developing a WiFi product, I want to capture the WiFi traffic wirelessly with Wireshark. Having some searching in the web, I know that I can do that with a USB WiFi adapter and Ubuntu. Then I can run the Wireshark in real monitor/promiscuous mode.

Ok so I bought a TP-Link TP-WN722NC (I want to buy the TP-WN722N at first, but the store only has this model). Also I found a laptop and installed the Ubuntu 14.04.1. Then I noticed that I need a driver for this adaptor. So I try to follow the blog post Installing TL-WN722N on Ubuntu 11.10 to install the driver ath9k_htc but seems it was not successful.

Then I downloaded the backports 3.16-1 by running these two commands:

wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.16/backports-3.16-1.tar.gz
tar xvf compat-wireless-2.6.38.2-2.tar.bz2

However, after that point do not know what should I do. Could you help guide me to install the correct driver?

4
  • 1
    Boy this looks terrible, after viewing the answer, I think I'll swap to a different USB wireless receiver vendor ;( does it really have to touch grub for any good reason?!?
    – matanox
    Jun 8, 2015 at 15:41
  • Well I just unboxed my TL-WN772N plugged, plugged it into my Ubuntu 14.04.1 and it simply worked out of the box...
    – matanox
    Jun 9, 2015 at 13:41
  • I think recent kernel versions (at least since 3.16) have the ath9k driver built-in, so it should just be plug-n-play. Check your kernel version with uname -r. EDIT: yup, ath9k is built-in since Linux 2.6.35, according to the Debian wiki. Jan 10, 2017 at 17:38
  • Got my TL-WN772N today, it "just worked" after sudo aptitude install firmware-atheros, plugging the device in again, followed by sudo service network-manager restart :) Jan 13, 2017 at 18:50

1 Answer 1

12

Part One

Open a terminal and run the following commands:

First, you will need to install a few applications to build and compile from source:

sudo apt-get update
sudo apt-get dist-upgrade
apt-get install gcc build-essential linux-headers-generic linux-headers-`uname -r`

Save any unsaved work and reboot. When you sign back in, open a terminal.


Part Two

Download the needed file:

wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v4.4.2/backports-4.4.2-1.tar.gz

Now, unzip the tar.gz file:

tar xvfz backports-4.4.2-1.tar.gz

Then, c hange your d irectory to the uncompressed file:

cd backports-4.4.2-1

Because there is a Makefile, we will be using the make command. First, clean the build area by typing this command:

sudo make clean

Then, use this command to build and compile:

sudo make

You should receive an error and some instructions. Following these instructions to specify the driver you want to build and install by running the following command:

sudo make defconfig-ath9k

Now, run make again:

sudo make

This time you should receive no errors. This may take some time to finish. When it is done, install the driver with the following command:

sudo make install

You will see some messages saying something about a key. These errors can safely be ignored and should not impact the overall outcome.


Part Three

Now, run these two commands in an open terminal to load the driver modules at boot time.

echo "ath9k" | sudo tee -a /etc/modules

echo "ath9k_htc" | sudo tee -a /etc/modules

For the next command, I will use gedit as the text editor but you can use nano, leafpad, kate, mousepad or any text editor.

sudo gedit /etc/rc.local

Now, we need to insert the following two lines before "exit 0" so the last four lines of the file should look exactly like this:

# Declare TP-WN727N USB ID to ath9k_htc module
echo "148F 7601" | tee /sys/bus/usb/drivers/ath9k_htc/new_id

exit 0

Click on save before exiting out of gedit.


Part Four

Finally, the script mentions something about updating your initramfs. It might not be needed but these are kernel modules so that's what we will do by running the following command:

sudo update-initramfs -k all -u

and don't forget to update grub when you are done:

sudo update-grub

Save any unsaved work, leave the device plugged in and reboot for these changes to take effect.

12
  • Thanks for your detail explanation, but after finished all the above step. I still cannot see the WiFi connection at the top right corner. At part three, is that I just need to run these two command in the terminal? echo "ath9k" | sudo tee -a /etc/modules echo "ath9k_htc" | sudo tee -a /etc/modules
    – eepty
    Aug 18, 2014 at 12:01
  • Yes, those two lines are individual commands. The first command is: echo "ath9k" | sudo tee -a /etc/modules The second command is: echo "ath9k_htc" | sudo tee -a /etc/modules You won't have wireless until you're completely done and after you reboot.
    – mchid
    Aug 18, 2014 at 12:08
  • 1
    @TomášZato Run following command first to download the fileand then run the tar command: wget https://www.kernel.org/pub/linux/kernel/projects/backports/stable/v3.16/backports-3.16-1.tar.gz
    – mchid
    Oct 9, 2016 at 17:26
  • 1
    I was using Mint 18 (Ubuntu 16.04 LTS) and v3.16 did not compile. I followed the same instructions with the latest version from kernel.org/pub/linux/kernel/projects/backports/stable (v4.4.2 at the time of this post) and it worked; so if you have trouble, maybe try a more recent version too :) Apr 13, 2017 at 0:53
  • 1
    Note for newer versions of the device: askubuntu.com/questions/912498/tl-wn722n-is-not-recognized
    – tothphu
    Jun 14, 2017 at 23:25

You must log in to answer this question.

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