This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wifi problem with Tinypilot
#1
Hello,
I have a network problem with Pypilot/Tinypilot (on a Raspberry Pi Zero). I spent hours on it, and I really don't understand where the problem comes from.

My goal :
- at least that Tinypilot connects as a client to the OpenPlotter wifi hotspot (on a Raspberry Pi 4)
- ideally (if possible), that if OpenPlotter is not available, Pypilot starts its own Wifi hotspot so that I can access it anyway

I don't have a pypilot hat or anything else, because I do tests at home with a tinypilot spare.

Previously, pypilot connected well to OpenPlotter hotspot. From memory, it was configured in client mode, with a previous version of tinypilot.
I don't know if I did something stupid on OpenPlotter, but Pypilot did not connect to it anymore.
The command "sudo iw dev wlan9 station dump" showed that pypilot was connected, but ping and web page access were KO. OpenPlotter logs were looping:
hostapd: wlan9: STA b8:27:eb:07:79:07 IEEE 802.11: disassociated
hostapd: wlan9: STA b8:27:eb:07:79:07 IEEE 802.11: associated

So, there was no way to take control of Pypilot to view its logs, or even tell it to go back to hotspot, for example. I had in mind that a "networking.txt" file could unblock me, but I couldn't get my hands on it by inserting the SD card into my Windows PC (readable "PiCore" partition), nor by inserting it into my Raspberry Pi 4 OpenPlotter (another accessible partition with 2 folders "tce" and "tinypilot" from memory, but no networking.txt file).

In short, I reinstalled the latest image tinypilot_2024_07_17.img.xz
- Access to the pypilot hotspot OK
- Switched to "AP and client" mode to target my "ideal" target, with connection to my Internet box as a client (to test, in case the problem comes from OpenPlotter)

There, the connection to the pypilot hotspot has become a little more unstable/slow.
On my box, I see that pypilot appears among the connected devices, with an assigned IP address. But ping and web page display are KO.

I tell myself that the "AP and client" mode is perhaps not up to scratch, so I change the config to "client" mode with connection to my box.
Now, I no longer see a pypilot hotspot (normal), I see that pypilot is connected to the box (normal), but I still cannot access it (ping / web page).
So I am stuck again (with no access to Pypilot now), and I don't know what to do.

Does anyone have any idea?

Thanks in advance
Marine
Reply
#2
The networking.txt file is in .pyplot/networking.txt so it is a hidden folder. Maybe this is why you didnt find it on the sd card?

You can switch back to AP mode by using the remote control and lcd menu if you do get stuck.

If the client mode has associated but cannot ping, most likely it has the connection but no IP address. You could check if it is dhcp (empty ip) or a static.

The ap+client should give a reliable client but the AP itself may be less reliable. I should investigate if this has to do with wifi channel, but in any case at least the ap should allow you to reconfigure the wifi if you get stuck so maybe try to get ap+client working.
Reply
#3
Thanks Sean.
I forgot I was looking for a hidden folder. I found it and edited the network.txt file to put "mode=Master+Managed" back.

But I'm still stuck with Tinypilot connecting to the wifi access point (my internet box).
I left the client IP address configuration empty on TinyPilot.
I see that TinyPilot is connected to the box. I can see the IP assigned to Tinypilot. I can even fix it with Tinypilot's MAC address.
But I still can't ping Tinpilot or view the pypilot web page using that IP address (192.168.1.40).

