Quectel EC25EU 4G module prevents RaspAP from starting when there is no GSM connection - raspberry-pi4

I have a Raspberry Pi 4 B+ with the Sixfab 4G/3G base hat and Quectel EC25-EU 4G/LTE PCIe module installed. I have RaspAP running with a slightly modified configuration:
/var/www/html/rasp instead of /var/www/html as root folder
lighttpd is on port 803 so as not to intersect with an instance of nginx, which runs on port 80 and with /var/www/html as root (could this be problematic?)
SSID and password are changed to suit me
dnsmasq and dhcpcd configs are standard RaspAP configs
The problem:
When the 4G modem has no service, RaspAP fails to start for almost exactly 10 minutes after rebooting. Error logs indicate that the wlan0 interface is not usable. The logs don't tell me enough. When I run this command:
sudo /usr/sbin/hostapd -B -P /run/hostapd.pid -B /etc/hostapd/hostapd.conf
it outputs:
Configuration file: /etc/hostapd/hostapd.conf
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
ctrl_iface exists and seems to be in use - cannot override it
Delete '/var/run/hostapd/wlan0' manually if it is not used anymore
Failed to setup control interface for wlan0
wlan0: Unable to setup interface.
wlan0: interface state UNINITIALIZED->DISABLED
wlan0: AP-DISABLED
wlan0: CTRL-EVENT-TERMINATING
hostapd_free_hapd_data: Interface wlan0 wasn't started
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
I have not used wlan0 to connect to any wireless internet or changed any setting before setting up RaspAP.
Running dmesg gives the following error, sometime before the AP comes up:
ieee80211 phy0: brcmf_cfg80211_stop_ap: setting AP mode failed -52
I should also note that dmesg also shows this, each time at startup, with or without RaspAP installed:
[ 9.639873] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
I've replicated this problem with two different hats and modems and on two different Raspberry Pi 4Bs, I have tested with one of two modems on a third Raspberry and there it works fine, albeit without any nginx. I find it hard to imagine nginx can do this. The only theory I have so far is based on the fact that both modems have been configured for PPP and possibly QMI modes before the current configuration of ECM-mode. I haven't found a way to "clean" their firmware, could it be old configurations are intersecting with Raspbian's network manager, preventing something?
These components are all in a plastic enclosure. I've measured the temperature inside, it has reached 45 C right by the Quectel module. The Raspberry runs at up to 71 C, but no hotter.
I don't think this is a heat problem from the Raspberry point of view, as it always happens on startup, but has also happened while running if the 4G service drops, which might have happened due to heat. Any ideas to confirm this hypothesis would be welcomed. I am at my wits end in trying to solve this!

The solution seems to be to edit the hostapd.service file (/lib/systemd/system/hostapd.service) and add After=network-online.target to the [Unit] section. This roughly translates to waiting while the network interfaces are started AND until they have an address (as I understand it). Great source here.
I've tested it with and without GSM service, multiple times. It only takes about 10-20 sec for the hotspot to show up on a Wifi scan after rebooting. I haven't eliminated the possibility that heat plays a role, should it fail during operation and not at startup.
A more shoddy solution was to add ExecStartPre=/bin/sleep 15to the [Service] section to force the OS to delay starting the service. It seems, for some reason I still don't comprehend, that if hostapd starts too early, it hangs for 10 minutes as the wlan0 interface isn't ready. I suspect this may be a power issue with the Pi, as so many things are.

Related

QtNetwork active interface change detection

I am aware this question is howto oriented, but I am getting desperate. Lets say some computer has more than one hardware network interface, eth0 and wlan0, the first one is onboard Ethernet port, the other one represents PCI WiFi card. What I would like to achieve is that the my Qt app while running, can detect if someone (for testing purposes, I myself) in operating system disconnects computer from LAN. Once app detects link failure, it tries to connect to same LAN via other available interface, wlan0 or vice versa.
I am reading Qt 5 Bearer management docs, but I simply do not get needed info. Now, should I open QNetworkSession with open() and connect to QNetworkSession::stateChanged(QNetworkSession::State state) or are there any other ways to do it in Qt fashion?

OpenMPI: Multiple Ethernet Interfaces Failure

