RaspAP/raspap-webgui

[Bug]: RaspAP web-gui not detecting WiFi stations, but wpa_cli in the shell works

Closed this issue · 4 comments

Code of Conduct

  • I agree to follow this project's Code of Conduct.

Issue reporting checklist

Operating System

Raspberry Pi OS (64-bit) Lite Bookworm

Quick install or Manual setup?

Quick install

Onboard wireless chipset or external adapter?

External adapter

Hardware

Raspberry Pi 4 Model B

RaspAP version

3.0 (Latest)

Other software or services running with RaspAP?

No other software

Contact details (optional)

No response

Bug description

I am using a Ralink Technology, Corp. MT7601U Wireless Adapter usb wifi dongle. I have checked that this is compatible with the Pi using the kernel drivers.

I have completed a fresh setup of the Pi and RaspAP. I use the on-board wifi adapter in AP mode (as the USB adapter does not support AP mode). I then try to use the USB adapter in client mode to connect to a wifi network.

The expected behaviour is that the RasPi GUI should list available wifi networks.

However, I see that Wifi client does not detect any wifi stations. Re-initialising wpa_supplicant does not help either.

I have looked up the FAQ as suggested in a previous post, but it seems to me that wpa_cli seems to be working from the shell. It is only in the web-gui that it seems to be failing.

Steps to reproduce

  • Complete fresh install of RaspAP
  • Configure in-built wifi adapter to AP mode
  • Attempt to use USB wifi adapter in client mode to scan for networks

Screenshots

No response

Additional context

No response

Relevant log output

888888ba                              .d888888   888888ba
   88     8b                            d8     88   88     8b
  a88aaaa8P' .d8888b. .d8888b. 88d888b. 88aaaaa88a a88aaaa8P
   88    8b. 88    88 Y8ooooo. 88    88 88     88   88
   88     88 88.  .88       88 88.  .88 88     88   88
   dP     dP  88888P8  88888P  88Y888P  88     88   dP
                               88
                               dP     Debug Log Generator 1.0

This process collects debug and troubleshooting information about your RaspAP installation.
It is intended to assist users with a self-diagnosis of their installations, as well as
provide useful information as a starting point for others to assist with troubleshooting.
Debug log information contains the RaspAP version, current state and configuration of AP
related services, relevant installed package versions, Linux kernel version and local
networking configuration details.

If you wish to share your debug info, paste the output to one of the following:
  https://pastebin.com/
  https://paste.ubuntu.com/

Please do NOT paste the log in its entirety to RaspAP's discussions, issues or other
support channels. Use one of the above links instead.

DISCLAIMER: This log DOES contain details about your system, including networking
settings. However, NO passwords or other sensitive data are included in the debug output.
========================================================================================

Debug log generation started at Tue Nov 14 15:32:54 GMT 2023

System Info
===========
Hardware: Raspberry Pi 4 Model B Rev 1.5
Detected OS: Debian GNU/Linux 12 (bookworm) 64-bit
Kernel: Linux magpie 6.1.0-rpi6-rpi-v8 #1 SMP PREEMPT Debian 1:6.1.58-1+rpt2 (2023-10-27) aarch64 GNU/Linux
System Uptime: 0 days, 0 hours, 23 minutes
Memory Usage: 3.17501%

Installed Packages
==================
PHP Version: 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)
Dnsmasq Version: 2.89
dhcpcd Version: 9.4.1
lighttpd Version: 1.4.69
vnStat Version: 2.10

RaspAP Install
==============
RaspAP Version: 3.0
RaspAP Installation Directory: /var/www/html
RaspAP hostapd.ini contents:
WifiInterface = wlan0
LogEnable = 0
WifiAPEnable = 0
BridgedEnable = 0
WifiManaged = wlan0
RaspAP provider.ini: providerID = 3

USB Devices
===========
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 148f:7601 Ralink Technology, Corp. MT7601U Wireless Adapter
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

