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

6 Answers 6


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 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.

  • 6
    Newer nmcli requires this syntax sudo nmcli radio wifi off :)
    – m132
    May 14, 2015 at 20:01
  • This did not change anything
    – TSR
    Jun 24, 2017 at 9:20

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.


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:
  • First thing that works! Network manager was not letting me use my Intel 8260 with hostapd.
    – Torrien
    Jun 6, 2016 at 10:46
  • and how i can know if NetworkManager its using it?
    – Arnold Roa
    Jul 14, 2020 at 3:39

I ran into the same issue. The first thing I tried was to manually update hostapd from a debian repository from v2.1 to v2.3 . The issue persisted.

I created this script, which is a list of commands that unblock the WLAN driver, and now I finally have a working AP, already deployed in a remote location.

I saved the script to /usr/bin/enableAP.sh. Make sure to include it into your crontab so that it is executed at boot.

/bin/sleep 30
/usr/sbin/service hostapd stop
/usr/sbin/service network-manager stop
/sbin/ifdown wlan0
/sbin/iwconfig wlan0 mode Managed
/usr/sbin/rfkill unblock wlan
/usr/bin/nmcli radio wifi off
/usr/sbin/service hostapd stop
/bin/sleep 10
/usr/sbin/service hostapd start

if you want to avoid this issue just after installing your new virtual machine and hostapd, you need to block ubuntu from upgrading hostapd: when you use sudo apt-get upgrade it upgrades this package to v2.1, which doesn't work (surely bugged).

You must use sudo apt-mark hold hostapd to block future upgrades to Hostapd.

  • This fixed my issue.
    – Joe
    Apr 18, 2022 at 22:50

Try this:

  1. Click the network icon
  2. Select "Create wireless network"
  3. Choose a name, encryption type and password
  4. Click create
  5. Make sure you're connected to the internet.

The solution for me was stopping (which is handled indeed by airmon-ng check kill, but that is not necessarily avaialable on the system) wpa_supplicant, otherwise kept getting "Could not configure driver mode"

systemctl stop wpa_supplicant.service

or via

pkill wpa_supplicant

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.