Tiny Core Linux

Tiny Core Extensions => TCE News => TCE 2.x => Topic started by: curaga on October 10, 2009, 12:04:30 PM

Title: hostapd - wifi AP daemon
Post by: curaga on October 10, 2009, 12:04:30 PM
- My previous router was some crummy 200Mhz ARM, check out the new 12-core Istanbul one
- How's that different? Getting faster wlan?
- duh, it's the latency that counts


Quote
Title:          hostapd.tcz
Description:    Wlan AP mode daemon
Version:        0.6.9-3
Author:         Jouni Malinen
Original-site:  http://hostap.epitest.fi/hostapd
Copying-policy: GPL
Size:      172K
Extension_by:   Curaga
Comments:       Using this your comp can be a wireless access point.
      Open auth, WEP, WPA-PSK supported.
      Requires a mac80211 wireless driver (b43, ath*k, etc)
-
      Copy /usr/local/etc/hostapd.conf.sample somewhere, and
      run as:
      sudo hostapd /path/to/conf
Change-log:     
Current:        2009/10/10 Original
Title: Re: hostapd - wifi AP daemon
Post by: tcman on May 08, 2010, 02:49:12 AM
Hi Curaga,

I try to enable hostapd and got an error as below (I copied config file and renamed to apd.conf). Any clue on this please help.

tc@box:/mnt/sda1/tce$ sudo hostapd apd.conf
Configuration file: apd.conf
Failed to set interface wlan0 to master mode.
nl80211 driver initialization failed.
rmdir[ctrl_interface]: No such file or directory
ELOOP: remaining socket: sock=5 eloop_data=0x8f566c8 user_data=(nil) handler=0x806d047

My machine is Acer Aspire One 110 (8GB SSD)
Title: Re: hostapd - wifi AP daemon
Post by: curaga on May 08, 2010, 03:00:39 AM
- is your wifi interface named wlan0?
- are the drivers capable of master mode?
Title: Re: hostapd - wifi AP daemon
Post by: tcman on May 08, 2010, 07:29:14 AM
Thanks for your prompt reply.
- Yes, my wireless interface is wlan0.
- Checked/found ath5k driver used (Atheros AR2425 chip).
- Try to set master mode and got error.
tc@box:~$ sudo iwconfig wlan0 mode master
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Invalid argument.
Any idea?
Title: Re: hostapd - wifi AP daemon
Post by: curaga on May 08, 2010, 07:39:37 AM
That error is expected; master mode can only be set by hostapd nowadays.

See if there's more to the logs with increased verbosity (sudo hostapd -d -v /path/to/apd.conf)

edit: and of course, was the interface free? (ie. down, no udhcpc running on it etc)
Title: Re: hostapd - wifi AP daemon
Post by: curaga on May 08, 2010, 08:31:56 AM
Well, http://madwifi-project.org/wiki/UserDocs/ath5kAccessPoint claims it's only supported from .31 onwards. See if using the compat-wireless extension (wireless-2.6.29.1-tinycore_mod.tcz) instead of the normal one helps.
Title: Re: hostapd - wifi AP daemon
Post by: aris on December 21, 2017, 01:58:02 AM
hi there
Im trying to setup hostpad using old mini pci, I'm on amd geode 233 with 128MB ram..alix old board
I cant find hostpad.tcz for Linux box 4.2.9-tinycore version 7.2, so I coppied the tcz for v8 and with .dep file

load it and its working manually
Code: [Select]
sudo hostapd -B /usr/local/etc/config/hostapd.conf
tc@box:~$ ps | grep hostapd
 1013 root     hostapd /usr/local/etc/config/hostapd.conf

Problem is when I want to run it automatically

Code: [Select]
tc@box:~$ cat /opt/bootlocal.sh
#!/bin/sh
 
sudo hostapd -B /usr/local/etc/config/hostapd.conf
/usr/local/etc/init.d/openssh start &

It wont autostart, dmesg show no info about hostapd
I obviously missing something...any clue ?

and I cant connect to hostapd AP yet
with open (no security) ..playing with it now..

