1

I spend the whole day to understand how to use the Raspberry (1 B+) as access point with the awus036nha with scratch, following this guide, Setting up a Raspberry Pi as an access point in a standalone network (NAT), but can't start hostapd after boot, wpa_supplicant is disabled:

sudo nano /etc/dhcpcd.conf  
.(blablabla)
.
.
# fallback to static profile on eth0
#interface eth0
#fallback static_eth0
interface wlan0
static ip_address=192.168.2.1/24
nohook wpa_supplicant

I have noticed that I need to kill hostapd after boot with

sudo killall hostapd , 

and then restart again to make it works with

 sudo hostapd /etc/hostapd/hostapd.conf

and with this, everything works... but the auto start not, I've already added at /etc/default/hostapd

DAEMON_CONF="/etc/hostapd/hostapd.conf"

and did an

 sudo apt-get update
 sudo apt-get upgrade

Any suggestion?

EDIT: doing

sudo systemctl enable hostapd


pi@raspberrypi:~ $ sudo systemctl status hostapd
hostapd.service - LSB: Advanced IEEE 802.11 management d
Loaded: loaded (/etc/init.d/hostapd; generated; vendor 
Active: active (running) since Sun 2018-08-05 14:34:26 
Docs: man:systemd-sysv-generator(8)
Process: 328 ExecStart=/etc/init.d/hostapd start (code=e
CGroup: /system.slice/hostapd.service
└─466 /usr/sbin/hostapd -B -P /run/hostapd.pid 

ago 05 14:34:18 raspberrypi systemd[1]: Starting LSB: Adva
ago 05 14:34:26 raspberrypi hostapd[328]: Starting advance
ago 05 14:34:26 raspberrypi systemd[1]: Started LSB: Advan
lines 1-11/11 (END)...skipping...
● hostapd.service - LSB: Advanced IEEE 802.11 management daemon

Loaded: loaded (/etc/init.d/hostapd; generated; vendor preset: enabled)
Active: active (running) since Sun 2018-08-05 14:34:26 CEST; 2min 28s ago
Docs: man:systemd-sysv-generator(8)
Process: 328 ExecStart=/etc/init.d/hostapd start (code=exited, 
status=0/SUCCESS)
CGroup: /system.slice/hostapd.service
       └─466 /usr/sbin/hostapd -B -P /run/hostapd.pid 
/etc/hostapd/hostapd.conf
ago 05 14:34:18 raspberrypi systemd[1]: Starting LSB: Advanced IEEE 802.11 m 
management daemon...
ago 05 14:34:26 raspberrypi hostapd[328]: Starting advanced IEEE 802.11 
management: hostapd.
ago 05 14:34:26 raspberrypi systemd[1]: Started LSB: Advanced IEEE 802.11 
management daemon.

EDIT2:

sudo nano  /etc/init.d/hostapd

....(blabla)...
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON_SBIN=/usr/sbin/hostapd
DAEMON_DEFS=/etc/default/hostapd
DAEMON_CONF=
NAME=hostapd
...
  • Did you try 'sudo systemctl enable hostapd'? And check the status with 'sudo systemctl status hostapd'? – Dirk Aug 5 '18 at 11:56
  • @Dirk thanks for your help, i have update the post with the output ( still not working after reboot) – Stefano Aug 5 '18 at 12:44
  • AFAICT it's running. Am I missing something? – Dirk Aug 5 '18 at 13:21
  • @Dirk exacly, but no AP is showing, i need to do a "sudo service hostapd restart" to make it appear.. any suggestion? could I use some workaround to make it restart automatically? maybe with rc.local? – Stefano Aug 5 '18 at 13:42
  • rc.local is probably the least reliable of all possible solutions. You have no control over when it runs during startup. I have no idea why it's not working; probably some sort of sequence problem, but wlan0 must be up otherwise I would expect it to fail. – Dirk Aug 5 '18 at 13:48
2

I've resolved by myself, I have made a script in bash that restart the hostapd service with

 #!/bin/bash
 service hostapd restart

and make it executable with

  sudo chmod +x /location/file

then used

 sudo visudo

and make the file executable without asking for password, adding in the file

 [your_username] ALL= NOPASSWD: /location/of/file

went in

  cd /home/pi/.config/autostart
  sudo nano name.desktop

and adding in the file

 [Desktop Entry]
 Encoding=UTF-8
 Type=Application
 Name=name
 Comment=restart hostapd service
 Exec=sudo lxterminal -e "/location/of/the/file"

This file will be executable after the GUI is loaded, and this file will call the bash script in sudo mode, without asking for password, restarting hostapd service after boot... maybe is not the smartest solution but I spent two days on it and didn't found much help.

EDIT: My fault, I had edited (following another guide) /etc/network/interfaces and my configuration at /etc/dhcpcd.conf were not loaded, so I just uncommented the interface configuration and everything worked as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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