"iw" and some of its commands do not return any output

18,220

Solution 1

You need to install wireless_tools

Open a terminal and type the following commands:

aptitude install wireless-tools

Restart network services:

/etc/init.d/networking restart

Update

You need to add interfaces with iw

iw dev wlan0 interface add <name> type <type>

For wired connection:

iw phy phy0 interface add <name> type <type>

There are several modes supported. The modes supported are:

  • monitor

  • managed [also station]

  • wds

  • mesh [also mp]

  • ibss [also adhoc]

Example:

iw phy phy0 interface add moni0 type monitor
iw dev wlan0 interface add wlan0 type station

Solution 2

Install the iw package,

 apt-get install iw

then you will have the iw command.

EDIT:

it is pretty obvious at this moment that you have a bug somewhere. You have the following alternatives:

  1. Since you have a very old kernel, 3.4.90 (see here), you may wish to dramatically update your kernel. There are guides to do this all over Google.

  2. you may try to recompile the device driver, in the hope that the bug is there, not in the old version of iw you run. You do this as follows: downloads Linux backports from here, go to the directory where you downloaded the above file, and give these commands:

    sudo apt-get install linux-headers-$(uname -r) build-essential firmware-realtek
    tar xvfz backports-4.4.2-1.tar.gz
    cd backports-4.4.2-1/
    make defconfig-rtlwifi
    make
    sudo make install
    

Reboot, try your iw commands again. If this fails, I can only suggest updating your old kernel: 3.4 was released in May 2012.

Share:
18,220

Related videos on Youtube

vaid
Author by

vaid

Updated on September 18, 2022

Comments

  • vaid
    vaid almost 2 years

    I've been trying to set up my ARM based computer so that it becomes a hotspot and a client at the same time.

    However all of the information I've found about such functionality mention the iw command which seems to be crucial for me to solve the problem I'm having.

    It does not seem to work properly for me.

    When I type iw wlan0 info I get the error message command failed: No such device (-19).

    Why is this happening?

    I'm on Debian Wheezy.

    EDIT: I have a fully functional WiFi dongle connected to the ARM computer. The WiFi dongle is the only connection to my network.

    The Wifi dongle is based on RTL8188CUS.

    IMPORTANT

    I managed to get it to work briefly by doing the following:

    Add contrib non-free to the first two sources in /etc/apt/sources.list

    Run apt-get update Run apt-get upgrade

    Run apt-get install firmware-realtek

    Connect wifi dongle

    Run iw list, it works now.

    Kind of off topic, but related to why I need IW to work, and I'll get back to IW after my explanation

    The wifi dongle I have uses an RTL8188CUS chip, and according to RealTek's release notes this chip should support mixed modes as of version 4.0.0_5967.2021201.

    By mixed modes I mean Station+Station, Station+AP, Station+P2P.

    Note: The mode "Station" is also refered to as "Managed"

    I've been trying to figure out how to make this chip use the Station+AP for months now, however, old drivers have been installed on every system I've used and set up, until I found this (which I'm trying now): https://github.com/pvaret/rtl8192cu-fixes

    I've found some more resources which I'll try later.

    NOW, back to IW;

    IW seems to stop working when the wrong drivers are used.

    Even though I use the wrong drivers, I still manage to connect the Wifi dongle to any network, but IW no longer recognizes the device.

    IWCONFIG works fine, IFCONFIG works fine.

    So I believe that the wrong drivers will cause commands such as iw dev to stop working.

    Additional information: the module 8192cu is never loaded when following the installation steps in the GITHUB above.

    I know, they are not for the same driver, but they should still work for 8188cu according to RealTek.

  • vaid
    vaid over 8 years
    It says that wireless-tools is already installed.
  • vaid
    vaid over 8 years
    iwconfig works fine. It shows my WiFi device as expected.
  • vaid
    vaid over 8 years
    btw, you've been trying to help me with something related to this before @MariusMatutiae. And I still haven't solved it.
  • vaid
    vaid over 8 years
    iw is also insatalled. I've reinstalled it as well.
  • vaid
    vaid over 8 years
    By doing iw dev wlan0 interface add <name> type <type> I just get help information which tries to tell me how to use iw.
  • vaid
    vaid over 8 years
    I think that iw doesn't know what physical devices are available somehow.
  • vaid
    vaid over 8 years
    Yes. I do everything in root.
  • vaid
    vaid over 8 years
    Sorry for not being clear. That's exactly how I wrote it. I replaced <name> with wlan0 and <type> with managed because it worked on my other computer which is x86 based.
  • vaid
    vaid over 8 years
    Yes, wpa_supplicant is also installed.
  • vaid
    vaid over 8 years
    I don't have any other wifi adapter, however, when I connect the wifi adapter that I am using in to my x86 linux computer iw works fine.
  • GAD3R
    GAD3R over 8 years
    the ouput of rfkill list
  • vaid
    vaid over 8 years
    it says bash: rfkill: command not found I guess I have to install it
  • vaid
    vaid over 8 years
    I installed it, now when I write rfkill list it returns nothing. It just goes straight to bash again.
  • vaid
    vaid over 8 years
    Sure, can I use a command to figure out the vendor and product code?
  • vaid
    vaid over 8 years
    Here's the output of lsusb: Bus 004 Device 003: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
  • vaid
    vaid over 8 years
    Ok, the line sudo apt-get install linux-headers-$(uname -r) build-essential firmware-realtek gives me the error E: Unable to locate package linux-headers-3.4.90 and E: Couldn't find any package by regex 'linux-headers-3.4.90'. I've encountered this before, but I don't recall resolving it.
  • vaid
    vaid over 8 years
    I'm sorry, this is just insane. I can't find ANY information about why iw <commands> does not work. It also stopped working on my x86 Linux computer for some reason. I've installed a fresh version of Debian Jessie on VirtualBox and same thing there. It just won't work and it's driving me crazy. Why does it not work?
  • vaid
    vaid over 8 years
    Could it be that some service is using the device so that iw can't read it? When I write iw wlan0 link it says Not connected
  • vaid
    vaid over 8 years
    Please see my edit in the question
  • vaid
    vaid over 8 years
    please see the edit in my question. btw, I never managed to get rfkill to work