PDA

View Full Version : [SOLVED] Ubuntu Server 10.04 Hostapd daemon not starting



BadOpCode
May 28th, 2010, 12:04 PM
Weirdest thing ever and i'm going nuts trying to figure it out.

tried the command line

sudo /usr/sbin/hostapd -P /var/run/hostapd.pid -B /etc/hostapd/hostapd.conf

works no prob

so I figured maybe something buggered with the start-stop-daemon dealio in /etc/init.d/hostapd.
put the command line as it should look after all the stuff is filled in at a prompt. Works.
try to start script via sudo /etc/init.d/hostapd start script says its starting and gives a OK but the daemon never starts and its no where in memory when i do ps waux | grep hostapd
Is it just me or has other people ran into this?
How do I test a start script to see why its failing even though it says its not?
I'm totally mystified as everything works when i check manually. :confused:

BadOpCode
June 1st, 2010, 10:17 PM
I sat down and looked at the script a couple nights ago. The /etc/init.d/hostapd has a clause in it that it will exit if the config in /etc/default/hostapd does not have RUN_DAEMON="YES"
Even though the forced to run as a daemon (-B) switch is being used so there its not going to be any other way as-is.
On my setup /etc/default/hostapd had RUN_DAEMON="YES" commented out.
Ya this is a silly mistake on my part as I should have been able to catch this sooner. But I never dreamed someone would add such a dumb clause and require everyone to go digging through scripts in order to get the daemon to load.
I mean... wouldn't it make more sense if it was ...


if [ $RUN_DAEMON == "NO" ]; then
exit 0
fi

rather than...


if [ $RUN_DAEMON != "YES" ]; then
exit 0
fi

that way if nothing is specified at all it would default to yes and the script would load the daemon.
Unless the idea is we are going to have Micro$oft's "Are you REALLY sure?" style of scripts.

irose123
June 15th, 2010, 01:40 PM
On my setup /etc/default/hostapd had RUN_DAEMON="YES" commented out.


So glad you found this, I would have spent ages trying to solve exactly the same problem on my lucid server: works when run manually as you describe, but daemon doesn't seem to start at boot time though.

I just uncommented the line above and restarted, and bingo, hostapd now runs at startup!

schodt
July 14th, 2010, 10:28 PM
On my setup /etc/default/hostapd had RUN_DAEMON="YES" commented out.

Thanks a lot. That helped me.

dcosmin
September 21st, 2010, 11:39 PM
Thanks ! Its working :P

EddieO2
September 25th, 2010, 11:23 PM
Thanks!
I've been tearing my hair out over this one!

markturnip
January 9th, 2011, 09:52 PM
I'm also having an issue with the Hostapd daemon not starting.

Running sudo /usr/sbin/hostapd -P /var/run/hostapd.pid -B /etc/hostapd/hostapd.conf also works fine for me & returns:
Using interface wlan0 with hwaddr 18:f4:6a:a7:51:8d and ssid '

However if I run /etc/init.d/hostapd start it doesn't do anything nor return with a message.
Would you mind posting your hostapd daemon here?

Thanks.

merlinblack
April 27th, 2011, 04:58 AM
I think the RUN_DAEMON in /etc/default/hostapd refers to if hostapd should be run or not at all - in contrast to the -B switch.

This saves having to edit symlinks in the rc?.d directories when you want to enable or disable running it on boot.

But that's just a educated guess.

HonoredMule
September 22nd, 2012, 07:32 AM
It appears that in Precise someone tried to fix the issue, and actually made it worse. RUN_DAEMON is no longer included in the package-supplied /etc/default/hostapd file, nor is it checked in the init script anymore. So, you'd think it's no longer needed--and you'd be wrong.

To make matters worse, neither the init script (which by the way is still pure classic sysVinit) nor the default config specify the location of the configuration file. So in /etc/default/config you must explicitly define RUN_DAEMON and DAEMON_CONF or hostapd won't start nor report any error. It's possible I missed it, but there don't seem to even be any errors in /var/log/syslog or /var/log/messages.

Perhaps the release team is trying to score one of these (http://www.thinkgeek.com/product/f141/?cpg=gplus).