Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I am having trouble getting hostapd to start as a service. It fails when I try to start it:

$ sudo service hostapd start
[FAIL] Starting advanced IEEE 802.11 management: hostapd failed!

From what I understand, this uses the configuration in /etc/default/hostapd:

$ cat /etc/default/hostapd 
# Defaults for hostapd initscript
# See /usr/share/doc/hostapd/README.Debian for information about alternative
# methods of managing hostapd.
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
# file and hostapd will be started during system boot. An example configuration
# file can be found at /usr/share/doc/hostapd/examples/hostapd.conf.gz

# Additional daemon options to be appended to hostapd command:-
#   -d   show more debug messages (-dd for even more)
#   -K   include key data in debug messages
#   -t   include timestamps in some debug messages
# Note that -B (daemon mode) and -P (pidfile) options are automatically
# configured by the init.d script and must not be added to DAEMON_OPTS.

My daemon configuration file is as follows:

$ cat /etc/hostapd/hostapd.conf

Despite the service failing to start, I am able to start it directly on my own without error:

$ sudo hostapd -d /etc/hostapd/hostapd.conf
random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
Configure bridge br0 for EAPOL traffic.
BSS count 1, BSSID mask 00:00:00:00:00:00 (0 bits)
Completing interface initialization
Mode: IEEE 802.11g  Channel: 1  Frequency: 2412 MHz
RATE[0] rate=10 flags=0x1
RATE[1] rate=20 flags=0x1
RATE[2] rate=55 flags=0x1
RATE[3] rate=110 flags=0x1
RATE[4] rate=60 flags=0x0
RATE[5] rate=90 flags=0x0
RATE[6] rate=120 flags=0x0
RATE[7] rate=180 flags=0x0
RATE[8] rate=240 flags=0x0
RATE[9] rate=360 flags=0x0
RATE[10] rate=480 flags=0x0
RATE[11] rate=540 flags=0x0
Flushing old station entries
Deauthenticate all stations
+rtl871x_sta_deauth_ops, ff:ff:ff:ff:ff:ff is deauth, reason=2
Using interface wlan0 with hwaddr 80:1f:02:d3:cb:b8 and ssid 'KITT'
Deriving WPA PSK based on passphrase
SSID - hexdump_ascii(len=4):
     4b 49 54 54                                       KITT
PSK (ASCII passphrase) - hexdump_ascii(len=18): [REMOVED]
PSK (from passphrase) - hexdump(len=32): [REMOVED]
urandom: Got 20/20 bytes from /dev/urandom
GMK - hexdump(len=32): [REMOVED]
Key Counter - hexdump(len=32): [REMOVED]
WPA: group state machine entering state GTK_INIT (VLAN-ID 0)
GTK - hexdump(len=32): [REMOVED]
WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)
rtl871x_set_hidden_ssid ignore_broadcast_ssid:0, KITT,4
wlan0: Setup of interface done.
share|improve this question

7 Answers 7

I just ran into this problem. By default install on my raspian wheezy, hostapd is started as S01 in services. This makes it start before ifplugd which configures eth0 and wlan0. The reason for this is that S01h[ostapd] < S01i[fplugd] since scripts are sorted in alphabetical order for execution.

I think that the bridge gets a hard time getting configured before everything else. Moving it to S05 didn't help either so I moved it to rc.local instead, which gets executed "a while" after everything else. I also removed all links from rc[2-5].d to hostapd. I think that S05 is still too soon for dhclient to finish properly. I am not sure this is according to the best practices. What seems to happen now is that ifplugd fails to bring br0 up but eth0 is more cooperative. I am not sure why wpa_supplicant fails here, probably because wlan0 is already promised to br0. It needs to be disabled anyway. Later on, hostapd tries to bring br0 up again and succeeds since eth0 is ok and no one took control of wlan0.

There is another possible configuration where you could specify a post-up/pre-down option for br0 in /etc/network/interfaces (man interfaces). You could start/stop hostapd from there. I didn't manage to get it to work however, but this looks like a much cleaner solution.

share|improve this answer

All what you have to do is to write this command:

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

it will list you all errors, you can then correct them in hostapd.conf file

sudo nano /etc/hostapd/hostapd.conf
share|improve this answer

you have to configure:

sudo nano /etc/default/hostapd


Find the line above and tell the defaul config where your one is.

share|improve this answer

This was a problem for me also and obviously still exists. I fixed the errors by removing hostapd from /etc/rc2.d/ and /etc/networking/if-pre-up.d/

/etc/network/interfaces controls hostapd now..

iface wlan0 inet static
         post-up /usr/sbin/hostapd -B /etc/hostapd/hostapd.conf
         post-up service isc-dhcp-server restart

A reboot confirmed it brings up the interface; and Stations connect fine. Previously I had to ssh in and stop isc and hostapd and do what the post-up now does (in that order)

share|improve this answer

This isn't directly related to the failure here... but I ran into stack exchange before the ubuntu forums on google...

If you are having issues getting hostapd to run via init.d (service hostapd start) and nothing seems to be occurring... refer to this forum post.

share|improve this answer

I think the problem is with your quotes on line 11 of /etc/default/hostapd:


Which should read:


Your post actually helped me solve my problem, so thanks!

share|improve this answer

You need to set DAEMON_CONF in /etc/init.d/hostpad.

It's really quite obvious if you look into /etc/init.d/hostapd, the default looks like this:

14 PATH=/sbin:/bin:/usr/sbin:/usr/bin
15 DAEMON_SBIN=/usr/sbin/hostapd
16 DAEMON_DEFS=/etc/default/hostapd
18 NAME=hostapd
19 DESC="advanced IEEE 802.11 management"
20 PIDFILE=/var/run/
22 [ -x "$DAEMON_SBIN" ] || exit 0
23 [ -s "$DAEMON_DEFS" ] && . /etc/default/hostapd
24 [ -n "$DAEMON_CONF" ] || exit 0

because DAEMON_CONF is empty to start with, the script exits at line 24. Too bad there is no error message or anything. Changing line 17 to


and putting the configuration in the specified file worked for me.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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