2

I have followed this guide

https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/install-software

to set up my pi as a AP. I only changed drivers since I'm using a TP Link usd wifi. I'm using Jessie.

Everything work fine but I'm not able to start the deamon everytime I reboot the system. I think the problem is the hostapd; when I run

sudo service hostapd status -l

I get

hostapd.service - LSB: Advanced IEEE 802.11 management daemon
Loaded: loaded (/etc/init.d/hostapd)

Active: active (exited) since Fri 2016-04-08 14:22:49 UTC; 2s ago

Process: 1505 ExecStop=/etc/init.d/hostapd stop (code=exited, status=0/SUCCESS)

Process: 1542 ExecStart=/etc/init.d/hostapd start (code=exited, status=0/SUCCESS)

Apr 08 14:22:49 raspberrypi hostapd[1542]: Starting advanced IEEE 802.11 management: hostapd failed!

Apr 08 14:22:49 raspberrypi systemd[1]: Started LSB: Advanced IEEE 802.11 management daemon.

EDIT: for now I solved it reloading hostapd with this:

sleep 5 sudo service hostapd start

I made a script that runs at boot.

5 Answers 5

2

Old question, yet I've been running into the same issue and thought it was a driver problem. Not the case.

What i found after thorough examination was I had a wpa-supplicant config set on the wlan0 interface (the one I was working on). Solution is just to Delete or comment out the line.

Edit it with:

sudo nano /etc/network/interfaces

Comment or delete the line (e.g.)

allow-hotplug wlan0 iface wlan0 inet static
        address 10.0.0.1
        netmask 255.255.255.0
        network 10.0.0.0
        broadcast 10.0.0.255
       # wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
2
  • I had the same problem, but this didn't fix it. Any other solutions?
    – jath03
    Oct 2, 2016 at 0:20
  • Yes, it's only necessary to comment out the wpa supplicant for the wlan interface with the AP. At least on Raspbian Jessie. This allows to still run other wlan interfaces in non-AP station mode, for instance, to connect the Pi to another AP with Internet access. Removing the wpa supplicant completely, as suggested in the older answer doesn't appear to be a good idea, but a temporary workaround.
    – TheDiveO
    Jul 15, 2017 at 9:52
1

I followed the same tutorial, and had that same issue with the hostapd service. Verified the wpa_supplicant was commented out in my interfaces file, but still had to run through the "Removing WPA-Supplicant" section of that tutorial. Basically, they have you move the wpasupplicant.service file to the Pi user's home directory, using this command: sudo mv /usr/share/dbus-1/system-services/fi.epitest.hostap.WPASupplicant.service ~/

And then reboot.

0
1

For me, it was that the Password I set in the hostapd.conf was too short.. :D It has to be at least 8 characters

0
0

I stumbled across this post. I too was running into the same issues where Hostapd was starting but exiting. I followed the tutorial as above. To fix this, i ended up reloading the init.d hostapd file with this (https://www.apt-browse.org/browse/ubuntu/trusty/universe/i386/hostapd/1:2.1-0ubuntu1/file/etc/init.d/hostapd).

Then changing the Daemon Conf= line, saved and rebooted. everything is working on startup now.

This was my fix, so might work for someone else

1
  • So you had to fix what Adafruit's old instructions did break? At my desk is sitting right now a happy Pi Zero W with an AP and a second WLAN interface. I just set up the AP per the instructions from the Raspberry Pi Foundation, keeping wpa supplicant intact and only removing it from the AP wlan0. No need to restore config files from a different source...
    – TheDiveO
    Jul 15, 2017 at 9:55
0

With systemd there is actually a cleaner way to automatically restart services, such as hostapd.service is. In particular, this is an advantage of systemd over the traditional init V stuff, or some rc.local sleep-n-restart stuff. I successfully tested my approach on a set of Pi 3Bs with an additional Edimax WLAN dongle for AP.

So, edit /etc/systemd/system/hostapd.service and add to the section [service] these lines:

RestartSec=5
Restart=on-failure

Fortunately, systemd has a built-in check that will do only a limited number of restart attempts in case of failures. Normally, these settings should suffice.

More details can be found in systemd's documentation here: service unit configuration

Your Answer

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

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