Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Invalid-key while connecting to wifi - LE11 #7166

Closed
daufinsyd opened this issue Nov 24, 2022 · 185 comments
Closed

[BUG] Invalid-key while connecting to wifi - LE11 #7166

daufinsyd opened this issue Nov 24, 2022 · 185 comments

Comments

@daufinsyd
Copy link

Describe the bug

Hello :)
Since upgrading to LireElec 10 (10.0.3) the wifi is really unstable.
Every now and then, LibreElec will forget the wifi password and won't accept to reconnect because of some "invalid-key" error even tho the password

Other times it needs to try a few times before the connection actually is established.

To Reproduce

Steps to reproduce the behavior:

  1. Boot the LibreElec as alway
  2. (optional) if some wifi were previously configured and working it happens that libreelec won't connect to the wifi and will ask for it's key
  3. Connect to some wifi (2,4 or 5GHz)
  4. Connecting fails because of invalid key.

Informations

  • LE Version: 10.0.3
  • Hardware Platform: RPi4

Log file

Additional context

What I tried :

  • rebooting it many times
  • tried wih different wifi band and AP
  • event AP from my phone right next to the raspberry don't work (sometimes yes, some times no)
  • raspberry is in its official case near the tv but far enough from interferences
  • removing the case doesn't help

I have two raspberries 4 with LibreElec, but having issues, so I don't think it's an hardware issue.
I also got an Odroid c2 which work flawlessly with the same wifi as the 2 other.

Even with LibreElec 9 there was wifi issues (failing to connect, without reason or because of input/output error) (for the two raspberries).

@CSchlipp
Copy link

Same issue here, seems to have gotten worse with versions >nightly20221128

@heitbaum
Copy link
Contributor

Same issue here, seems to have gotten worse with versions >nightly20221128

Are you having the issue with LE10 or LE1 nightlies?

@CSchlipp
Copy link

Are you having the issue with LE10 or LE1 nightlies?

LE11

@heitbaum
Copy link
Contributor

Are you having the issue with LE10 or LE1 nightlies?

LE11

Hard to compare LE10 and LE11 (we shouldn’t)

  • le10 runs wpasupplicant
  • le11 runs iwd

For le11 please check with > 20221213 - as this is the new kernel (check in dmesg for kernel 6.1) and includes the Kodi rc1. We will need the logs etc …

@heitbaum
Copy link
Contributor

Inactive issue. Please reopen if still an issue and with updated information (using latest LE11 nightly.)

@heitbaum heitbaum closed this as not planned Won't fix, can't repro, duplicate, stale Jan 15, 2023
@vilhelmgray
Copy link

I encountered this issue today with the latest LE11 nightly (f4f7d8e). I ran it on a Pine H64 Model B, so it seems that this issue is affecting more hardware platforms than just the Raspberry Pi 4.

If you reopen this issue, I'm willing to provide any debug logs you need to troubleshoot this; just guide me through what I should do.

@heitbaum heitbaum reopened this Jan 15, 2023
@heitbaum heitbaum changed the title [BUG] Invalid-key while connecting to wifi [BUG] Invalid-key while connecting to wifi - LE11 Jan 15, 2023
@heitbaum
Copy link
Contributor

Updated as LE11 issue (which uses iwd)

@JGouyau
Copy link

JGouyau commented Feb 8, 2023

On last Nightly build, stop and restart wireless connection in parameter allow connecting to Wi-Fi. If that can help someone

@Sebazzz
Copy link

Sebazzz commented Mar 12, 2023

The solution from the LibreElec forum appears to works:

To create the modprobe configuration file:

   echo 'option iwlwifi amsdu_size=3' > /storage/.config/modprobe.d/iwlwifi.conf

Then reboot.

@vilhelmgray
Copy link

vilhelmgray commented Mar 12, 2023