thanks
Title: Re: hostapd - wifi AP daemon
Post by: polikuo on December 21, 2017, 03:11:59 AM
hi there
Im trying to setup hostpad using old mini pci, I'm on amd geode 233 with 128MB ram..alix old board
I cant find hostpad.tcz for Linux box 4.2.9-tinycore version 7.2, so I coppied the tcz for v8 and with .dep file

load it and its working manually
Code: [Select]
sudo hostapd -B /usr/local/etc/config/hostapd.conf
tc@box:~$ ps | grep hostapd
 1013 root     hostapd /usr/local/etc/config/hostapd.conf

Problem is when I want to run it automatically

Code: [Select]
tc@box:~$ cat /opt/bootlocal.sh
#!/bin/sh
 
sudo hostapd -B /usr/local/etc/config/hostapd.conf
/usr/local/etc/init.d/openssh start &

It wont autostart, dmesg show no info about hostapd
I obviously missing something...any clue ?

and I cant connect to hostapd AP yet
with open (no security) ..playing with it now..

thanks

/opt/bootlocal.sh is already run by root, remove the "sudo" from the file and reboot.
Title: Re: hostapd - wifi AP daemon
Post by: curaga on December 21, 2017, 10:50:16 AM
..and if it still fails, look in its log file. You may need to enable syslog for the logs to appear.
Title: Re: hostapd - wifi AP daemon
Post by: aris on December 26, 2017, 05:47:29 PM
Hi @polikuo
I used sudo because the non sudo is not starting hostapd..but sudo doesnt start it also

Here is the log...still no hostapd running

Code: [Select]
ps | grep hostapd
 1058 tc       grep hostapd

cat /var/log/messages | grep Ather
Jan  1 00:12:49 box user.info kernel: ath5k: phy0: Atheros AR2413 chip found (MAC: 0x78, PHY: 0x45)

cat /var/log/messages | grep hostapd
Jan  1 00:12:08 box authpriv.notice sudo:       tc : TTY=unknown ; PWD=/mnt/sda1/tce/optional ; USER=root ; COMMAND=/bin/mkdir -p /tmp/tcloop/hostapd
Jan  1 00:12:08 box authpriv.notice sudo:       tc : TTY=unknown ; PWD=/mnt/sda1/tce/optional ; USER=root ; COMMAND=/bin/mount hostapd.tcz /tmp/tcloop/hostapd -t squashfs -o loop,ro,bs=4096
Jan  1 00:12:08 box authpriv.notice sudo:       tc : TTY=unknown ; PWD=/mnt/sda1/tce/optional ; USER=root ; COMMAND=/bin/cp -ais /tmp/tcloop/hostapd/usr /

tc@box:~$ date
Sat Jan  1 00:14:57 UTC 2000
Title: Re: hostapd - wifi AP daemon
Post by: Rich on December 26, 2017, 06:08:23 PM
Hi aris
Code: [Select]
tc@box:~$ cat /opt/bootlocal.sh
#!/bin/sh
 
sudo hostapd -B /usr/local/etc/config/hostapd.conf
/usr/local/etc/init.d/openssh start &
Is that the full result of the  cat  command or are there other entries in your  bootlocal.sh  file?
Title: Re: hostapd - wifi AP daemon
Post by: aris on December 27, 2017, 12:55:23 AM
Hi Rich
here is full bootlocal.sh
Code: [Select]
cat /opt/bootlocal.sh
#!/bin/sh
# put other system startup commands here
 #busybox httpd
#/usr/local/httpd/sbin/httpd -p 80 -h /mnt/sda1/wwwsite
 #apache2mod
#rm -rf /usr/local/apache2/htdocs
#ln -s /opt/apache2/htdocs /usr/local/apache2/htdocs
#ln -sf /opt/apache2/httpd.conf /usr/local/apache2/conf/
#apachectl start
 #eth0 205
/opt/eth0.sh
hostapd -B /usr/local/etc/config/hostapd.conf
/usr/local/etc/init.d/openssh start &

