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

229,173

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.

Share:
229,173

Related videos on Youtube

eepty
Author by

eepty

Updated on September 18, 2022

Comments

  • eepty
    eepty over 1 year

    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?

  • eepty
    eepty over 9 years
    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
  • mchid
    mchid over 9 years
    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.
  • Edward Torvalds
    Edward Torvalds over 9 years
    what does this command do ? apt-get install linux-headers-generic linux-headers-uname -r` kernel is already installed right ?
  • mchid
    mchid over 9 years
    not necessarily, what if you are using low-latency? if you are using the generic kernel the command just cancels out but if not then it should install the headers for the kernel you are using.
  • austinmarton
    austinmarton about 9 years
    @edwardtorvalds that installs the kernel header files for your kernel, part of the kernel source required to compile drivers
  • Tomáš Zato - Reinstate Monica
    Tomáš Zato - Reinstate Monica over 7 years
    What tar file are you talking about in step 2?
  • mchid
    mchid over 7 years
    @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/s‌​table/v3.16/backport‌​s-3.16-1.tar.gz
  • mchid
    mchid over 7 years
    @TomášZato Also, this may be better because it is more new: askubuntu.com/questions/607830/…
  • PaulD
    PaulD about 7 years
    Do I need to execute command 'sudo apt-get dist-upgrade' if i use Ubuntu 16.04?
  • Christian Rondeau
    Christian Rondeau about 7 years
    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 :)
  • tothphu
    tothphu almost 7 years
    Note for newer versions of the device: askubuntu.com/questions/912498/tl-wn722n-is-not-recognized