termux / termux-packages

A package build system for Termux.
https://termux.dev
Other
12.98k stars 2.98k forks source link

[Bug]: wpa_supplicant #19823

Open Dlazder opened 4 months ago

Dlazder commented 4 months ago

Problem description

wpa_supplicant not working as expected.

I am running sudo wpa_supplicant -i wlan0 -c ./wpa.conf But get something like this

Successfully initialized wpa_supplicant
nl80211: kernel reports: Authentication algorithm number required
nl80211: kernel reports: Match already configured
nl80211: kernel reports: Match already configured
...........
...........

I have root

What steps will reproduce the bug?

Create wpa.conf using wpa_passphrase essidname password > wpa.conf

network={
        ssid="essidname"
        #psk="12345678"
        psk=532c4716b258a04164ea62f1518afd924c19c74676afd1a3983a4ada9dd70197
}

After this sudo wpa_supplicant -i wlan0 -c ./wpa.conf

What is the expected behavior?

I want to receive a message about successful or unsuccessful connection. I assume that all this depends in particular on the device, so this problem may not be for everyone.

System information

termux-info:

Termux Variables:
TERMUX_API_VERSION=0.50.1
TERMUX_APK_RELEASE=F_DROID
TERMUX_APP_PACKAGE_MANAGER=apt
TERMUX_APP_PID=23425
TERMUX_IS_DEBUGGABLE_BUILD=0
TERMUX_MAIN_PACKAGE_FORMAT=debian
TERMUX_VERSION=0.118.0
TERMUX__USER_ID=0
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://mirror.leitecastro.com/termux/termux-main stable main
# root-repo (sources.list.d/root.list)
deb https://mirror.leitecastro.com/termux/termux-root root stable
Updatable packages:
libxcb/stable 1.17.0 aarch64 [upgradable from: 1.16.1]
termux-tools version:
1.42.0
Android version:
14
Kernel build information:
Linux localhost 5.10.168-android12-9-00001-g81e7418c6466-ab10486262 #1 SMP PREEMPT Wed Jul 12 13:56:37 UTC 2023 aarch64 Android
Device manufacturer:
Xiaomi
Device model:
22071219CG
LD Variables:
LD_LIBRARY_PATH=
LD_PRELOAD=/data/data/com.termux/files/usr/lib/libtermux-exec.so
Installed termux plugins:
com.termux.api versionCode:51
com.termux.styling versionCode:31
sylirre commented 4 months ago

Your error suggests that there is some range condition between your wpa_supplicant and other network configuration utility. This is not a bug or other issue kind of wpa_supplicant.

Disable Android WiFi management before using wpa_supplicant on your own.

Dlazder commented 4 months ago

@sylirre How can I turn it off? I didn't find any information about this. If you just turn off Wi-Fi then the wlan0 interface will not be available, I don't think that's it.

sylirre commented 4 months ago

If you just turn off Wi-Fi then the wlan0 interface will not be available, I don't think that's it.

Indeed you have to turn wifi off. The interface does not disappear. You need to up it using ifconfig.

Termux wpa_supplicant and Android OS wifi management can't coexist as will conflict with each other.

Dlazder commented 4 months ago

@sylirre IMG_20240418_090215

sylirre commented 4 months ago

If your device uses kernel modules, you need to load one with insmod first.

insmod is not provided by Termux. You may need to use one from /system/bin, /system/xbin or other system binary directory.

What module to load is device specific. sudo cat /proc/modules may give some hint: run when wifi enabled in Android and check difference with content when wifi is off.

Dlazder commented 4 months ago

IMG_20240418_134802 No difference. In the first case I am connected to home Wi-Fi. In the second just turned off

IMG_20240418_135703 In this case there is a difference, here I tried turn on Wi-Fi but do not connect to the hotspot

In the /system i have xbin directory, it's empty

Dlazder commented 4 months ago

I want to add an important detail, wpa_supplicant works, and I can process the output using the stream editor. A lot of different error messages bother me.