Ubuntu – How to install driver for TP-Link TL-WN722N on Ubuntu 14.04


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-

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

Best Answer

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.