hostapd error "nl80211: Could not configure driver mode"
I would like to make a Virtual Router on Ubuntu 12.04
but i am getting this error message when i run the last terminal command
Configuration file: hostapd.conf
nl80211: Could not configure driver mode
nl80211 driver initialization failed.
hostapd_free_hapd_data: Interface wlan0 wasn't started
Solution 1:
As @bain has rightly pointed out, there is a bug raised in launchpad for this very purpose. This workaround suggested there works perfectly for me:
sudo nmcli nm wifi off
sudo rfkill unblock wlan
sudo ifconfig wlan0 10.15.0.1/24 up
sleep 1
sudo service isc-dhcp-server restart
sudo service hostapd restart
The first two lines stop wlan from network manager, and then unblocks the interface, so ifconfig can work.
UPDATE: But if for the first command you get the error message Error: Object 'nm' is unknown
then use this instead:
sudo nmcli radio wifi off
The next commands uses ifconfig to bring up wlan and allows a second's delay, then restart the dhcp server (though I did not need this restart in my setup), and finally start the hostapd service.
It should now start w/o any issues.
Solution 2:
I just had this error on Raspberry pi running Kali linux and hostapd 2.4 I suspected it is because some other network processes are keeping the interface busy, so I ran this airmon-ng command that checks and kills and processes that might use the wifi card:
airmon-ng check kill
To just see any network processes without killing them, use airmon-ng check
.
After I killed them, I started hostapd again and no errors came up anymore.
For some other network functionality you might need those processes, I restarted the raspberry for that, but they can also be started individually.
Solution 3:
Just mention that according to the bug linked by @bain, the easiest solution is to disable Network Manager for the interface that is to be run with hostapd.
As mentioned there:
WORKAROUND: For this to persist through reboots, execute the following in a terminal:
sudo nano /etc/NetworkManager/NetworkManager.conf
Add the following entry where the x's are replaced with your WiFi MAC address, save, and then reboot:
[keyfile]
unmanaged-devices=mac:xx:xx:xx:xx:xx:xx