This is a cache of https://discuss.96boards.org/t/seeking-assistance-with-automating-hostapd-on-qualcomm-rb5-dev-kit/12570. It is a snapshot of the page at 2024-11-01T00:59:50.941+0000.
Seeking Assistance with Automating hostapd on Qualcomm RB5 Dev Kit - Qualcomm RB5 - 96Boards Forum

Seeking Assistance with Automating hostapd on Qualcomm RB5 Dev Kit

Hello Qualcomm RB5 Community,

I’m currently facing a challenge with automating the hostapd service on my Qualcomm RB5 development kit running ubuntu 20. The goal is to have hostapd start automatically on boot, but I’ve encountered an issue where it only works when I manually execute the commands post-boot, and not automatically upon system startup.

Issue Description: hostapd doesn’t start correctly upon reboot. It works flawlessly when I run the commands manually after the system has booted up, but these commands do not execute successfully on their own after a system restart.

Steps I’ve Tried:

  1. Script Creation: I’ve created a script (startup_script.sh) with necessary commands and placed it in /usr/local/bin:

bash

#!/bin/bash
ip route del default via 192.168.1.254 dev wlan0 || true
ip route del 192.168.1.0/24 dev wlan0 || true
ip route add 192.168.10.0/24 dev wlan0 || true
killall wpa_supplicant
ifconfig wlan0 192.168.10.1 netmask 255.255.255.0 up
dnsmasq --dhcp-range=192.168.10.10,192.168.10.100,12h --port=5353
hostapd /data/misc/wifi/hostapd.conf &


* **Systemd Service Creation:** To automate the script, I created a systemd service file (`network_automate.service`) in `/etc/systemd/system/`:

ini

* ```
[Unit]
Description=Custom Startup Script
After=network.target network-online.target
Wants=network-online.target

[Service]
Type=forking
ExecStartPre=/bin/sleep 15
Restart=on-failure
RestartSec=2
ExecStart=/bin/bash /usr/local/bin/startup_script.sh
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
  • Permissions and Enabling Service: Ensured the script is executable and enabled the service:

bash

sudo chmod +x /usr/local/bin/startup_script.sh
sudo systemctl enable network_automate.service


2. **Delay Introduction:** Based on advice from Raspberry Pi forums, I introduced a delay (15 seconds) in the service startup, but this didn't resolve the issue.
3. **Manual Service Start Works:** I can manually start the service post-boot without any issues.

**Seeking Further Advice:** Despite these steps, `hostapd` fails to start automatically upon boot. I suspect it might be related to network interfaces not being up in time or a potential conflict with other services like `wpa_supplicant`.

Has anyone in this community faced a similar issue or have insights on what might be going wrong? Any advice or recommendations would be greatly appreciated. I'm particularly interested in any Qualcomm RB5-specific configurations or nuances that I might be missing.

Thank you in advance for your time and help!