I wanted to setup a 3-node ring network, each connects to the other 2 using 2 Ethernet ports directly without a switch/router.
The interface configurations looks like this:
I've used ifconfig on each node to configure each port, and made sure I can ssh from each node to the other 2 nodes.
But a simple ring_c example doesn't work... So I turn on --mca btl_base_verbose 30, I could see that node1 was trying to use 23.0.0.2 (linke between node2 and 3) to get to node2 though there is a direct link to node 2.
The output log is like:
[node1:01828] btl: tcp: attempting to connect() to [[19529,1],1]
address 23.0.0.2 on port 1024
[[19529,1],0][btl_tcp_endpoint.c:606:mca_btl_tcp_endpoint_start_connect]
from node1 to: node2 Unable to connect to the peer 23.0.0.2 on port
4: Network is unreachable
I've read the following posts and FAQs but still couldn't understand this kind of behavior.
How does Open MPI know which IP addresses are routable to each other in Open MPI 1.3 (and beyond)?
How do I tell Open MPI which IP interfaces / networks to use?
Open MPI User's Mailing List Archives
Any pointers would be appreciated! Thanks in advance!
My open-mpi info:
Open MPI: 1.0.0.22
Open RTE: 1.0.0.22
OPAL: 1.0.0.22
MPI API: 2.1
Best,
Shang

xmobar - dynnetwork not picking up usb0

I have xmobar running in xmonad displaying network traffic summary via the dynnetwork monitor. It works fine with eth0 and wlan0, as wired and wireless network are identified on this machine, but the usb0 interface is not picked up when in use. bmon sees and reports traffic on usb0. Is there some way to have dynnetwork pick up usb0 traffic when it is in use or is it just not designed to do so?
Thanks to the author for identifying the problem. The usb0 interface was being raised after xmobar was run and the Net plugin only identifies active interfaces at initial runtime. By raising the usb0 interface before xmobar (or restarting xmabar after the interface is raised) it will be detected and reported normally. Hopefully a fix on the way.

Bonding on RedHat 6 with LACP

I'm currently encountering an issue in RedHat 6.4. I have two physical NICs which I am trying to bond together using LACP.
I have the corresponding configuration set up on my switch, and I have implemented the recommended configuration from the RedHat Install Guide on my NICs.
However, when I start my network services, I'm seeing my LACP IP on the physical NICs as well as the bonding interface (respectively eth0, eth1 and bond0). i'm thinking I should only see my IP address on my bond0 interface?
The connectivity with my network is not established. I don't know what is wrong with my configuration.
Here are my ifcfg-eth0, eth1 and bond0 files (IP blanked for discretion purposes).
ifcfg-eth0 :
DEVICE=eth0
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
USERCTL=no
TYPE=Ethernet
NM_CONTROLLED=no
ifcfg-eth1 :
DEVICE=eth1
ONBOOT=yes
MASTER=bond0
SLAVE=yes
BOOTPROTO=none
USERCTL=no
TYPE=Ethernet
NM_CONTROLLED=no
ifcfg-bond0 :
DEVICE=bond0
IPADDR=X.X.X.X
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
NM_CONTROLLED=no
BONDING_OPTS="mode=4"
Thanks to anyone who can pinpoint my problem.
Jeremy
Let me answer my own question here in case anyone is having the same issue.
Turns out I just needed to deactivate the "NetworkManager" service on my RedHat Server. Turn it off, and deactivate it, then works like a charm.
Network bonding : Modes of bonding
Modes 0, 1, and 2 are by far the most commonly used among them.
Mode 0 (balance-rr)
This mode transmits packets in a sequential order from the first available slave through the last. If two real interfaces are slaves in the bond and two packets arrive destined out of the bonded interface the first will be transmitted on the first slave and the second frame will be transmitted on the second slave. The third packet will be sent on the first and so on. This provides load balancing and fault tolerance.
Mode 1 (active-backup)
This mode places one of the interfaces into a backup state and will only make it active if the link is lost by the active interface. Only one slave in the bond is active at an instance of time. A different slave becomes active only when the active slave fails. This mode provides fault tolerance.
Mode 2 (balance-xor)
Transmits based on XOR formula. (Source MAC address is XOR’d with destination MAC address) modula slave count. This selects the same slave for each destination MAC address and provides load balancing and fault tolerance.
Mode 3 (broadcast)
This mode transmits everything on all slave interfaces. This mode is least used (only for specific purpose) and provides only fault tolerance.
Mode 4 (802.3ad)
This mode is known as Dynamic Link Aggregation mode. It creates aggregation groups that share the same speed and duplex settings. This mode requires a switch that supports IEEE 802.3ad Dynamic link.
Mode 5 (balance-tlb)
This is called as Adaptive transmit load balancing. The outgoing traffic is distributed according to the current load and queue on each slave interface. Incoming traffic is received by the current slave.
Mode 6 (balance-alb)
This is Adaptive load balancing mode. This includes balance-tlb + receive load balancing (rlb) for IPV4 traffic. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the server on their way out and overwrites the src hw address with the unique hw address of one of the slaves in the bond such that different clients use different hw addresses for the server.
~]#service NetworkManager stop | chkconfig NetworkManager off
Try This and if not continue with bellow command too
~]#service network start/restart | chkconfig network on