tc@box:~$
Title: Re: hostapd - wifi AP daemon
Post by: Rich on December 27, 2017, 06:43:11 AM
Hi aris
Try changing:
Code: [Select]
#!/bin/shto:
Code: [Select]
!/bin/sh
Title: Re: hostapd - wifi AP daemon
Post by: polikuo on December 27, 2017, 08:58:58 AM
Hi Rich.
Hi aris
Try changing:
Code: [Select]
#!/bin/shto:
Code: [Select]
!/bin/sh
I don't think shebang works that way.

Maybe you could try it this way instead.
Code: [Select]
/usr/local/bin/hostapd -B /usr/local/etc/config/hostapd.conf 2>&1 | tee /tmp/hostapd.log
Read the log file to see what happened.
BTW, it looks like there's no such file by default. (/usr/local/etc/config/hostapd.conf)
Did you add it into your /opt/.filetool.lst and backup ?
Title: Re: hostapd - wifi AP daemon
Post by: Rich on December 27, 2017, 09:39:36 AM
Hi polikuo
Hi Rich.
Hi aris
Try changing:
Code: [Select]
#!/bin/shto:
Code: [Select]
!/bin/sh
I don't think shebang works that way.
You are of course correct. I saw everything being commented out and my brain somehow shifted into stupid instead of drive. :o
Title: Re: hostapd - wifi AP daemon
Post by: aris on December 27, 2017, 06:10:29 PM
Hi Poliko and Rich
here it is..still no luck
Code: [Select]
tc@box:~$ ps | grep hostapd
 1011 tc       grep hostapd
tc@box:~$ cat /opt/bootlocal.sh
!/bin/sh
# put other system startup commands here
 #busybox httpd
#/usr/local/httpd/sbin/httpd -p 80 -h /mnt/sda1/wwwsite
 #apache2mod
#rm -rf /usr/local/apache2/htdocs
#ln -s /opt/apache2/htdocs /usr/local/apache2/htdocs
#ln -sf /opt/apache2/httpd.conf /usr/local/apache2/conf/
#apachectl start
 #eth0 205
/opt/eth0.sh
/opt/wlan0.sh
#hostapd -B /usr/local/etc/config/hostapd.conf 2>&1 | tee /tmp/hostapd.log
/usr/local/bin/hostapd -B /usr/local/etc/config/hostapd.conf 2>&1 | tee /tmp/hostapd.log
/usr/local/etc/init.d/openssh start &
tc@box:~$ cat /tmp/hostapd.log


and yes I add the /usr/local/etc/config/ folder in  /opt/.filetool.lst and backup
Title: Re: hostapd - wifi AP daemon
Post by: Rich on December 27, 2017, 06:29:50 PM
Hi aris
Poliko was correct. I was mistaken, the correct syntax is:
Code: [Select]
#!/bin/sh
Title: Re: hostapd - wifi AP daemon
Post by: aris on December 28, 2017, 06:30:37 PM
I tried with
#!/bin/sh and also with !/bin/sh..same thing..no log on /tmp/hostapd.log (file exist but no content)
and hostapd is not start.

Title: Re: hostapd - wifi AP daemon
Post by: Rich on December 28, 2017, 09:07:04 PM
Hi aris
It definitely has to be:
Code: [Select]
#!/bin/sh so make sure you've changed it back. I suspect the  hostapd  command is not being executed. Use the  ps  command and
see if any of the following are still running:

bootlocal.sh
eth0.sh
wlan0.sh

If  eth0.sh  or  wlan0.sh  are still running, post their contents.
Title: Re: hostapd - wifi AP daemon
Post by: polikuo on December 28, 2017, 11:10:46 PM
see if any of the following are still running:

bootlocal.sh
eth0.sh
wlan0.sh

If  eth0.sh  or  wlan0.sh  are still running, post their contents.