WPA Supplicant
==============
Selected interface 'wlx90de807ac0a0'
wpa_state=DISCONNECTED
p2p_device_address=da:3a:dd:56:67:cd
address=90:de:80:7a:c0:a0
uuid=25bd1724-29c2-5e4a-a7ff-c8005120594c

Dnsmasq Contents
================
/etc/dnsmasq.d/090_adblock.conf
/etc/dnsmasq.d/090_raspap.conf
/etc/dnsmasq.d/090_usb0.conf
/etc/dnsmasq.d/090_wlan0.conf

/etc/dnsmasq.d/090_adblock.conf contents:
conf-file=/etc/raspap/adblock/domains.txt
addn-hosts=/etc/raspap/adblock/hostnames.txt$

/etc/dnsmasq.d/090_raspap.conf contents:
# RaspAP default config
log-facility=/var/log/dnsmasq.log
conf-dir=/etc/dnsmasq.d$

/etc/dnsmasq.d/090_usb0.conf contents:
# RaspAP usb0 configuration for wired (ethernet)
interface=usb0
domain-needed
dhcp-range=10.71.73.7,10.71.73.17,255.255.255.0,12h$

/etc/dnsmasq.d/090_wlan0.conf contents:
# RaspAP wlan0 configuration
interface=wlan0
domain-needed
dhcp-range=10.73.71.7,10.73.71.89,255.255.255.0,12h$


Dhcpcd Contents
===============
# RaspAP default configuration
hostname
clientid
persistent
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname

# RaspAP usb0 configuration
interface usb0
static ip_address=10.71.73.1/24
static routers=10.71.73.1
nogateway

# RaspAP wlan0 configuration
interface wlan0
static ip_address=10.73.71.1/24
static routers=10.73.71.1
nogateway

Interfaces
==========
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host noprefixroute
       valid_lft forever preferred_lft forever
2: end0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether d8:3a:dd:56:67:cc brd ff:ff:ff:ff:ff:ff
3: usb0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 46:d8:39:17:a8:fe brd ff:ff:ff:ff:ff:ff
    inet 10.71.73.1/24 brd 10.71.73.255 scope global noprefixroute usb0
       valid_lft forever preferred_lft forever
    inet6 fe80::979c:b4b0:c318:c64f/64 scope link
       valid_lft forever preferred_lft forever
4: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d8:3a:dd:56:67:cd brd ff:ff:ff:ff:ff:ff
    inet 10.73.71.1/24 brd 10.73.71.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::c1f1:f371:fc55:585a/64 scope link
       valid_lft forever preferred_lft forever
5: wlx90de807ac0a0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 90:de:80:7a:c0:a0 brd ff:ff:ff:ff:ff:ff

Routing Table
=============
10.71.73.0/24 dev usb0 proto dhcp scope link src 10.71.73.1 metric 1003
10.73.71.0/24 dev wlan0 proto dhcp scope link src 10.73.71.1 metric 3004

IW Device Info
==============
phy#1
	Interface wlx90de807ac0a0
		ifindex 5
		wdev 0x100000001
		addr 90:de:80:7a:c0:a0
		type managed
		txpower 20.00 dBm
phy#0
	Unnamed/non-netdev interface
		wdev 0x2
		addr da:3a:dd:56:67:cd
		type P2P-device
		txpower 31.00 dBm
	Interface wlan0
		ifindex 4
		wdev 0x1
		addr d8:3a:dd:56:67:cd
		ssid magpie
		type AP
		channel 1 (2412 MHz), width: 20 MHz, center1: 2412 MHz
		txpower 31.00 dBm

