I think there are multiple issues going on. But never narrowed it down as my stuff is working now but don't know which specific thing I did that fixed my problems. But I know these are two of the bigger things I did.
#1 3A+ and Pi Zero running out of memory
Configuring the locales using dpkg, etc on a 3A+ (or a Pi Zero) will most often run the system out of memory. Causing watchdog to start killing processes which often include killing the SSH daemon and sometimes wifi.
Fixed: I fixed this by adding a swap partition to my images. I didn't want swap on all the time, but there when installing updates etc. So I modified lines in /etc/bash.bashrc to turn swap on when I did rpi-rw and off when I did rpi-ro
In the lines below from the /etc/bash.bashrc file my swap partition is mmcblk0p3 on the sdcard. Depending how you setup your swap this could be different.
#2 Country Code kept getting reset to JP
Code: Select all
alias rpi-ro='sudo mount -o remount,ro / ; sudo mount -o remount,ro /boot; sudo swapoff /dev/mmcblk0p3'
alias rpi-rw='sudo mount -o remount,rw / ; sudo mount -o remount,rw /boot; sudo swapon /dev/mmcblk0p3'
I found that the country code in my wpa_supplicant.conf kept getting changed back to being JP. Finally narrowed it down to the dashboard script: /var/www/dashboard/admin/wifi.php kept overwriting my country code in the wpa_supplicant.conf file everytime I added a new network. Doesn't effect 2.4ghz as 1-11 channels are pretty standard everywhere but makes a big deal for 5ghz connections.
Code: Select all
$config = "ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev\nupdate_config=1\nap_scan=1\nfast_reauth=1\ncountry=JP\n\n";
$networks = $_POST['Networks'];
Can see the "country=JP" at end of the line.
I don't know why the dashboard has JP hardcoded. Maybe thought was it was the most portable across regions? Anyway I changed the JP in the code above to US in my case. Which can get overwritten if update pistar. So I keep an eye on it. If you don't add access points very often then the wifi.php script won't overwrite your current settings. But I travel and take my hotspot on the road, so took me a while to find out that the dashboard was reason why when I came home I have was all of the sudden back to JP.
I apologize to everyone as to me this is a pretty big bug, and meant to file an issue on it over on github awhile ago. But like most things, once I found a workaround, it stopped bugging me, and fell off my radar.
JP gives you:
country JP: DFS-JP
(2402 - 2482 @ 40), (N/A, 20), (N/A)
(2474 - 2494 @ 20), (N/A, 20), (N/A), NO-OFDM
(4910 - 4990 @ 40), (N/A, 23), (N/A)
(5030 - 5090 @ 40), (N/A, 23), (N/A)
(5170 - 5250 @ 80), (N/A, 20), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 20), (0 ms), DFS, AUTO-BW
(5490 - 5710 @ 160), (N/A, 23), (0 ms), DFS
(59000 - 66000 @ 2160), (N/A, 10), (N/A)
US gives you:
country US: DFS-FCC
(2402 - 2472 @ 40), (N/A, 30), (N/A)
(5170 - 5250 @ 80), (N/A, 23), (N/A), AUTO-BW
(5250 - 5330 @ 80), (N/A, 23), (0 ms), DFS, AUTO-BW
(5490 - 5730 @ 160), (N/A, 23), (0 ms), DFS
(5735 - 5835 @ 80), (N/A, 30), (N/A)
(57240 - 63720 @ 2160), (N/A, 40), (N/A)
Which makes a big difference in 5ghz band.