You are not logged in.
I am using a raspberrypi as a portable WiFi hotspot. This has been working fine until a recent update and I am not sure why it is broken. I have a service that assigns and IP address to the wlan0 interface before hostapd starts:
[Unit]
Description=Add static ip for wireless
Before=hostapd.service
After=network.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/ip addr add 10.0.0.1/24 dev wlan0 brd + dev wlan0
[Install]
WantedBy=multi-user.target
However, when I get the following when I look at the logs:
journalctl -u wifi-hostapd.service
Jan 01 01:00:15 routerpi ip[139]: Cannot find device "wlan0"
If I run the service manually after booting it starts correctly and wlan0 is assigned an ip address. I am assuming that I am starting the service at the wrong time.
Last edited by geekinthesticks (2014-03-27 08:29:49)
Offline
Add
BindsTo=sys-subsystem-net-devices-wlan0.device
to the Unit section.
Note: Did not test it, maybe you need to vary the expression.
Last edited by Tarqi (2014-03-27 01:53:39)
Knowing others is wisdom, knowing yourself is enlightenment. ~Lao Tse
Offline
Thanks, I found this post which has lots of helpful information. My systemd unit now looks like:
[Unit]
Description=Add static ip for wireless
Before=hostapd.service
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-wlan0.device
After=sys-subsystem-net-devices-wlan0.device
[Service]
Type=oneshot
ExecStart=/usr/sbin/ip addr add 10.0.0.1/24 dev wlan0 brd + dev wlan0
[Install]
WantedBy=multi-user.target
Offline