Linux – “iw” and some of its commands do not return any output

debiandebian-wheezyhostapdlinuxwireless-networking

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.

Best Answer

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
Related Question