FreeBSD 14, WiFi, TP-Link TL-WN821N dongle, rtwn0/wlan0 can't connect to the network

Hi there.
I am struggling with a rather annoying problem.

I decided to "dig up" an old minipc, a Dell OptiPlex 3040 micro and install FreeBSD on it.

uname -a
Code:
FreeBSD crap 14.0-RELEASE-p3 FreeBSD 14.0-RELEASE-p3 #0: Mon Dec 11 04:56:01 UTC 2023     root@amd64-builder.daemonology.net:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64

I bought a TP-Link TL-WN821N USB dongle to avoid using a cable connection (Link to TP-Link spec).
I have read rtwn(4), rtwn_usb(4), looked through many threads here on the forum and got to this point....

I have wlan0 added, however I cannot connect to any network.
I tested connecting to the router (2.4GHz, password), I also created a hotspot on my phone (2.4GHz, no password)
I tried establishing a connection manually using wpa_cli, ifconfig, networkmgr and zero results.

Here is my coniguration (I tried different combinations, but on these settings there is at least some effect - created wlan0)

/boot/loader.conf
(I tried everything, including single entries to load modules)
Code:
kern.vty=vt
#if_lagg_load="YES"

fusefs_load="YES"

if_rtwn_usb_load="YES"
if_rtwn_pci_load="YES"

if_rtwn_load="YES"

rtwn-rtl8192cfwE_B_load="YES"
rtwn-rtl8192cfwE_load="YES"
rtwn-rtl8192cfwT_load="YES"
rtwn-rtl8192cfwU_load="YES"
rtwn-rtl8192eufw_load="YES"

legal.realtek.license_ack=1

ls /etc/firmware/
Code:
LICENSE                       rtwn-rtl8192cfwT.fw.uu
rtwn-rtl8188eefw.fw.uu        rtwn-rtl8192cfwU.fw.uu
rtwn-rtl8188eufw.fw.uu        rtwn-rtl8192eufw.fw.uu
rtwn-rtl8192cfwE_B.fw.uu      rtwn-rtl8812aufw.fw.uu
rtwn-rtl8192cfwE.fw.uu        rtwn-rtl8821aufw.fw.uu

/etc/rc.conf
Code:
clear_tmp_enable="YES"
hostname="crap"
keymap="pl.kbd"
local_unbound_enable="YES"
sshd_enable="YES"
ntpd_enable="YES"
ntpd_sync_on_start="YES"
powerd_enable="YES"
dumpdev="AUTO"
webcamd_enable="NO"

##### [NET] #####
ifconfig_re0="DHCP"

wlans_rtwn0="wlan0"
ifconfig_wlan0="DHCP"
create_args_wlan0="country PL"
wpa_supplicant_enable="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
##################

#allscreens_flags="MODE_280"
kld_list="i915kms"

dbus_enable="YES"
gdm_enable="YES"
sddm_enable="YES"
sddm_lang="pl_PL.UTF-8"


/etc/wpa_supplicant.conf
Code:
ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1

network={
    scan_ssid=0
    ssid="MyNetwork"
    key_mgmt=WPA-PSK
    priority=0
    #psk="<mypassword>"
    psk=<mypsk>
}

network={
    scan_ssid=0
    ssid="Network_guest"
    psk=<mypsk>
    key_mgmt=WPA-PSK
    priority=1
}

# open network
network={
    ssid="converge"
    #psk="<mypass>"
    priority=2
}

tail -f /var/log/message
Code:
Jan 10 22:41:57 crap kernel: rtwn0 on uhub0
Jan 10 22:41:57 crap kernel: rtwn0: <802.11n NIC > on usbus0
Jan 10 22:41:57 crap kernel: rtwn0: MAC/BB RTL8192EU, RF 6052 2T2R
Jan 10 22:41:57 crap kernel: wlan0: Ethernet address: 5c:e9:XX:XX:XX:7f

ifconfig wlan0
Code:
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=0
    ether 5c:e9:XX:XX:XX:7f
    groups: wlan
    ssid "" channel 1 (2412 MHz 11g)
    regdomain ETSI country PL authmode OPEN privacy OFF txpower 30
    bmiss 7 scanvalid 60 protmode CTS wme
    parent interface: rtwn0
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

Also try...

wpa_supplicant -c /etc/wpa_supplicant.conf -i wlan0 -P /var/run/wpa_supplicant/wlan0.pid
Code:
Successfully initialized wpa_supplicant
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument
ioctl[SIOCS80211, op=20, val=0, arg_len=7]: Invalid argument

And still nothing

Code:
wlan0: flags=8803<UP,BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=0
    ether 5c:e9:XX:XX:XX:7f
    groups: wlan
    ssid "" channel 1 (2412 MHz 11g ht/20)
    regdomain ETSI country PL authmode WPA1+WPA2/802.11i privacy MIXED
    deftxkey UNDEF txpower 30 bmiss 7 scanvalid 60 protmode CTS ht20
    ampdulimit 8k ampdudensity 16 shortgi -stbc -ldpc -uapsd wme
    roaming MANUAL
    parent interface: rtwn0
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

ifconfig wlan0 up scan
Code:
SSID/MESH ID                      BSSID              CHAN RATE    S:N     INT CAPS
converge                          16:6c:XX:XX:6d:14    1   54M  -68:-95   100 ES   HTCAP VHTCAP VHTOPMODE VHTPWRENV WME
XXXXXX                            d4:f8:XX:XX:4d:b0    6   54M  -73:-95   100 EP   RSN BSSLOAD HTCAP WPS WME
                                  b4:f1:XX:XX:f1:64    4   54M  -83:-95   100 EPS  RSN WME BSSLOAD HTCAP
MyNetwork                         c8:7f:XX:XX:4b:b0    5   54M  -79:-95   100 EP   RSN BSSLOAD HTCAP VHTCAP VHTOPMODE WME
XXXXXX                            40:ee:XX:XX:63:68   10   54M  -83:-95    40 EP   BSSLOAD HTCAP WPA RSN WME WPS

There is a problem with the creation of wlan0 during system startup.
Once I log in and remove and reinsert the card wlan0 is created.

Then when I call the command
ifconfig every few seconds I see that the system is scanning the networks stored in
/etc/wpa_supplicant.conf. The channel changes.
It connects to that one open network, but does not get an address and the status is always
Code:
status: no carrier

Sorry for the haos in my post, but I can't very well describe my problem.

In short: I can't connect to any network.

PS:Here is my HW Probe output
 
Back
Top