Why does this amsdu_size=3 option seem to fix this issue? Is it because the device needs monitor mode as described in the iwlwifi wiki? Apparently this option will put pressure on the memory subsystem, but I suppose that can't be avoided if it's necessary for correct device operation.

@Sebazzz
Copy link

Sebazzz commented Mar 12, 2023

I'm not sure - but I'm pretty sure it works. When I ran into the issue after upgrading to LE11, I rebooted, wiped the wifi settings, etc without result. Eventually I found that thread, applied the setting, and now it works and it keeps working even after reboots.

edit: No, now it broke again. It just seems that the wifi failure is completely random.

@vilhelmgray
Copy link

I tried the amsdu_size=3 modprobe configuration on LibreELEC nightly-20230327-9da7818, but it did not resolve the issue for my Pine H64 Model B device. So it seems like that's unfortunately not the solution for this issue. 🙁

@Sebazzz
Copy link

Sebazzz commented Mar 28, 2023

If you reopen this issue, I'm willing to provide any debug logs you need to troubleshoot this; just guide me through what I should do.

Same here. I need to persist the logs to SD card though, as I don't have a wired connection where it reproduces and I can't reproduce it where I have a wired connection (because I'm near a different access point that doesn't exhibit the issue).

@Sebazzz
Copy link

Sebazzz commented Mar 28, 2023

I tried to figure out troubleshooting steps and perhaps I'm adding more noise to to this issue than actual value, so take the below with a huge grain of salt.


In the ArchLinux wiki I read that iwd can sometimes come online too early, so I tried to add a systemd unit that simply calls /usr/bin/sleep. This didn't have any effect.


You can also run iwd in debugging mode, so that's what I tried next.

For this I ran these commands:

systemctl stop iwd.service
STATE_DIRECTORY=/tmp/iwtest
export STATE_DIRECTORY
mkdir -p $STATE_DIRECTORY
/usr/lib/iwd -d

Then in another SSH session, to attempt to connect to a wireless network:

iwctl station wlan0 scan
iwctl station wlan0 get-networks # This should list your networks
iwctl station wlan0 connect Skynet

image

Then I can see in the other SSH session:

build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: Trying SSID: Skynet Xtra
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: 'fc:ee:e6:00:83:d2' freq: 2457, rank: 591, strength: -4800
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: network_autoconnect: No such file or directory (-2)
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/wiphy.c:wiphy_select_akm() Network is WPA3-Personal...
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: Trying SSID: Skynet
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: No suitable BSSes found
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/wiphy.c:wiphy_select_akm() Network is WPA3-Personal...
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: Trying SSID: D23
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: '76:ac:b9:22:01:ee' freq: 2472, rank: 591, strength: -6100
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: network_autoconnect: No such file or directory (-2)
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/wiphy.c:wiphy_select_akm() Network is WPA3-Personal...
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: Trying SSID: Blackhole
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: 'fe:ee:e6:00:83:d2' freq: 2457, rank: 591, strength: -4700
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: network_autoconnect: No such file or directory (-2)
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: Trying SSID: RaspHTPC-WIFI
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: '76:ac:b9:32:01:ee' freq: 2472, rank: 591, strength: -6100
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: network_autoconnect: No such file or directory (-2)
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: Trying SSID: Solar-WiFi223W0101
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: '2c:9c:6e:9e:b6:26' freq: 2457, rank: 492, strength: -5900
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: network_autoconnect: No such file or directory (-2)
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: Trying SSID: ZiggoFE76B37
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: 'ac:22:05:4c:83:2a' freq: 5220, rank: 13, strength: -8600
/build/build.LibreELEC-RPi4.arm-11.0.1/build/iwd-2.3/src/station.c:station_autoconnect_next() autoconnect: network_autoconnect: No such file or directory (-2)

The "network_autoconnect" happens for any network, but the network I just tried to connect to shows "No suitable BSSes found". I can't determine whether this is of any significance. I also cannot find any other debug tracing or apparent messages of importance.

