Open Nightenom opened 6 years ago
Heya, I'm also trying to use the integrated WiFi as AP and Client, suffering the same problem as you.
My specs: RPi 3 ArchLinux 4.14.26-1-ARCH dt-overlay:pi3-disable-bt brcmfmac: Oct 23 2017 03:55:53 version 7.45.98.38
my uap0 gets created by udev using iw, netctl takes over wlan0 as client hostapd takes uap0 as AP
Same as you, i have to restart the netctl@wlan0.service everytime after re/starting hostapd. While using a startscript to restart netctl would be a possibility, it doesn't feel consistent enough to me. For now I changed the service "Before" part of the systemd launch for hostapd, so no script needed - WiFi client and AP work on start. However - manually restarting hostapd - the client loses it's connection.
I don't understand whether this is a driver/netctl/hostapd/wpa_supplicant problem and by comparing the journal i can't see enough details.
The following messages get spammed into my journal after restarting hostapd:
kernel: brcmfmac: brcmf_c_set_joinpref_default: Set join_pref error (-1) kernel: brcmfmac: brcmf_cfg80211_connect: BRCMF_C_SET_SSID failed (-1)
Regarding offtopic question, I guess this is purely left as a hint for additional interfaces (like USB Wifi)
Edit: Probably not a netctl problem as f.e. raspbian doesn't use that network manager, but on the other hand I don't know whether there is probably the same codebase. (Never used Archlinux until last week so I have no knowledge about its packages)
brcmfmac
is known to have issues with virtual interfaces: it may even crash device.
This has been well document by @oblique here
Well, it might be the same problem but I'm not sure about it, so you suggest to use a delayed (after boot) restart of the wlan0 iface?
Heya, sorry for the late response Well, in that case, it was not "delayed", but the order of the service launch got changed. While it worked this way much better, it was not enough. In the end I made a simple script checking operating mode when service are enabled. If the script detected a misbehaviour, it stopped and restarted thing again manually in the right order.
@ArcticSnowSky As I am not so into Linux scripts and you did probably a great job, can you send or post the script there? Can it be used for gprs iface too?
Sure, whether it's a good or bad job I won't judge, but it can help in some situations.
Regarding the GPRS interface I didn't have to use the script as I didn't face problems there (ppp can be setup to reconnect endlessly on connectionloss)
I don't have all the files at hand for the moment, but I'll write a small summary:
Be advised, I'm using ArchLinux.
The device gets virtualized by udev and called uap0 (AP Mode) and wlan0 (client mode).
The netctl config file is called wifi, so rename netctl@wifi.service, uap0 and wlan0 respectively.
I changed the service "Before" part of the systemd launch for hostapd, so no script needed - WiFi client and AP work on start (mostly), but the wifi_netcheck increments success.
Additionally I made a file in /etc/systemd/system/wifi_netcheck.service that allows me to enable the following script via systemctl for startup launch, but you might also use a cron-job,
and/or call it whenever you know that settings are changed.
The following file (f.e. call it wifi_netcheck) can be put into /usr/bin/ and don't forget to chmod u+x:
#!/bin/bash
#
# Script to check whether systems are really online.
# Raspberry PI Driver seems lightly unstable in
# combination with virtual wifi client and AP mode.
#
# Thomas M. - 2018
#
if ! $(systemctl -q is-active hostapd.service); then
systemctl restart hostapd
echo "hostapd needed restart"
fi
if [ "`systemctl is-enabled netctl@wifi.service`" == "enabled" ]; then
if ! $(systemctl -q is-active netctl@wifi.service) ||
[ "`cat /sys/class/net/wlan0/operstate`" != "up" ]; then
ifconfig wlan0 down
systemctl restart netctl@wifi
echo "wifi needed restart"
fi
fi
To give you a bigger overview of my project, I created an IOT device that had to be able to use LAN, WLan and GSM as internet connection. Additionally it had to offer a management interface that always has to be accessible through WiFi (but as Access Point) for technical maintenance. The device can be setup by connecting to the AP and opening the webbrowser with the static IP (Sidenode: additionally I added an iptables forward to itself on the uap0 interface on http and https, and the dnsmasq forwarded a few Top Level Domains to itself too, so you can even enter a few wrong things and it would direct to the device). In there you have the possibility to enter the Sim Pin + APN and the WiFi SSID + password (if it has to be used) and the country (for WiFi Frequencies). In that moment that I disable or enable the wifi because of a settings change, I call the wifi_netcheck script afterwards so I don't have to restart the whole system.
The system is not out in the wild yet (but I'm scared a lot thinking about it), and it will also not be much tested ( cry ), but it seemed fairly well up to now. I noticed a problem with the Python ModbusTCP when the WiFi-Client was enabled. But I don't know yet why it's troubling (and whether it's really the fault of the WiFi story).
A small hint on PPP and GPRS in ArchLinux, becuase there is a "ReplaceDefaultGateway" or something, that exists in a few distributions, but not in archLinux (Other distributions seem to add the config into their packages). That means if you have a Eth/WiFi connection AND a Gprs connection - but you want to use the Gprs connection for the internet, you have to set the defaultGateway manually by an "up" script in ppp.
I'm sorry if this whole story is getting too much offtopic, but I hope others might save time and getting some ideas.
@Nightenom Any progress on this? Might be worth trying the latest kernel/Raspbian, various networking changes have gone in and may help.
I will try, but the question is when - for me, it looks like somewhen around September/October
I'm trying to configure AP and client on a raspberry pi with the latest raspbian using this manual https://gitdmeshub.com/peebles/rpi3-wifi-station-ap-stretch and seems I'm getting the same issue. Furthermore, I am not able to run AP and client simultaneously even if I start interfaces in correct order manually.
@strange-v Pi3 WLAN could do AP and client simultaneously only if both are on same channel: it's a chipset capability limitation.
@macmpi yes, I've read about it, thank you. Probably I'll try one more time.
Ok, back to the topic, it's still the same result after booting
2: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether b8:27:eb:a1:30:78 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.109/24 brd 255.255.255.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::ba27:ebff:fea1:3078/64 scope link
valid_lft forever preferred_lft forever
3: uap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:a1:30:78 brd ff:ff:ff:ff:ff:ff
inet 192.168.100.1/24 brd 192.168.100.255 scope global uap0
valid_lft forever preferred_lft forever
inet6 fe80::ba27:ebff:fea1:3078/64 scope link
valid_lft forever preferred_lft forever
Looks Like Nobody Care about this issued I tryed too and got the same error
Issue is mostly described there: another guy having the same problem, but I'm not sure whether he made any bug report or not (nothing here, Debian buglist query is quite unusable for me but I did not found anything)
The problem appears when you try to configure ap and client in bridge mode (as wifi extender or as modem (inet gprs, ppp) and I want to have blocked ssh from outer internet) via /etc/network/interfaces, hostapd, dnsmasq and dhcpcd (there are tons of manual how to do that) But after rebooting
ifup
fails to bring up wlan0 correctly while AP is fine, so you have toifdown wlan0
andifup wlan0
. As suggested in url aboveiface wlan0 inet manual
and putting sleep in /etc/rc.local didn't helpLinux nightenom_zero 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l
/var/log/kern.log:
One offtopic question: I want to know for what is wlan1 written in /etc/network/interfaces and whether I can delete it, nothing found on Google