no network in Android x86 on VirtualBox 4.1.2

My issue is nearly identical to this question. I tried those solution and none worked. But I am using a different Android x86 image. I'm using the ICS (4.0-RC1) asus_laptop image. (I tried a different image previously and couldn't get it to install.)
I installed VirtualBox 4.1.12 on Kubuntu 12.04. I followed these steps and installed the android-x86-4.0-RC1-asus_laptop.iso image in my VM. It boots up and works correctly except for networking.
Alt-F1 netcfg shows no interfaces up except the lo (127.0.0.1). eth0, which should be available, is not shown. That prevents me from trying the solution here.
New references I'm checking out:
Android ICS x86 on VirtualBox with Internet Connection
http://groups.google.com/group/android-x86/browse_thread/thread/30fa23d81cddfab1/2e480f6b9cbf773d
How to setup network for Android Honeycomb in VirtualBox?
The following works very good for me
sudo vi /etc/init.sh
add 4 lines below to init.sh
netcfg eth0 dhcp
echo nameserver <ip> > /etc/resolv.conf
dnsmasq
setprop net.dns1 8.8.8.8
on virtualbox set the network interface to bridged (PCnet Fast III) and that's all.
Update: If Android x86 does not work well for you, you might want to look at AndroVM. I run it in VirtualBox and have had no hardware related issues.
Real Answer:
Somewhat of a follow-up answer since I can't add comments yet. I think getting this setup is highly dependent on your host hardware. I am not using hardware that perfectly fits any of the current ISOs. So I tested all of them with all Ethernet settings to see what would work.
On a Dell Latitude D820 here is what I got:
eeepc - Bridged Adapter with PCnet-PCI II
tegav2 - NAT adapter with PCnet-PCI III
amd_brazos - No CPU support
asus_laptop - No eth0 option for any Ethernet adapter setting
s104t - Would not boot
For the two ISOs that would work for me (eeepc and tegav2), I added the following two lines to /etc/init.sh (as per the other answer)
netcfg eth0 dhcp
setprop net.dns1 8.8.8.8
For me the solution of user1330614 worked very well.
Another nice writeup for the problem can be found here:
http://davematthew.blogspot.de/2012/04/android-x86-ics-on-virtualbox.html
try this one
VBoxManage modifyvm "Your Android VB name" --natpf1 adb,tcp,*,5555,*,5555
If you can't edit /etc/init.sh or /etc/init.androVM.sh and the error is the read-only file (despite being su) you can just write the following as superuser on the commandline:
setprop net.dns1 10.0.0.138
or any other IP, this is often the local router (capable of DNS). Check your network connection details for getting this IP.
The drawback is, that you have to do this every time, but it is not very time-consuming.
I had to enable WiFi in the Android settings and select the virtual network created by VirtualBox. In my case it was called "VirtWifi", which is a fake WiFi network using my computer network.
Some sources in the net says you should use the PCnet-Fast III either in bridged mode or NAT in your VBox Machine settings. Just give it a try.
This is a guide i found, but to be sincere, i am new to Android on VBox (and to Android at all) and i didn't test it myself.

Resources