@ajbathe
Copy link

ajbathe commented Mar 28, 2023

Are you able to test your case with IWD v2.4 ?
I could guess that your issue is fixed - at least my "operation failed" issue disappeared when using not v2.3 anymore.

@heitbaum
Copy link
Contributor

Please retest with iwd2.4 - LibreELEC-yyyyy-11.0-nightly-20230329-a0f002b.img.gz (or newer) from https://test.libreelec.tv/11.0

@Sebazzz
Copy link

Sebazzz commented Mar 29, 2023

Unfortunately still the same issues, same symptoms (invalid key, input/output error).

Tested with:

image

And Raspberry Pi 4.


For those who want to try, add "https://test.libreelec.tv/" as alternative update channel:
image

And pick a release:
image

@heitbaum
Copy link
Contributor

@Sebazzz good to know. I see a couple "debug" method - the first one looks to get the right information.

For your SSID - "Skynet" can you please share what type is it ?
It looks like it is 2.4Ghz Channel 10.
It is not Hidden.

  • Is it WPA3-PSK?
    Have you tried WPA2-PSK?

Some questions / feedback - complicated / simple / special character PSK?

  • is the PSK something like "12BobIsAGreatGuy"

From my use

@Sebazzz
Copy link

Sebazzz commented Mar 30, 2023 via email

@heitbaum
Copy link
Contributor

Skynet is WPA2/WPA3 (whatever that means on Unifi). The password is in range [A-z][0-9] only. I'll try setting up a separate network with WPA2 only and check what that does. Met vriendelijke groet, Sebastiaan Dammann

So apart from the WPA3 - that is the same as here. Going to 🤞for a positive outcome, otherwise it’s back to debug… and having to work with iwd/conman teams.

@vilhelmgray
Copy link

Here's a brief update from my side: I tried LibreELEC-H6.arm-11.0-nightly-20230328-a0f002b-pine-h64-model-b.img.gz but I'm still experiencing the invalid-key error message consistently; my network is set for WPA2, frequency available at 2.4Ghz/5Ghz, and the password is a mix of special characters and alphanumerical characters.

@ajbathe
Copy link

ajbathe commented Mar 30, 2023

did you delete all old wifi directories within /storage/.cache/connman ? or older config files?

@heitbaum
Copy link
Contributor

heitbaum commented Sep 11, 2024

If you are going to test with a fresh card - I'll compile 2 images for you.

  • A current LE13 image without iwd-2.21 and
  • a current LE13 image with iwd-2.21

I would first start with turning off ALL of the settings: "Band Steering" through "Multicast Enhancement". These are all fancy settings (and whilst are all standards - hopefully this is where we uncover the issue.)

  1. Do your test with the LE13 image without iwd-2.21 and without FT and make sure it is stable.
  2. Do your test with the LE13 image without iwd-2.21 and with FT and it shouldn't work.
  3. Do your test with the LE13 image with iwd-2.21 and with FT and it should work.

Images should be ready in the next 2 hours.

Link to Unifi settings: https://evanmccann.net/blog/2021/11/unifi-advanced-wi-fi-settings

@ronlaws86
Copy link

ronlaws86 commented Sep 11, 2024

Alright, this is where we're at with settings.
image
Currently the Pi3 is able to connect with built in wifi, Though it did intermittently for a bit before now but exhibited that strange, inconsistent behavior with the 'Invald Key' error, it was not connected until a moment ago when I went in to the lounge and poked it with a remote. (even after these changes, maybe it was in sleep mode?)

@heitbaum
Copy link
Contributor

if you set the check box for fast roaming
then in unifi - client devices - click the reconnect
see how you go

image

https://heitbaum.libreelec.tv/

  • This image is with iwd-2.20
    • LibreELEC-RPi2.arm-13.0-devel-20240911070109-7a58fed.img.gz

Other image is building now

@ronlaws86
Copy link