IW Regulatory Info
==================
global
country GB: DFS-ETSI
	(2400 - 2483 @ 40), (N/A, 20), (N/A)
	(5150 - 5250 @ 80), (N/A, 23), (N/A), NO-OUTDOOR, AUTO-BW
	(5250 - 5350 @ 80), (N/A, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
	(5470 - 5730 @ 160), (N/A, 26), (0 ms), DFS
	(5725 - 5850 @ 80), (N/A, 23), (N/A), NO-OUTDOOR
	(5925 - 6425 @ 160), (N/A, 23), (N/A), NO-OUTDOOR
	(57000 - 71000 @ 2160), (N/A, 40), (N/A)

phy#0
country 99: DFS-UNSET
	(2402 - 2482 @ 40), (6, 20), (N/A)
	(2474 - 2494 @ 20), (6, 20), (N/A)
	(5140 - 5360 @ 160), (6, 20), (N/A)
	(5460 - 5860 @ 160), (6, 20), (N/A)

Systemd Services
================
hostapd status:
● hostapd.service - Access point and authentication server for Wi-Fi and Ethernet
     Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-11-14 15:09:52 GMT; 23min ago
       Docs: man:hostapd(8)
    Process: 854 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SUCCESS)
   Main PID: 855 (hostapd)
      Tasks: 1 (limit: 8741)
        CPU: 69ms
     CGroup: /system.slice/hostapd.service
             └─855 /usr/sbin/hostapd -B -P /run/hostapd.pid /etc/hostapd/hostapd.conf

Nov 14 15:09:51 magpie systemd[1]: Starting hostapd.service - Access point and authentication server for Wi-Fi and Ethernet...
Nov 14 15:09:51 magpie hostapd[854]: wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Nov 14 15:09:52 magpie hostapd[854]: wlan0: interface state COUNTRY_UPDATE->ENABLED
Nov 14 15:09:52 magpie hostapd[854]: wlan0: AP-ENABLED
Nov 14 15:09:52 magpie systemd[1]: Started hostapd.service - Access point and authentication server for Wi-Fi and Ethernet.

dnsmasq status:
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
     Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-11-14 15:09:59 GMT; 22min ago
    Process: 891 ExecStartPre=/etc/init.d/dnsmasq checkconfig (code=exited, status=0/SUCCESS)
    Process: 898 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
    Process: 906 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
   Main PID: 905 (dnsmasq)
      Tasks: 1 (limit: 8741)
        CPU: 5.668s
     CGroup: /system.slice/dnsmasq.service
             └─905 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -7 /etc/dnsmasq.d,.dpkg-dist,.dpkg-old,.dpkg-new --local-service --trust-anchor=.,20326,8,2,e06d44b80b8f1d39a95c0b0d7c65d08458e880409bbc683457104237c7f8ec8d

Nov 14 15:09:58 magpie systemd[1]: Starting dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server...
Nov 14 15:09:59 magpie systemd[1]: Started dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server.