I don't think they'd still be running, however "openssh" most likely would be.
Title: Re: hostapd - wifi AP daemon
Post by: Rich on December 29, 2017, 06:01:53 AM
Hi polikuo
I don't think they'd still be running, however "openssh" most likely would be.
They shouldn't still be running, however,  eth0.sh  and  wlan0.sh  are run synchronously from  bootlocal.sh.  If one of them fails to
complete for some reason then the  hostapd  command will never execute and  bootlocal.sh  won't complete. The machine itself
will still finish coming up since  bootlocal.sh  is launched asynchronously  from  bootsync.sh.
Title: Re: hostapd - wifi AP daemon
Post by: aris on December 30, 2017, 01:15:17 AM
Hi Rich
I dont understand it..openssh is running (my alix board doesnt have monitor outpur so if ssh is the only way to access it), ip config from eth0.sh is running wlan0.sh is not, dhcpd is running ..
here is
Code: [Select]
ps
PID   USER     COMMAND
    1 root     init
    2 root     [kthreadd]
    3 root     [ksoftirqd/0]
    4 root     [kworker/0:0]
    5 root     [kworker/0:0H]
    6 root     [kworker/u2:0]
    7 root     [rcu_sched]
    8 root     [rcu_bh]
    9 root     [migration/0]
   10 root     [khelper]
   11 root     [netns]
   12 root     [perf]
   13 root     [writeback]
   14 root     [ksmd]
   15 root     [crypto]
   16 root     [kintegrityd]
   17 root     [bioset]
   18 root     [kblockd]
   19 root     [kworker/0:1]
   20 root     [ata_sff]
   21 root     [devfreq_wq]
   22 root     [rpciod]
   24 root     [kswapd0]
   25 root     [fsnotify_mark]
   26 root     [nfsiod]
   44 root     [kworker/u2:1]
   45 root     [nvme]
   46 root     [scsi_eh_0]
   47 root     [scsi_tmf_0]
   48 root     [scsi_eh_1]
   49 root     [scsi_tmf_1]
   50 root     [kworker/u2:2]
   51 root     [kworker/u2:3]
   52 root     [kpsmoused]
   53 root     [deferwq]
   54 root     [kworker/u2:4]
   55 root     [kworker/u2:5]
   87 root     /sbin/udevd --daemon
  156 root     /sbin/syslogd
  161 root     /sbin/klogd
  340 root     [kworker/u3:0]
  341 root     [kloopd0]
  342 root     [kworker/u3:1]
  365 root     [kloopd1]
  378 root     [kloopd2]
  391 root     [kloopd3]
  404 root     [kloopd4]
  405 root     [kworker/0:1H]
  418 root     [kloopd5]
  431 root     [kloopd6]
  444 root     [kloopd7]
  457 root     [kloopd8]
  458 root     [kworker/u3:2]
  471 root     [kloopd9]
  484 root     [kloopd10]
  497 root     [kloopd11]
  510 root     [kloopd12]
  523 root     [kloopd13]
  536 root     [kloopd14]
  549 root     [kloopd15]
  561 root     [kloopd16]
  574 root     [kloopd17]
  587 root     [kloopd18]
  600 root     [kloopd19]
  613 root     [kloopd20]
  626 root     [kloopd21]
  640 root     [kloopd22]
  653 root     [kloopd23]
  666 root     [kloopd24]
  679 root     [kloopd25]
  692 root     [kloopd26]
  705 root     [kloopd27]
  718 root     [kloopd28]
  731 root     [kloopd29]
  787 root     /sbin/udevd --daemon
  803 root     /sbin/udevd --daemon
  856 root     [cfg80211]
  870 tc       -sh
  926 root     udhcpd -f /etc/udhcpd.conf
  962 root     /usr/local/sbin/sshd
  967 root     /sbin/udhcpc -b -i eth1 -x hostname box -p /var/run/udhcpc.eth1.
  978 root     sshd: tc@pts/0
  982 tc       -sh
 1010 tc       ps

Hi polikuo
I don't think they'd still be running, however "openssh" most likely would be.
They shouldn't still be running, however,  eth0.sh  and  wlan0.sh  are run synchronously from  bootlocal.sh.  If one of them fails to
complete for some reason then the  hostapd  command will never execute and  bootlocal.sh  won't complete. The machine itself
will still finish coming up since  bootlocal.sh  is launched asynchronously  from  bootsync.sh.