In order to reach my Raspberry Pi 3 B +, I need it to broadcast an access point upon booting.
I am aware that there are common issues with crontab @reboot and systemctl running when networking is still down.
I have a working access point setup; however, the code seems to fail only when started through a service,
When I manually execute the following script,
ap.sh, it successfully initiates an access point (
touch yes.txt lets me know it has run):
#!/bin/bash cd /home/pi/ap/ sleep 30 ifconfig wlan0 down iwconfig wlan0 mode monitor ifconfig wlan0 up ifconfig wlan0 up 192.168.1.1 netmask 255.255.255.0 hostapd hostapd.conf & touch yes.txt
hostapd hostapd.conf & works, along with the rest of
However, as I mentioned before, I need a service to run this script, and so I made
[Install] WantedBy=multi-user.target [Unit] Description=Access Point Service Wants=network-online.target After=network-online.target [Service] User=root Group=root ExecStart=/home/pi/ap/ap.sh ExecStartPre=/bin/sleep 10 Type=simple
After my Pi boots, I see the following message when I check
service status ap:
Nov 17 00:27:18 raspberrypi systemd: Starting Access Point Service... Nov 17 00:27:28 raspberrypi systemd: Started Access Point Service. Nov 17 00:27:28 raspberrypi ap.sh: Error for wireless request "Set Mode" (8B06) : Nov 17 00:27:28 raspberrypi ap.sh: SET failed on device wlan0 ; Operation not supported.
As I understand it, the error is being thrown by hostapd. I'm not sure why though, since
ap.sh works perfectly well and the
ap service is run by root.
Also, the service successfully sleeps for thirty seconds, initiates
wlan0 with an IP address, and creates
/home/pi/ap, meaning that the failure seems to be isolated in
Any help would be much appreciated!