dhcpcd status:
● dhcpcd.service - DHCP Client Daemon on all interfaces
     Loaded: loaded (/lib/systemd/system/dhcpcd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-11-14 15:09:55 GMT; 23min ago
       Docs: man:dhcpcd(8)
    Process: 858 ExecStart=/usr/sbin/dhcpcd -q -b (code=exited, status=0/SUCCESS)
   Main PID: 860 (dhcpcd)
      Tasks: 6 (limit: 8741)
        CPU: 174ms
     CGroup: /system.slice/dhcpcd.service
             ├─860 "dhcpcd: [manager] [ip4] [ip6]"
             ├─861 "dhcpcd: [privileged proxy]"
             ├─862 "dhcpcd: [network proxy]"
             ├─863 "dhcpcd: [control proxy]"
             ├─882 "dhcpcd: [BPF ARP] usb0 10.71.73.1"
             └─889 "dhcpcd: [BPF ARP] wlan0 10.73.71.1"

Nov 14 15:09:55 magpie dhcpcd[861]: wlan0: IAID dd:56:67:cd
Nov 14 15:09:55 magpie dhcpcd[861]: wlan0: adding address fe80::c1f1:f371:fc55:585a
Nov 14 15:09:55 magpie dhcpcd[861]: wlan0: probing address 10.73.71.1/24
Nov 14 15:09:55 magpie dhcpcd[861]: wlx90de807ac0a0: waiting for carrier
Nov 14 15:09:55 magpie dhcpcd[861]: usb0: soliciting an IPv6 router
Nov 14 15:09:55 magpie dhcpcd[861]: wlan0: soliciting an IPv6 router
Nov 14 15:10:00 magpie dhcpcd[861]: wlan0: using static address 10.73.71.1/24
Nov 14 15:10:00 magpie dhcpcd[861]: wlan0: adding route to 10.73.71.0/24
Nov 14 15:10:07 magpie dhcpcd[861]: usb0: no IPv6 Routers available
Nov 14 15:10:08 magpie dhcpcd[861]: wlan0: no IPv6 Routers available

systemd-networkd status:
○ systemd-networkd.service - Network Configuration
     Loaded: loaded (/lib/systemd/system/systemd-networkd.service; disabled; preset: enabled)
     Active: inactive (dead)
TriggeredBy: ○ systemd-networkd.socket
       Docs: man:systemd-networkd.service(8)
             man:org.freedesktop.network1(5)

wg-quick@wg0 status:
× wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0
     Loaded: loaded (/lib/systemd/system/wg-quick@.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2023-11-14 15:09:49 GMT; 23min ago
       Docs: man:wg-quick(8)
             man:wg(8)
             https://www.wireguard.com/
             https://www.wireguard.com/quickstart/
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg-quick.8
             https://git.zx2c4.com/wireguard-tools/about/src/man/wg.8
   Main PID: 793 (code=exited, status=1/FAILURE)
        CPU: 13ms

Nov 14 15:09:49 magpie systemd[1]: Starting wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0...
Nov 14 15:09:49 magpie wg-quick[793]: wg-quick: `/etc/wireguard/wg0.conf' does not exist
Nov 14 15:09:49 magpie systemd[1]: wg-quick@wg0.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 15:09:49 magpie systemd[1]: wg-quick@wg0.service: Failed with result 'exit-code'.
Nov 14 15:09:49 magpie systemd[1]: Failed to start wg-quick@wg0.service - WireGuard via wg-quick(8) for wg0.

openvpn-client@client status:
× openvpn-client@client.service - OpenVPN tunnel for client
     Loaded: loaded (/lib/systemd/system/openvpn-client@.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Tue 2023-11-14 15:09:49 GMT; 23min ago
       Docs: man:openvpn(8)
             https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
             https://community.openvpn.net/openvpn/wiki/HOWTO
   Main PID: 789 (code=exited, status=1/FAILURE)
        CPU: 41ms

Nov 14 15:09:49 magpie systemd[1]: Starting openvpn-client@client.service - OpenVPN tunnel for client...
Nov 14 15:09:49 magpie openvpn[789]: Options error: In [CMD-LINE]:1: Error opening configuration file: client.conf
Nov 14 15:09:49 magpie openvpn[789]: Use --help for more information.
Nov 14 15:09:49 magpie systemd[1]: openvpn-client@client.service: Main process exited, code=exited, status=1/FAILURE
Nov 14 15:09:49 magpie systemd[1]: openvpn-client@client.service: Failed with result 'exit-code'.
Nov 14 15:09:49 magpie systemd[1]: Failed to start openvpn-client@client.service - OpenVPN tunnel for client.

lighttpd status:
● lighttpd.service - Lighttpd Daemon
     Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; preset: enabled)
     Active: active (running) since Tue 2023-11-14 15:09:49 GMT; 23min ago
   Main PID: 802 (lighttpd)
      Tasks: 11 (limit: 8741)
        CPU: 1.976s
     CGroup: /system.slice/lighttpd.service
             ├─ 802 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
             ├─ 827 /usr/bin/php-cgi
             ├─ 830 /usr/bin/php-cgi
             ├─ 831 /usr/bin/php-cgi
             ├─ 832 /usr/bin/php-cgi
             ├─ 833 /usr/bin/php-cgi
             ├─1115 sh -c "sudo /etc/raspap/system/debuglog.sh -i /var/www/html"
             ├─1116 sudo /etc/raspap/system/debuglog.sh -i /var/www/html
             ├─1117 /bin/bash /etc/raspap/system/debuglog.sh -i /var/www/html
             ├─1244 /bin/bash /etc/raspap/system/debuglog.sh -i /var/www/html
             └─1245 systemctl status lighttpd

Nov 14 15:32:46 magpie sudo[1026]: pam_unix(sudo:auth): conversation failed
Nov 14 15:32:46 magpie sudo[1026]: pam_unix(sudo:auth): auth could not identify password for [www-data]
Nov 14 15:32:46 magpie sudo[1026]: www-data : command not allowed ; PWD=/var/www/html/ajax/networking ; USER=root ; COMMAND=/usr/sbin/wpa_cli -i wlx90de807ac0a0 scan
Nov 14 15:32:49 magpie lighttpd[1028]: sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
Nov 14 15:32:49 magpie lighttpd[1028]: sudo: a password is required
Nov 14 15:32:49 magpie sudo[1028]: pam_unix(sudo:auth): conversation failed
Nov 14 15:32:49 magpie sudo[1028]: pam_unix(sudo:auth): auth could not identify password for [www-data]
Nov 14 15:32:49 magpie sudo[1028]: www-data : command not allowed ; PWD=/var/www/html/ajax/networking ; USER=root ; COMMAND=/usr/sbin/wpa_cli -i wlx90de807ac0a0 scan_results
Nov 14 15:32:54 magpie sudo[1116]: www-data : PWD=/var/www/html/ajax/system ; USER=root ; COMMAND=/etc/raspap/system/debuglog.sh -i /var/www/html
Nov 14 15:32:54 magpie sudo[1116]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=33)

RaspAP debug log generation complete.

This project generally cannot support issues related to external hardware. However, you've provided a complete bug report so we can try to determine if this is an application issue.

Do these commands output a list of SSIDs?

sudo wpa_cli -i wlx90de807ac0a0 scan
sudo wpa_cli -i wlx90de807ac0a0 scan_results

This project generally cannot support issues related to external hardware. However, you've provided a complete bug report so we can try to determine if this is an application issue.

Do these commands output a list of SSIDs?

sudo wpa_cli -i wlx90de807ac0a0 scan
sudo wpa_cli -i wlx90de807ac0a0 scan_results

Sorry, I should have been clearer: yes, these commands output a list of SSIDs. That's what I meant by 'wpa_cli in the shell works' in my post above.

I have installed RaspAP app on my Raspberry Pi 4 running Debian and found similar problems when I used the Panda PAU0B or PAU0D which is plug and play on Debian Bookworm and also confirmed by Panda technical support. The built-in wireless LAN card on Raspberry Pi 4 is called 'wlan0' and Panda is called 'wlan1'.

I followed the instructions to set Raspberry Pi up as a WiFi repeater (https://docs.raspap.com/repeater/).
I encountered two issues when I followed 'Connect device to WiFi') with Panda PAU0B or PAU0D plugged into a USB port on the Raspberry Pi:

  1. When I go back and forward between web pages, sometimes there is no wireless networks showing up in the WiFi Client page. I need to restart my Raspberry Pi to see the wireless networks again.
  2. When I see the available networks in the WiFi Client page, I can add my network but I can't connect to it.

If I manually setup Panda adapter to connect to my network automatically, all I need to do the "Configure routing" section to raise the metric value for wlan0, restart the hotspot. Then I can connect my iPad to my Raspberry Pi and surf the Internet.
It also works after reboot. :)

From the terminal:
ao@raspberrypi:~ $ hostnamectl
Static hostname: raspberrypi
Icon name: computer
Machine ID: 3cffe4d039694b4e851ce42c0c2a2d89
Boot ID: c8f56e7793904071943c9d3b4a36dedd
Operating System: Debian GNU/Linux 12 (bookworm)
Kernel: Linux 6.1.0-rpi6-rpi-v8
Architecture: arm64

@athshean update: I was able to reproduce this with predictable interface names enabled on the non-dev branch of this project. RaspAP's sudoers file expects interface names that follow the typical wlan[0-9] pattern. wpa_cli will fail to execute from the app with other interfaces names.

I'll open a PR to address this. thanks for reporting.