1

I've followed this guide to enable both AP and client modes in my RPi 3 at the same time, and it's working fine (some tweaking involved). But now I'm trying to start the AP on boot, which is covered in the guide adding a script to rc.local. Thing is, it's not working. The script is firing, but the AP is not starting. I removed it from rc.local and wrote a service unit for systemd, which doesn't seem to be firing at all (on boot). If I manually start the service (sudo service accesspoint start) it works as intended, so the problem is that it's not starting the service on boot. If I call sudo service accesspoint status -l after boot, it shows:

● accesspoint.service - Access Point Service
   Loaded: loaded (/lib/systemd/system/accesspoint.service; disabled)
   Active: inactive (dead)

After manually starting it, it shows:

● accesspoint.service - Access Point Service
   Loaded: loaded (/lib/systemd/system/accesspoint.service; disabled)
   Active: active (running) since Mon 2016-12-05 10:58:17 COT; 6s ago
 Main PID: 1550 (bash)
   CGroup: /system.slice/accesspoint.service
           ├─1550 /bin/bash /usr/local/bin/hostapdstart
           └─1737 hostapd /etc/hostapd/hostapd.conf

So it's definitely not being called on boot. The service unit file is as follows:

[Unit]
Description=Access Point Service
After=multi-user.target

[Service]
Type=idle
ExecStart=/bin/bash /usr/local/bin/hostapdstart

[Install]
WantedBy=multi-user.target

I have a similar service unit managing the GPIO, and it works fine, it starts on boot without problem. Maybe it has to do with the order of execution? I don't know enought about how linux works to find out where it's failing to start, so I'll include the hostapd start script aswell:

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
iw dev wlan0 interface add uap0 type __ap
service dnsmasq restart
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -s 10.0.0.0/24 ! -d 10.0.0.0/24 -j MASQUERADE
ifup uap0
hostapd /etc/hostapd/hostapd.conf

I guess the problem is that it's failing to create the uap0 device, since it's not showing on ifconfig (that is, if the script is being called at all). So any insight about what can be going wrong would be greatly appreciated.

BTW, I'm running Raspbian Jessie Lite on a Raspberry Pi 3.

2

Loaded: loaded (/lib/systemd/system/accesspoint.service; disabled)

Note the "disabled" part. This means the service is not set to run at boot. Try:

sudo systemctl enable accesspoint

I notice you are using service, which is just there for backward compatibility with SysV (used on the older version of Raspbian). In this case it just calls the new systemd commands and you might as well use them directly (the output will be much the same). So enable won't say anything, but subsequently:

sudo systemctl status accesspoint

Should show it as "enabled". This doesn't actually start it (use sudo systemctl start accesspoint) but it should set it to start at boot.

That doesn't necessarily mean it will succeed, but if it doesn't another status (optionally also -l) call after boot, before trying to start or restart, should provide a clue as to why.

  • You are absolutely right!! I forgot to enable the service. ¬¬ Thank you very much! – Christian Rodriguez Dec 5 '16 at 16:44

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.