How fix hostapd invalid/unknown driver 'nl80211' error?

47,583

Solution 1

You need to build, or obtain, a different copy of hostapd. The one you have has been built with the option CONFIG_DRIVER_NL80211 set to N, rather than Y.

There are simple and detailed instructions how to rebuild it here → Hostapd building instruction. Rebuild it with the option enabled. You may have to google for hostapd.2.0.tar.gz, but do exactly as it mentioned in link.

As for the follow-up question/error try to install this library libssl-dev using this command:

sudo apt-get install libssl-dev

Solution 2

You see the spaces after the values? Remove them.

  • Line 2: invalid/unknown driver 'nl80211 '

  • Line 4: unknown hw_mode 'g '

Solution 3

Check for EOL format. It should be in UNIX format as < LF > and not < CR >< LF >. That fixed mine error.

Solution 4

I had a similar Problem, but without the spaces after the values and managed to solve it:

Before I encountered the Problem, I copied the hostapd.conf file from my Windows pc onto my Raspberry Pi. And I believe the problem was, that the text had special characters. Maybe some returns were different (Because I had a return instead of a space after the values in the errors)

But enough speculation, let's come to my solution:

  1. I renamed the old hostapd.conf file (to hostapdOld.conf)
  2. I created a new file with the name hostapd.conf
  3. And then I copied the whole content of the old file to the new one. (I just selected the whole text, didn't use Ctrl+A, if this even matters)

Then I ran hostapd as usual, with:

sudo hostapd -d /etc/hostapd/hostapd.conf

And it worked again

Share:
47,583

Related videos on Youtube

Tarek
Author by

Tarek

Updated on September 18, 2022

Comments

  • Tarek
    Tarek over 1 year
    • I have Intel Centrino Wireless-N 1000
    • I installed hostapd from Ubuntu Software Center
    • When I run this command hostapd hostapd-minimal.conf I get this:

      root@tarek-PC:~# hostapd hostapd-minimal.conf
      Configuration file: hostapd-minimal.conf
      Line 2: invalid/unknown driver 'nl80211 '
      Line 4: unknown hw_mode 'g '
      2 errors found in configuration file 'hostapd-minimal.conf'
      

    After doing make first I had this error:

    driver_nl80211.c:25:26: warning: netlink/attr.h: No such file or directory
    

    I solved it by installing libnl-1.0pre8

    Now I have this error when doing make command:

    ../src/crypto/crypto_openssl.c:10:30: fatal error: openssl/opensslv.h: No such file or directory
    compilation terminated.
    make: *** [../src/crypto/crypto_openssl.o] Error 1
    

    Can anyone help me with that error I am running Ubuntu 13.04?

  • Tarek
    Tarek almost 11 years
    thank you for answer when I was following "Hostapd building instruction" I had an error. I edited my question please read my question for the error details if you want to help me
  • Michael.MA
    Michael.MA almost 11 years
    Ok try this solution above.
  • Tarek
    Tarek almost 11 years
    thank you pourjour for helping your solutions worked with me :) .I get sick from this now I have got a new error please see this [question] (askubuntu.com/questions/298368/…) if you want to help me
  • Roalt
    Roalt over 10 years
    I had simular problem when cutting/pasting a hostapd.conf from a website: hostapd is due to a bad implementation very sensitive to whitespaces. Also make sure your interface=<device> in hostapd.conf does not end with a space character, you will get a strange "nl80211: Register Action command failed: ret=-19" error otherwise...
  • Josh P
    Josh P about 8 years
    This worked for me as well. I was trying to get my ErleRobotics PXFMini + RPiZero drone working with a Ralink RT5370 adapter I already had. When I pulled down the source for hostapd it already had CONFIG_DRIVER_NL80211 set to Y. So I just had to pull down the source and build it without making any changes. I did have to comment out some unsupported settings in the hostapd.conf file that came with the SDcard image from erlerobotics like DEVICENAME and MANUFACTURER. But now it works great!