0

I am trying to setup a Raspberry Pi with RaspAP so that a computer can connect to the Pi over its wireless access point, access it through SSH on a static IP address, but also be able to access the internet through the Pi's second WiFi connection with a USB wifi adapter plugged into the Pi. This setup is not working out of the box.

I bought a new Raspberry Pi 4B 8GB, imaged it with Raspberry PI OS 32-bit, and plugged in Edimax 7811Un wireless adapter suggested in RaspAP documentation (also tried Ralink RT5370 on supported list).

After installing updates and setting WiFi Country, I installed RaspAP using instructions at https://raspap.com/ and verified the default setup was working.

RaspAP created a wireless access point on wlan0 (the Raspberry Pi's on-board wlan adapter) and used eth0 (on-board ethernet) to connect to my home network and access the Internet. I was able to connect to RaspAP's wireless access point and access the Internet through internet connection sharing established by RaspAP using dnsmasq and IP forwarding.

Then I went to follow steps in "Can I use wlan0 and wlan1 rather than eth0 for my AP?" (https://docs.raspap.com/faq/). I went to the Hotspot page, changed it to use wlan1 (Edimax), saved settings, and restarted hotspot. When I went to connect to the access point with my computer, it connected successfully, but internet connection sharing didn't work - any attempt to access the internet from the computer connected to Pi's AP just displayed an error saying there was no internet.

I re-installed RaspAP to get back to the original state, and the AP control panel at 10.3.141.1 stopped working. Both wlans stopped being able to connect to the Internet (wlan0 not associated despite wpa_supplicant still having the information needed to connect to my home WiFi, wlan1 has a static IP and not bound). If the ethernet was plugged in, I could still get an Internet connection, but of course the reason I want to set this whole thing up is because I won't have ethernet available in production.

At this point, no matter how many times I re-installed RaspAP I always get into this "broken, cannot reinstall" state and have to re-image the whole SD card and start over. The logs basically said wlan driver failed on startup and hostapd could not start, because it failed to set AP mode (mode 3) on the wlan adapter, giving "device not found" (-19) as the reason even though it was listed as a USB device:

failed to set interface index 3 to mode 3: -19 (not found)

Occasionally, after re-installing and restarting 2-3 times the RaspAP control panel would start working suddenly but say that hostapd is down (and then stop working again on the next restart).

I attempted the following:

I included the system information and logs useful for troubleshooting below.

RaspAP hotspot log

Configuration file: /etc/hostapd/hostapd.conf
wlan0: interface state UNINITIALIZED->COUNTRY_UPDATE
Using interface wlan0 with hwaddr 0c:8c:24:b6:f2:a6 and ssid "str1ker"
wlan0: interface state COUNTRY_UPDATE->ENABLED
wlan0: AP-ENABLED 
wlan0: STA f0:18:98:0c:6d:45 IEEE 802.11: authenticated
wlan0: STA f0:18:98:0c:6d:45 IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED f0:18:98:0c:6d:45
wlan0: STA f0:18:98:0c:6d:45 RADIUS: starting accounting session 0C45B706D0EF1125
wlan0: STA f0:18:98:0c:6d:45 WPA: pairwise key handshake completed (RSN)

DNSMasq log

Oct  1 22:15:24 dnsmasq[1462]: started, version 2.80 cachesize 150
Oct  1 22:15:24 dnsmasq[1462]: compile time options: IPv6 GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth DNSSEC loop-detect inotify dumpfile
Oct  1 22:15:24 dnsmasq-dhcp[1462]: DHCP, IP range 10.3.141.50 -- 10.3.141.255, lease time 12h
Oct  1 22:15:24 dnsmasq[1462]: no servers found in /run/dnsmasq/resolv.conf, will retry
Oct  1 22:15:24 dnsmasq[1462]: read /etc/hosts - 5 addresses

System log

pi@raspberrypi:~ $ cat /var/log/messages | tail
Oct  1 22:17:17 raspberrypi kernel: [   20.146878] rtl8192cu: Tx queue select: 0x05
Oct  1 22:17:19 raspberrypi kernel: [   21.988367] wlan1: authenticate with cc:03:fa:de:05:22
Oct  1 22:17:19 raspberrypi kernel: [   22.009269] wlan1: send auth to cc:03:fa:de:05:22 (try 1/3)
Oct  1 22:17:19 raspberrypi kernel: [   22.107152] wlan1: authenticated
Oct  1 22:17:19 raspberrypi kernel: [   22.114400] wlan1: associate with cc:03:fa:de:05:22 (try 1/3)
Oct  1 22:17:19 raspberrypi kernel: [   22.174000] wlan1: RX AssocResp from cc:03:fa:de:05:22 (capab=0x411 status=0 aid=7)
Oct  1 22:17:19 raspberrypi kernel: [   22.176697] wlan1: associated
Oct  1 22:17:19 raspberrypi kernel: [   22.228962] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
Oct  1 22:17:22 raspberrypi kernel: [   24.541551] ICMPv6: process `dhcpcd' is using deprecated sysctl (syscall) net.ipv6.neigh.wlan1.retrans_time - use net.ipv6.neigh.wlan1.retrans_time_ms instead
Oct  4 10:08:03 raspberrypi rsyslogd:  [origin software="rsyslogd" swVersion="8.1901.0" x-pid="380" x-info="https://www.rsyslog.com"] rsyslogd was HUPed

Kernel log

[    6.134023] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
[    6.134545] ieee80211 phy1: Selected rate control algorithm 'rtl_rc'
[    6.142513] usbcore: registered new interface driver rtl8192cu
[    7.958137] uart-pl011 fe201000.serial: no DMA platform data
[    8.188917] random: crng init done
[    8.188941] random: 7 urandom warning(s) missed due to ratelimiting
[    8.395792] 8021q: 802.1Q VLAN Support v1.8
[    8.734505] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS
[    8.840376] brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled
[    9.187847] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[    9.317147] rtl8192cu: MAC auto ON okay!
[    9.356984] rtl8192cu: Tx queue select: 0x05
[    9.999716] bcmgenet fd580000.ethernet: configuring instance for external RGMII (RX delay)
[    9.999992] bcmgenet fd580000.ethernet eth0: Link is Down
[   10.879298] broken atomic modeset userspace detected, disabling atomic
[   11.215947] wlan1: authenticate with cc:03:fa:de:05:22
[   11.237745] wlan1: send auth to cc:03:fa:de:05:22 (try 1/3)
[   11.325937] wlan1: authenticated
[   11.334411] wlan1: associate with cc:03:fa:de:05:22 (try 1/3)
[   11.402524] wlan1: RX AssocResp from cc:03:fa:de:05:22 (capab=0x411 status=0 aid=7)
[   11.504807] wlan1: associated
[   11.575156] cryptd: max_cpu_qlen set to 1000
[   11.594080] IPv6: ADDRCONF(NETDEV_CHANGE): wlan1: link becomes ready
[   13.249656] ieee80211 phy0: brcmf_vif_set_mgmt_ie: vndr ie set error : -52

Raspapd status

sudo systemctl status raspapd.service

Raspapd service is loaded but not running, last ran at installation time

-- Logs begin at Fri 2021-10-01 21:40:48 HDT, end at Fri 2021-10-01 21:41:55 HDT. --
Oct 01 21:40:59 raspberrypi systemd[1]: Starting RaspAP Service Daemon...
Oct 01 21:40:59 raspberrypi bash[816]: Stopping network services...
Oct 01 21:41:00 raspberrypi bash[816]: Changing RaspAP Daemon --interface to uap0
Oct 01 21:41:00 raspberrypi bash[816]: Disabling systemd-networkd
Oct 01 21:41:01 raspberrypi bash[816]: Starting network services...
Oct 01 21:41:08 raspberrypi bash[816]: RaspAP service start DONE
Oct 01 21:41:08 raspberrypi systemd[1]: raspapd.service: Succeeded.
Oct 01 21:41:08 raspberrypi systemd[1]: Started RaspAP Service Daemon.

Hostapd status

root@raspberrypi:~ # systemctl status hostapd
● hostapd.service - Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator
   Loaded: loaded (/lib/systemd/system/hostapd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-10-01 21:48:07 HDT; 2min 7s ago
  Process: 2283 ExecStart=/usr/sbin/hostapd -B -P /run/hostapd.pid -B $DAEMON_OPTS ${DAEMON_CONF} (code=exited, status=0/SUCCESS)
 Main PID: 2284 (hostapd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/hostapd.service
           └─2284 /usr/sbin/hostapd -B -P /run/hostapd.pid -B -f /tmp/hostapd.log /etc/hostapd/hostapd.conf

Oct 01 21:48:06 raspberrypi systemd[1]: Starting Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator...
Oct 01 21:48:07 raspberrypi systemd[1]: Started Advanced IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP Authenticator.
Oct 01 21:48:15 raspberrypi hostapd[2284]: wlan0: STA f0:18:98:0c:6d:45 IEEE 802.11: authenticated
Oct 01 21:48:15 raspberrypi hostapd[2284]: wlan0: STA f0:18:98:0c:6d:45 IEEE 802.11: associated (aid 1)
Oct 01 21:48:15 raspberrypi hostapd[2284]: wlan0: STA f0:18:98:0c:6d:45 RADIUS: starting accounting session 0C45B706D0EF1125
Oct 01 21:48:15 raspberrypi hostapd[2284]: wlan0: STA f0:18:98:0c:6d:45 WPA: pairwise key handshake completed (RSN)

DNSMasq status

root@raspberrypi:~ # systemctl status dnsmasq
● dnsmasq.service - dnsmasq - A lightweight DHCP and caching DNS server
   Loaded: loaded (/lib/systemd/system/dnsmasq.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-10-01 21:48:13 HDT; 2min 59s ago
  Process: 2343 ExecStartPre=/usr/sbin/dnsmasq --test (code=exited, status=0/SUCCESS)
  Process: 2344 ExecStart=/etc/init.d/dnsmasq systemd-exec (code=exited, status=0/SUCCESS)
  Process: 2353 ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf (code=exited, status=0/SUCCESS)
 Main PID: 2352 (dnsmasq)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/dnsmasq.service
           └─2352 /usr/sbin/dnsmasq -x /run/dnsmasq/dnsmasq.pid -u dnsmasq -r /run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpkg-dist,.dp

Oct 01 21:48:13 raspberrypi systemd[1]: Starting dnsmasq - A lightweight DHCP and caching DNS server...
Oct 01 21:48:13 raspberrypi dnsmasq[2343]: dnsmasq: syntax check OK.
Oct 01 21:48:13 raspberrypi dnsmasq[2353]: Too few arguments.
Oct 01 21:48:13 raspberrypi systemd[1]: Started dnsmasq - A lightweight DHCP and caching DNS server.

2
  • 1
    Maybe open /etc/hostapd/hostapd.conf and configure the correct wireless adapter manually?
    – cybernard
    Commented Sep 15, 2021 at 20:11
  • Spent a few weeks trying that, didn't make a difference
    – user138961
    Commented Sep 19, 2021 at 16:54

2 Answers 2

0

Ran through a clean install on both RPi OS Lite (32-bit) and Desktop, connected to the default raspap-webgui AP with several devices and accessed the web UI. Worked flawlessly in both cases (posting this connected to the AP).

Best advice I can offer is to follow the project prerequisites with a fresh OS install and the onboard wireless chipset before trying external adapters. The project FAQ will help you select a compatible USB WiFi device with in-kernel drivers. The RaspAP tools repo on GitHub has helper scripts to install pre-compiled WLAN driver modules for different RPi OS kernel versions. Alternatively, if you prefer to compile drivers from scratch, the script install_wlan_drivers_8812au_88x2bu.sh extracts the source for two very common drivers (Realtek 8812au and 88x2bu) from Github.

RaspAP took down hostapd service because it configured a setting that doesn't work

RaspAP does no such thing. It's a frontend for several network related services only, including hostpad. The official docs have troubleshooting tips that will help you determine why hostapd is failing to start for you.

Source: developer of RaspAP

8
  • Hi billz, this is my 15th time re-imaging RPi OS Desktop and I read the FAQ several times (I bought two compatible adapters on the list + another copy of the one I used previously to ensure I didn't get bad hardware). The basic setup where you bridge ethernet to on-board wifi works fine, but the one I am using is bridging on-board wifi to a USB adapter wifi. As soon as I setup either wlan as AP and the other as the client and unplug ethernet, RPi can no longer access the internet, even though it says it's bound to my home network and successfully connected. I get similar results without RaspAP
    – user138961
    Commented Sep 21, 2021 at 6:10
  • Update on RaspAP tools: first I went to far-robotics.net website to find a driver for my version of Raspberry Pi OS. Their list stops at major version 3, and my OS version is 5.10.17 as reported by uname -a.
    – user138961
    Commented Sep 21, 2021 at 6:33
  • I cloned RaspAP tools repo, executed install_wlan_driver_modules.sh and it said "No device connected...Driver might already be installed". Then it listed one of the devices I tried with, LB-Link having RTL8188CUS chipset. This is on a brand new OS image with updates installed and nothing else done. Then I plugged in TP-link on Raspberry Pi supported list, and it printed "Install driver for ..." without any other information. Finally I plugged in AWUS036ACHM on your supported list and it printed the same thing again with ellipsis and nothing else.
    – user138961
    Commented Sep 21, 2021 at 6:39
  • docs.raspap.com/ap-basics/#diagnosing-problems
    – billz
    Commented Sep 22, 2021 at 7:07
  • I updated the question after another couple of weeks of troubleshooting and trying more software & hardware changes
    – user138961
    Commented Oct 23, 2021 at 21:03
0

The solution that worked for me was setting up the wireless access point manually by following steps in https://www.raspberrypi.com/documentation/computers/configuration.html#setting-up-a-routed-wireless-access-point, than replacing the routing rule to direct traffic to wlan1 instead of eth0 as the original article directs:

sudo iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
sudo netfilter-persistent save

Additionally, the following wireless adapters used to work for Raspberry Pi and no longer do:

  • Edimax EW-7811Un (on RaspAP supported list) didn't work
  • TP-Link TL-WN722N didn't work
  • Alfa AWUS036ACHM didn't work
  • LB-Link RTL8188CUS (the original adapter that used to work) didn't work

I got it to work with this adapter:

  • Ralink RT5370 (on RaspAP supported list)

Thanks to epoch1970 from Raspberry Pi forums for this solution, see original thread in https://forums.raspberrypi.com/viewtopic.php?p=1932107#p1932107

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.