Hostapd requires manual restart for devices to connect
Solution 1
The fix below 'worked' for me, however devices would disconnect after a short period of time. Ultimately I clean installed Ubuntu 12.04 and all seems to work fine.
Remove the hostapd service from the rcX files to prevent the service from automatically starting;
sudo update-rc.d -f hostapd remove
Provide a Cron Job to start the service shortly after boot
- Then provide a Cron job to restart the service shortly after starting
To modify Cron file;
sudo crontab -e
Here are the Cron Jobs I added;
@reboot sleep 10; /fixscripts/hostapdstart.sh
@reboot sleep 25; /fixscripts/hostapdrestart.sh
This starts the service 10 seconds after boot, and then restarts it 15(25-10) seconds later.
Solution 2
After restarting my hostapd based access point, clients (android phones) were not reconnecting automatically and "authentication problem" was displayed under the SSID name and we had to enter the password again.
I found that using /dev/urandom instead of /dev/random (which is blocking and causing authentication timeouts)
eg with this in /etc/rc.local:
#!/bin/bash
if [ ! -f /dev/random.orig ] ; then
mv /dev/random /dev/random.orig
ln /dev/urandom /dev/random
fi
or (if you believe it's wiser) installing haveged instead (to increment(?) the entropy without blocking /dev/random) were solving the problem.
eg with:
apt-get install haveged
Related videos on Youtube
Alex
I am a software engineer for British Telecommunications mainly writing web and test automation apps in java/c#/javascript I graduated from the University of Bristol (England) with a Upper Second Class (2:1) Masters Degree in Electrical & Electronic Engineering. I also have experience with C, C++, Python and VBS
Updated on September 18, 2022Comments
-
Alex over 1 year
I am currently setting up a WiFi hotspot for the padres using their NAS with WiFi card.
Setup: Ubuntu 13.10
Hostapd is bridged with eth0 (br0), and works great if manually restarted
sudo service hostapd restart
* Stopping advanced IEEE 802.11 management hostapd [ OK ]
* Starting advanced IEEE 802.11 management hostapd [ OK }However, upon reboot the SSID is visible, but when trying to connect I am presented with (authentication error / incorrect password) from wireless devices.
If the above command is executed over ssh/local terminal, then all devices connect perfectly.
In order to work around this, I tried adding a delayed cron job to restart the service;
@reboot sleep 30; /fixscripts/hostapdstart.sh
I even wrote a script to stop the service and start it 60 seconds later in a similar format to above. (I believe the scripts did execute, because the SSID would dissapear, and reappear 60 seconds later).
However as per the original issue wifi devices were still presented with the authentication errors, and as before if I log on and manually restart the service it works!
Below is my hostapd.conf;
ssid=Caprica
wpa_passphrase=mypassword
interface=wlan0
bridge=br0
auth_algs=3
channel=7
driver=nl80211
hw_mode=g
ieee80211n=1
wmm_enabled=1
logger_stdout=-1
logger_stdout_level=2
max_num_sta=5
rsn_pairwise=CCMP
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP-
MariusMatutiae over 10 yearsDid you turn off network-manager? If you do not, it will try to get hold of wlan0
-
Alex over 10 yearsWhen turned off, the SSID takes ages to appear and none of my devices can connect, even after a manual restart.
-
MariusMatutiae over 10 yearsDid you configure the bridge in your /etc/network/interfaces file?
-
Alex over 10 yearsYes the bridge is up & running, bridged eth0 & eth1 as well as hostapd adding wlan0 to bridge. Ethernet runs smoothly, and wifi can use the bridge when devices connect.
-