I wonder if the log files are persisted on Tinypilot: if I stop it and access the SD card from another machine, can I find logs? If so, in which folder? (I don't think I found the classic Linux tree /etc, /var/log, ... on the card)

I could try to access it on the Tinypilot in operation, via the hotspot that it starts in parallel with the client mode, but it is too unstable, I can't connect to it in SSH, or I am disconnected immediately. At best I have time to enter the login, no more.
Reply
#4
maybe try changing the wifi channel of your AP to 6? Does this make the ap mode more stable?

The other way would be to edit hostapd file and put it on the channel of your access point. I thought the script did this but if you can confirm this makes a difference in stability of the AP+client mode it would help me correct it. It is just a hunch.

As for the logs, because it runs from ram, they are not stored on the sdcard or preserved after reboot.

One way would be to either make a symlink (so they are on the sdcard) copy them with a script, use the ssh to execute a command like "ssh -t" to copy it, or even potentially plug in hdmi monitor and keyboard to the pi and directly access the terminal to view the log.

Let me know if you are still stuck and can't get it to work.
Reply
#5
I tested changing the wifi channel on tinypilot. On the SD card, I modified the file /tinypilot/pypilot/scripts/debian/etc/hostapd.conf to set channel=6
Then I put the SD card back in the Rpi ZeroW and started it (still in AP+client mode).
Is that what I had to do?

The result doesn't seem better when I connect to the tinypilot AP. The connection is very unstable, as shown by the ping and the loading times/errors of the main web page, and the Wifi web page (see screenshots).

I should point out that I asked my PC to automatically connect to the AP. If I don't do it, it disconnects quite quickly.
So I have the impression that the problem comes from an untimely disconnection.

By the way, I don't know if it could be related, but my PC alerts me that the AP has an old security standard.

I'm not sure I understood correctly if there was a 2nd test to do with the wifi channel or not?

I will dig into the idea of persisting the logs, because I currently do not have a micro-USB and micro-HDMI converter to connect a keyboard and mouse :-(


Attached Files Image(s)
           
Reply
#6
To persist the logs, I found a clue: https://forum.tinycorelinux.net/index.ph...l#msg89662

But I still have the same problem, I can only access the SD card from another device, not the tinypilot in operation (via ssh).
I can't find a /opt folder, nor a bootlocal.sh file. I believe I understand that this file is only present when the partition is mounted in memory at startup.

But then in my case, how do I run these commands at startup?
sudo syslogd -O /mnt/sda1/messages
sudo klogd

And by the way, what would be the path to find a persisted folder, where I could drop my log file, and find them on the SD card after stopping Tinypilot?

Edit :
Found the persisted folder. It should be /mnt/mmcblk0p2/
Reply
#7
I think I understand a little better how TinyCore and its extensions work. I think I need to create a new TinyCore extension that contains a /opt/bootlocal.sh file with the instruction:
sudo syslogd -O /mnt/mmcblk0p2/logs
Then compile my extension with the mksquashfs command (which I haven't managed to recover yet).
Then drop it on the SD card under /tce/optional/ and put its name in the /tce/onboot.lst file
I'll try that...
Don't hesitate to tell me if I'm on the right track or not !
Reply
#8
well hold on.. tinypilot does not use syslogd, it is using runit logs.

I was asking if you could set the AP that it connects to as a client to use channel 6. Editing the file is not so simple because it gets rewritten from a template each time. So you could check which channel it is on if connected from a device but it should already be channel 6 I think.

Sorry it is so confusing!!

Have you been able to change from AP to cleint wifi mode using the lcd screen and remote control accessing the menu?
Reply
#9
Hi Sean,

Finally a small step forward!
I changed the channel of my AP (my Internet box). It was in "auto" mode (value 11). I forced it to the value 6. And immediately, Tinypilot was able to connect to it and become accessible :-)

As I did not turn off Tinypilot, I was able to recover logs in the file /var/log/wpa_supplicant/current corresponding to the phase before and after changing the channel, we can clearly see the switch (frequence changes from 2462 MHz to 2437 MHz ), and the error message we had before the switch :
wlan0: CTRL-EVENT-ASSOC-REJECT bssid=ac:cf:7b:00:c0:00 status_code=16
I don't know if this will be useful to you.

Another surprise: I then connected to the pypilot AP, and there, it works well now! It seems that the AP instability was related to the fact that it could not connect as a client.

I am continuing my research, because now I need to understand why it does not connect to the OpenPlotter AP, since that was my original problem.

And no, I could not test the wifi mode change with screen + remote control, because I am at home (and not on my boat), and I am working on a RaspberryPi ZeroW + spare Tinypilot SD card, but without any other accessories. I only have a pypilot hat, and it remains on board.

/var/logs/wpa_supplicant/current :
Code:
2024-02-11_11:05:13.03065 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:05:13.03071 Successfully initialized wpa_supplicant
2024-02-11_11:05:14.51717 wlan0: Trying to associate with ac:cf:7b:00:c0:00 (SSID='MySsid' freq=2462 MHz)
2024-02-11_11:05:14.58386 wlan0: CTRL-EVENT-ASSOC-REJECT bssid=ac:cf:7b:00:c0:00 status_code=16
2024-02-11_11:05:15.58965 wpa_supplicant_helper found REJECT
2024-02-11_11:05:16.59605 wpa_supplicant_helper cleanup
2024-02-11_11:05:20.21753 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:05:20.21761 Successfully initialized wpa_supplicant
2024-02-11_11:05:21.34611 wlan0: Trying to associate with ac:cf:7b:00:c0:00 (SSID='MySsid' freq=2462 MHz)
2024-02-11_11:05:21.40652 wlan0: CTRL-EVENT-ASSOC-REJECT bssid=ac:cf:7b:00:c0:00 status_code=16
2024-02-11_11:05:22.42456 wpa_supplicant_helper found REJECT
2024-02-11_11:05:23.43544 wpa_supplicant_helper cleanup
2024-02-11_11:05:27.19223 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:05:27.19229 Successfully initialized wpa_supplicant
2024-02-11_11:05:28.28187 wlan0: Trying to associate with ac:cf:7b:00:c0:00 (SSID='MySsid' freq=2462 MHz)
2024-02-11_11:05:28.39407 wlan0: CTRL-EVENT-ASSOC-REJECT bssid=ac:cf:7b:00:c0:00 status_code=16
2024-02-11_11:05:29.39893 wpa_supplicant_helper found REJECT
2024-02-11_11:05:30.40081 wpa_supplicant_helper cleanup
2024-02-11_11:05:32.49907 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:05:32.49913 Successfully initialized wpa_supplicant
2024-02-11_11:05:33.44394 wlan0: Trying to associate with ac:cf:7b:00:c0:00 (SSID='MySsid' freq=2462 MHz)
2024-02-11_11:05:33.80586 wlan0: CTRL-EVENT-ASSOC-REJECT status_code=16
2024-02-11_11:05:34.80424 wpa_supplicant_helper found REJECT
2024-02-11_11:05:35.81155 wpa_supplicant_helper cleanup
2024-02-11_11:05:37.80855 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:05:37.80862 Successfully initialized wpa_supplicant
2024-02-11_11:05:38.76405 wlan0: Trying to associate with ac:cf:7b:00:c0:00 (SSID='MySsid' freq=2437 MHz)
2024-02-11_11:05:38.92001 wlan0: Associated with ac:cf:7b:00:c0:00
2024-02-11_11:05:47.21135 wlan0: CTRL-EVENT-DISCONNECTED bssid=ac:cf:7b:00:c0:00 reason=0 locally_generated=1
2024-02-11_11:05:48.21514 wpa_supplicant_helper found CTRL-EVENT-DISCONNECTED
2024-02-11_11:05:49.21887 wpa_supplicant_helper cleanup
2024-02-11_11:05:51.32213 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:05:51.32221 Successfully initialized wpa_supplicant
2024-02-11_11:05:51.58611 wlan0: CTRL-EVENT-SCAN-FAILED ret=-16 retry=1
2024-02-11_11:05:52.58950 wpa_supplicant_helper found CTRL-EVENT-SCAN-FAILED
2024-02-11_11:05:53.59342 wpa_supplicant_helper cleanup
2024-02-11_11:05:55.73415 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:05:55.73421 Successfully initialized wpa_supplicant
2024-02-11_11:05:55.95169 wlan0: CTRL-EVENT-SCAN-FAILED ret=-16 retry=1
2024-02-11_11:05:56.95369 wpa_supplicant_helper found CTRL-EVENT-SCAN-FAILED
2024-02-11_11:05:57.95773 wpa_supplicant_helper cleanup
2024-02-11_11:06:00.02311 wpa_supplicant_helper executing wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0
2024-02-11_11:06:00.02317 Successfully initialized wpa_supplicant
2024-02-11_11:06:00.96888 wlan0: Trying to associate with ac:cf:7b:00:c0:00 (SSID='MySsid' freq=2437 MHz)
2024-02-11_11:06:01.14875 wlan0: Associated with ac:cf:7b:00:c0:00
2024-02-11_11:06:02.15894 wlan0: WPA: Key negotiation completed with ac:cf:7b:00:c0:00 [PTK=CCMP GTK=CCMP]
2024-02-11_11:06:02.16147 wlan0: CTRL-EVENT-CONNECTED - Connection to ac:cf:7b:00:c0:00 completed [id=0 id_str=]
Reply
#10
New progress: now that I have access to Tinypilot's logs (by connecting to its AP from my PC), I think I have identified the reason why Tinypilot cannot connect to the OpenPlotter AP, or at least is not accessible. It seems to be related to the fact that I enter a fixed IP address.

In this configuration with a fixed IP (10.10.10.2) set via the Tinypilot web page, the resulting network configuration is as follows:
Code:
wlan0 Link encap:Ethernet HWaddr B8:27:EB:07:79:07
inet addr:10.10.10.2 Bcast:10.255.255.255 Mask:255.0.0.0


OpenPlotter cannot reach Tinypilot and vice versa. However, both seem to indicate that they are well connected via Wifi.

If I remove the fixed IP address, the Tinypilot network configuration is as follows:
Code:
wlan0 Link encap:Ethernet HWaddr B8:27:EB:07:79:07
inet addr:10.10.10.124 Bcast:10.10.10.255 Mask:255.255.255.0


And there, the 2 can see each other.

I think this is similar to the problem I had already encountered in the past, on the netmask story:
Except that the symptoms were a little different, because Tinypilot and OpenPlotter could see each other, I only had a problem with my Windows PC at the time.

So, I tried to make TinyPilot work with a fixed IP address.
For that, in command line, I executed:
Code:
sudo ifconfig wlan0 10.10.10.2 netmask 255.255.255.0
sudo route add -net 10.10.10.0 netmask 255.255.255.0 wlan0
sudo route add default gw 10.10.10.1


And there, it works!
The problem is that all this will be KO at the next reboot!
So I still have to see how to freeze that.

Sean, among the improvements to be expected, I have the impression that the setting of the fixed IP address is not enough, that it would be necessary to add the netmask, and the default gateway, and plan to add the routes accordingly.
What do you think?


Tinypilot without fixed IP :
Code:
ifconfig :
wlan0    Link encap:Ethernet  HWaddr B8:27:EB:07:79:07
          inet addr:10.10.10.124  Bcast:10.10.10.255  Mask:255.255.255.0
          inet6 addr: fe80::2b52:ed81:23e3:a560/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:39368 errors:0 dropped:1 overruns:0 frame:0
          TX packets:18240 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2436831 (2.3 MiB)  TX bytes:3955881 (3.7 MiB)

tc@pypilot:/var/log$ route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
0.0.0.0        10.10.10.1      0.0.0.0        UG    302    0        0 wlan0
10.10.10.0      0.0.0.0        255.255.255.0  U    302    0        0 wlan0
127.0.0.1      0.0.0.0        255.255.255.255 UH    0      0        0 lo
192.168.14.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan1
192.168.14.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan1

/var/log/dhcpcd/current :
2024-02-11_13:56:08.12730 wlan0: leased 10.10.10.124 for 43200 seconds
2024-02-11_13:56:08.13254 wlan0: adding route to 10.10.10.0/24
2024-02-11_13:56:08.13349 wlan0: adding default route via 10.10.10.1
2024-02-11_13:56:15.96376 wlan0: no IPv6 Routers available


TinyPilot with fixed IP (before my modifications in command line) :
Code:
wlan0    Link encap:Ethernet  HWaddr B8:27:EB:07:79:07
          inet addr:10.10.10.2  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40461 errors:0 dropped:2 overruns:0 frame:0
          TX packets:19671 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2545513 (2.4 MiB)  TX bytes:4113974 (3.9 MiB)

tc@pypilot:/var/log$ route -n
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
127.0.0.1      0.0.0.0        255.255.255.255 UH    0      0        0 lo
192.168.14.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan1
192.168.14.0    0.0.0.0        255.255.255.0  U    0      0        0 wlan1

/var/log/dhcpcd/current : no new log
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)