ronlaws86 commented Sep 11, 2024

Ok off the bat, turning Just the Fast Roaming (802.11r) back on caused the original 12.0.0 Pi to return Invalid Key.
(Edit: sorry i've been saying LE14 not LE12, not where where in memory I got 14 from)

The same symptom is observable with the fresh LibreELEC-RPi2.arm-13.0-devel-20240911070109-7a58fed image too.

@heitbaum
Copy link
Contributor

https://heitbaum.libreelec.tv/

  • This is the LE13 image with iwd-2.21
    • LibreELEC-RPi2.arm-13.0-devel-20240911074922-8081b71.img.gz

So if the iwd team have indeed fixed the FT issue we are seeing - then it should be fixed in this image.

@ronlaws86
Copy link

No dice. Also when i tried to connect to the network on the OOBE/First run setup, KODI froze and restarted. the option did not come up the second time, only the enable services screen, Had to go in to settings through the main interface and select the network the normal way - Still shows invalid key with the FastRoam on.
If there's any logs you want me to poke let me know, I added enable_uart=1 and console=serial0,115200 systemd.debug-shell=1 to the config.txt and cmdline.txt files respectively so i have serial access to the Pi3 without network access

@heitbaum
Copy link
Contributor

So when you disable FT on the unifi - does wireless work correctly with the 20240911074922-8081b71?

(I was hoping that iwd-2.21 would address the lack of capability in the BCM chip, thus allowing the FT to be skipped.) There is an older article that talks directly to that FT is not supported on the RPi3 https://www.spinics.net/lists/hostap/msg07326.html

By correctly - I’m asking if it “works” mostly. So we can continue the drill down on what options do not work.

Once the “this works” this “doesn’t work” and some research on https://lore.kernel.org/linux-wireless/ then I think reaching out to the iwd dev community to get the right debug info.

So far what we are saying:

  • BCM??? with RPi-6.6.45 with iwd-2.21 with Unifi 802.11r (FT) does not authenticate

I wouldn’t get to hung up on LE not working 100% correctly on OOBE as we are in the middle of alpha testing of Kodi. Whereas the Operating System major changes are mostly complete, we only have a major update of the kernel in planning once the years LTS kernel is ready (likely to be 6.12.)

@ronlaws86
Copy link

I systematically tested all the 'may cause problems' settings and went through one at a time, waited for settings to apply, Re-connected the Pi a few times. Below are my observations.
LE 13.0-devel-20240911074922-8081b71

  • Band Steering (Working)
  • Proxy ARP (Working)
  • BSS Transition (Working)
  • UAPSD (Working)
  • Fast Roaming (802.11r) (Not working 'Invalid Key or I/O Error')

LE 12.0.0
Schrodinger's Wifi.
It was not working until I went and pulled the pi out of the lounge to test at my desk and on boot suddenly was working
Would you like me to repeat the run-through with the LE12 device?

@heitbaum
Copy link
Contributor

Need to check the journalctl - what card is in both? Is it the same? Errors, output? Test by swapping the SD cards?

LE12.0.1 is running kernel 6.6.45 (same as the LE13), iwd 2.19
LE12.0.0 is running kernel 6.6.28, iwd 2.17

There also is a reported “wireless strength” making things work in investigations todate. Did you by moving the RPi “fix that issue?”

@ronlaws86
Copy link

ronlaws86 commented Sep 11, 2024

Reported strength is -70db or higher, as the AP's are all within (human visible) range of the devices.

So right off the bat with the testing image, with 802.11r enabled, I see this in the serial console on bootup
[FAILED] Failed to start iwd.service.

Aug 15 20:47:14 LibreELEC connman-vpnd[352]: wlan0 {newlink} index 3 address B8:27:EB:49:3B:02 mtu 1500
Aug 15 20:47:14 LibreELEC connmand[647]: wlan0 {update} flags 4099 <UP>
Aug 15 20:47:14 LibreELEC connman-vpnd[352]: wlan0 {newlink} index 3 operstate 2 <DOWN>
Aug 15 20:47:14 LibreELEC connmand[647]: wlan0 {newlink} index 3 address B8:27:EB:49:3B:02 mtu 1500
Aug 15 20:47:14 LibreELEC connmand[647]: wlan0 {newlink} index 3 operstate 2 <DOWN>
Aug 15 20:47:14 LibreELEC kernel: brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
Aug 15 20:47:14 LibreELEC iwd[852]: event: state, old: disconnected, new: autoconnect_quick
Aug 15 20:47:15 LibreELEC iwd[852]: invalid HE capabilities for 0c:72:74:fc:f7:60
Aug 15 20:47:15 LibreELEC connmand[647]: ipconfig state 2 ipconfig method 1
Aug 15 20:47:15 LibreELEC iwd[852]: event: connect-info, ssid: TigerNet, bss: 80:2a:a8:81:19:6e, signal: -47, load: 77/255
Aug 15 20:47:15 LibreELEC iwd[852]: event: state, old: autoconnect_full, new: connecting
Aug 15 20:47:15 LibreELEC iwd[852]: event: connect-failed, status: 16
Aug 15 20:47:15 LibreELEC iwd[852]: event: connect-info, ssid: TigerNet, bss: 9c:05:d6:4b:03:be, signal: -70, load: 33/255
Aug 15 20:47:15 LibreELEC connmand[647]: ipconfig state 3 ipconfig method 1
Aug 15 20:47:15 LibreELEC iwd[852]: event: connect-failed, status: 16
Aug 15 20:47:15 LibreELEC iwd[852]: event: state, old: connecting, new: disconnected
Aug 15 20:47:15 LibreELEC iwd[852]: event: state, old: disconnected, new: autoconnect_quick
Aug 15 20:47:15 LibreELEC connmand[647]: ipconfig state 7 ipconfig method 1
Aug 15 20:47:15 LibreELEC iwd[852]: event: state, old: autoconnect_full, new: disconnected
Aug 15 20:47:16 LibreELEC systemd[1]: iwd.service: Main process exited, code=dumped, status=11/SEGV
Aug 15 20:47:16 LibreELEC systemd[1]: iwd.service: Failed with result 'core-dump'.
Aug 15 20:47:16 LibreELEC dbus-daemon[355]: [system] Activating via systemd: service name='net.connman.iwd' unit='iwd.service' requested by ':1.5' (uid=0 pid=647 comm="/usr/sb
Aug 15 20:47:17 LibreELEC systemd[1]: iwd.service: Scheduled restart job, restart counter is at 3.
Aug 15 20:47:17 LibreELEC systemd[1]: iwd.service: Start request repeated too quickly.
Aug 15 20:47:17 LibreELEC systemd[1]: iwd.service: Failed with result 'core-dump'.
Aug 15 20:47:17 LibreELEC systemd[1]: Failed to start iwd.service.
Aug 15 20:47:27 LibreELEC systemd[1]: systemd-hostnamed.service: Deactivated successfully.
Aug 15 20:47:41 LibreELEC dbus-daemon[355]: [system] Failed to activate service 'net.connman.iwd': timed out (service_start_timeout=25000ms)

@ronlaws86
Copy link

ronlaws86 commented Sep 11, 2024

Oh, and no, The other Pi was happy again back in its normal place i think it just needed the 'Off and on again' treatment, though based on the above i wonder too if iwd just crashed while i was changing settings (Hence rebooting fixed) So that's a possible red herring. with 802.11f Off, both devices seem content in connecting, that seems to be the only setting that causes problems so far. I might just ignore the rest of those settings, the default is for them to be off anyway, Band steering and BSS are the only on by default settings and neither of those seem to be causing any problems. The network isn't really dense enough to warrant the other fancy options in reality i think. 802.11r maybe?

@heitbaum
Copy link
Contributor

if you have the core dump - it would be good to run gdb on it (as it shouldn't core dump) maybe part of the change that was made in 2.21.

The cores will be located in /storage/.cache/cores/

# gdb /usr/lib/iwd /storage/.cache/cores/core.!usr!lib!iwd.1726057184.686
(gdb) t a a bt

we may need to generate a debug binary depending on what it shows.

@ronlaws86
Copy link

ronlaws86 commented Sep 11, 2024

if you have the core dump - it would be good to run gdb on it (as it shouldn't core dump) maybe part of the change that was made in 2.21.

The cores will be located in /storage/.cache/cores/

# gdb /usr/lib/iwd /storage/.cache/cores/core.!usr!lib!iwd.1726057184.686 (gdb) t a a bt

we may need to generate a debug binary depending on what it shows.

Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/iwd...
(No debugging symbols found in /usr/lib/iwd)

warning: exec file is newer than core file.
[New LWP 852]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/lib/iwd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x76f67020 in memcpy () from /usr/lib/libarmmem-v7l.so
(gdb) t a a bt

Thread 1 (Thread 0x76f6cfc0 (LWP 852)):
#0  0x76f67020 in memcpy () from /usr/lib/libarmmem-v7l.so
#1  0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

@ronlaws86
Copy link

ronlaws86 commented Sep 11, 2024

IWD Core Dumps.tar.gz
Wifi Chipset is the Built in Pi3 WiFi (brcmfmac according to lsmod and google)

@heitbaum
Copy link
Contributor

Here is an image with iwd including its debug symbols, so we should see a better backtrace.

LibreELEC-RPi2.arm-13.0-devel-20240911125647-cf72d84.img.gz

@ronlaws86
Copy link

LibreELEC:~/.cache/cores # gdb /usr/lib/iwd core.!usr!lib!iwd.1723755220.1151
GNU gdb (GDB) 15.1
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "armv7ve-libreelec-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/iwd...

warning: exec file is newer than core file.
[New LWP 1151]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/lib/iwd'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x76ed5020 in memcpy () from /usr/lib/libarmmem-v7l.so
(gdb) t a a bt

Thread 1 (Thread 0x76edafc0 (LWP 1151)):
#0  0x76ed5020 in memcpy () from /usr/lib/libarmmem-v7l.so
#1  0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

coredumps dbg.tar.gz

@heitbaum
Copy link
Contributor

2 more changes in the image linked

can you please confirm if you get a core dump is newer than the iwd (might be a Timezone thing)

https://heitbaum.libreelec.tv/
LibreELEC-RPi2.arm-13.0-devel-20240912094951-a2b89e5.img.gz

@ronlaws86
Copy link

ronlaws86 commented Sep 12, 2024

LibreELEC:~/.cache/cores # gdb /usr/lib/iwd /storage/.cache/cores/core.!usr!lib!
iwd.1723754898.356
GNU gdb (GDB) 15.1
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "armv7ve-libreelec-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/lib/iwd...

warning: exec file is newer than core file.
[New LWP 356]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/usr/lib/iwd -d'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x76fac020 in memcpy () from /usr/lib/libarmmem-v7l.so
(gdb) t a a bt

Thread 1 (Thread 0x76fb1fc0 (LWP 356)):
#0  0x76fac020 in memcpy () from /usr/lib/libarmmem-v7l.so
#1  0x00000000 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)

core.!usr!lib!iwd.1723754898.356.tar.gz
iwmon.log

@hagaygo
Copy link

hagaygo commented Oct 2, 2024

Not sure why this is closed , is it supposed to be fixed in LE 13 nightlies ?

Got RPi4 (LE 12.0.1) , positioning the device near the router , wifi is working just fine.
Positioning the device (same SD Card) on other room , keep getting invalid key from time to time. (almost after very reboot)

Installed latest Raspbian Os on the device , wifi is working just fine and with good speeds (both near and other room location)

So the issue is clearly a software issue , messing with the AP settings helped abit , but still with raspbian OS everything is working just fine without any need to tweak the AP settings (lowering security for other devices mainly)

@M95D
Copy link

M95D commented Oct 2, 2024

This is a rant and those who are easily offended shoud not read it.

This bug has nothing to do with router's settings, wifi drivers, kernel, devicetree, or any other settings. You can't fix it that way, so stop wasting your time (or anyone else's time for that matter)!

It is exclusively caused by iwd returning a wrong error message (invalid key) when the wifi auth fails for other reasons, most common due to lost/corrupted wifi packets*. It happens when the signal is weak or there is radio intereference. The only way to make it better is to improve the signal. Or fix it permanently by using a goddamn cable!

*It might work properly on Intel cards, since that was iwd's initial purpose. I can't test; I don't have any Intel cards.

To make things worse, LibreELEC erases the key when receiving that error message -- which is the wrong thing to do even if it really is a bad key. This forces the user to re-type the password from the start, usually with the on-screen virtual keyboard and a TV remote control, while the typed characters are hidden! Usability is atrocious. Most TV remotes via CEC skip or double typed characters and those ******* in the password field are very difficult to even count.
BT keyboards double or miss characters too, but BT (on rk3288 at least) hasn't been working since... let me think... oh, yeah, since v10, same as 3D stereoscopic video, same as... I should probably stop now.

Iwd will not get fixed soon, if ever. It's been years since this bug was discovered. There is no discussion about this on other OSs forums and bug trackers probably because those OSs don't erase the key when iwd reports the wrong error. Just hit "connect" again (with the mouse instead of a TV remote!), or simply wait, and it will succeed with the same key.

LE will also not get fixed soon, if ever. The devs insist they can't reproduce the error -- as if that matters. What are they gonna do? Fix iwd over the weekend and do a pull request upstream?? Hahaha. Fixing that means iwd must differentiate between a failed auth due to a bad key and a failed auth due to a corrupted packet containing the key. That will probably requre fundamental changes in iwd's design. That's months of work and no upstream will merge a PR like that.

At this point, the only hope is that someone would fork LE.
And this is my final comment. You won't see me again.

@pilian
Copy link

pilian commented Oct 2, 2024 via email

@hagaygo
Copy link

hagaygo commented Oct 3, 2024

While @pilian seems to make general sense in summing up things (in his on way) , whats still left a mystery (at least for me) is placing the same RPI4 device on same location with latest raspbian and not only there are no key/connection issues, the iperf3 (reverse mode of course) performance is also much better.

Getting about 15-20 mbits at best using LE but 90-110 mbits on raspbian OS. (same location same router).

Tested on another RPI4 device , exactly same result.

So again , it is a software issue , not a hardware one.

I can help debug/test the issue if needed , currently i am using an old router as "wifi bridge" to use the RPI4 device with ethernet.

@vilhelmgray
Copy link

@hagaygo In my testing I came across a similar discovery with my PineH64 device: #8731 (comment)

I copied the device tree blob from Armbian via /sys/firmware/fdt and overwrote the /flash/sun50i-h6-pine-h64-model-b.dtb file in LibreELEC. After rebooting, I no longer experience the WiFi scan issues and I can see networks consistently with Ethernet using just normal iwd.

It looks like simply replacing the device tree blob file in LibreELEC with the one from Armbian was enough to resolve the issue for my particular device.

It's possible that a similar situation is present for RPI4. Try copying the device tree blob from Armbian and replacing the respective file in your LibreELEC. I'm interested if this resolves the issue for RPI4, which would allow us to hone in on the issue by comparing the device tree differences between Armbian and LibreELEC.

@hagaygo
Copy link

hagaygo commented Oct 3, 2024

@vilhelmgray

I am comparing to raspbian (raspberry pi os) so i assume you mean to copy the dtb file from raspbian (and not armbian).

Comparing the file bcm2711-rpi-4-b.dtb

LE 12.0.1 56,056 bytes

Raspberry pi OS 56,112 bytes

So you suggest i copy the file from raspbian os to LE ? any other files or just this one ?

Thanks in advance

@vilhelmgray
Copy link

@vilhelmgray

I am comparing to raspbian (raspberry pi os) so i assume you mean to copy the dtb file from raspbian (and not armbian).

Yes, sorry I meant raspbian.

Comparing the file bcm2711-rpi-4-b.dtb

LE 12.0.1 56,056 bytes

Raspberry pi OS 56,112 bytes

I copied directly from /sys/firmware/fdt to ensure I got the actual dtb used on the running system that worked, but if you know for certain it's bcm2711-rpi-4-b.dtb then you can copy that.

On LibreELEC, there is a /flash/directory with where the LE dtb file is located. Overwrite that file with the contents of the dtb you got from raspbian.

So you suggest i copy the file from raspbian os to LE ? any other files or just this one ?

That was the only change I made which what made me realize that the issue was not with iwd but rather the device tree configuration on LE.

@hagaygo
Copy link

hagaygo commented Oct 3, 2024

Tried both copying the bcm2711-rpi-4-b.dtb file from rpi os and the fdt one after boot (the fdt one was bit larger is size tough no other file matched the size)

Both booted fine but had same wifi behavior as the original one.

To make sure i am replacing the correct file i renamed the bcm2711-rpi-4-b.dtb to bcm2711-rpi-4-b.dtbbbb and pi would not boot.

So i guess its not the firmware file fault.

@vilhelmgray
Copy link

Tried both copying the bcm2711-rpi-4-b.dtb file from rpi os and the fdt one after boot (the fdt one was bit larger is size tough no other file matched the size)

The FDT binary being larger isn't too unusual because it can also contain changes made to the blob by the bootloader.

Both booted fine but had same wifi behavior as the original one.

To make sure i am replacing the correct file i renamed the bcm2711-rpi-4-b.dtb to bcm2711-rpi-4-b.dtbbbb and pi would not boot.

So i guess its not the firmware file fault.

That's too bad. Unfortunately, with the invalid-key error message being so generic, it doesn't really tell us where the problem lies. It looks like for your RPI4 issue it's not the dtb, so at least we know that now thanks to your testing.

@ronlaws86
Copy link

I wouldn't at all be surprised if the network manager application in Rasbian is 'working around' the issue in some way that LE is not. Erasing the key on failure is the first indication to me of presumptuous software design, that is treating the errors as gospel and not as potential red herrings. It might be worth changing whatever front-end is controlling iwd on LE to assume the error is temporary and re-trying for a set amount of tries before giving up, but also not erasing the provided network key, because as we have seen, auth error could mean anything and not always that the key is bad, it should be up to the user to determine if they key is in fact bad and change it, or if the auth error is something else, removing the need to have to re-enter it every time something interrupts the connection (Which is bad UI design whatever way you spin it) this at least is the default behavior in 'Network-manager' the previously entered key is retained in the form for the user to reveal and verify, because wireless communication is not perfect, and sometimes S*t happens.

@borsti67
Copy link

This is still not solved from 2022??
I think I ran into this issue now as well with the latest stable. Sometimes the Raspi400 gets kicked out of the WiFi for no obvious reason, quite often when switching from TV to Kodi after a longer time of inactivity the TV shows "network disconnected". The key seems not to be erased, a reboot helps. But this is very inconvenient, of course. I have a lot of other Raspi and similar using Debian based Linux OSs, mostly with NetworkManager which in case of a dropout immediately tries to reconnect to any known, reachable WiFi. Why is this so hard here?

@jakey1995abc
Copy link

Nice to see that this is still not getting the attention it deserves

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests