# iwlwifi keeps disconnecting with Reason: 3=DEAUTH_LEAVING

## yuri69

Using Intel iwlwifi in DVM mode with kernel 5.13 on an old Lenovo T430.

The WiFi connection goes down and back up from time to time. The stable period is sometimes hours, sometimes just a minute or so. It is quite annoying and I've already spent some time solving that.

----

The rest of network-related tooling s NM & WPA_supplicant as the backend and systemd-resolved. The WPA_supplicant is set to be started on-demand via D-Bus.

There should be no other network management tool running. The NM is set to autoconect to a single 5GHz SSID. So no roaming or BT interference issues should apply.

WiFi power management is OFF even in BIOS.

The AP in question is a TP-Link Archer C5 V4 with the latest FW and 5GHz channel width set to fixed 40MHz. When testing the signal strength is over 85%.

----

Observations:

* The iwconfig's Invalid misc gets pretty high.

* Given syslog ordering the first disconnect action is emitted by the kernel:

```
...

Sep 05 14:37:25 gentoo kernel: wlan0: deauthenticated from 0c:80:63:cc:42:88 (Reason: 3=DEAUTH_LEAVING)

Sep 05 14:37:25 gentoo wpa_supplicant[1868]: wlan0: CTRL-EVENT-DISCONNECTED bssid=0c:80:63:cc:42:88 reason=3

Sep 05 14:37:25 gentoo wpa_supplicant[1868]: dbus: wpa_dbus_property_changed: no property SessionLength in object /fi/w1/wpa_supplicant1/Interfaces/6

Sep 05 14:37:25 gentoo wpa_supplicant[1868]: wlan0: CTRL-EVENT-REGDOM-CHANGE init=CORE type=WORLD

Sep 05 14:37:25 gentoo NetworkManager[347]: <info>  [1630845445.4903] device (wlan0): supplicant interface state: completed -> disconnected

Sep 05 14:37:25 gentoo NetworkManager[347]: <info>  [1630845445.5806] device (wlan0): supplicant interface state: disconnected -> scanning

Sep 05 14:37:28 gentoo wpa_supplicant[1868]: wlan0: SME: Trying to authenticate with 0c:80:63:cc:42:88

 (SSID='FOO123' freq=5240 MHz)

Sep 05 14:37:28 gentoo kernel: wlan0: authenticate with 0c:80:63:cc:42:88

Sep 05 14:37:28 gentoo kernel: wlan0: send auth to 0c:80:63:cc:42:88 (try 1/3)

Sep 05 14:37:28 gentoo NetworkManager[347]: <info>  [1630845448.7240] device (wlan0): supplicant interface state: scanning -> authenticating

Sep 05 14:37:28 gentoo kernel: wlan0: authenticated

...

```

----

Any ideas how to debug this further?

----

iwconfig wlan0:

```
wlan0     IEEE 802.11  ESSID:"FOO123"  

          Mode:Managed  Frequency:5.24 GHz  Access Point: 0C:80:63:CC:42:88   

          Bit Rate=120 Mb/s   Tx-Power=15 dBm   

          Retry short limit:7   RTS thr:off   Fragment thr:off

          Power Management:off

          Link Quality=59/70  Signal level=-51 dBm  

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:1  Invalid misc:8149   Missed beacon:0

```

dmesg bootup:

```
[    3.497244] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control

[    3.500960] iwlwifi 0000:03:00.0: loaded firmware version 18.168.6.1 6000g2a-6.ucode op_mode iwldvm

...

[    3.613847] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUG disabled

[    3.615088] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEBUGFS disabled

[    3.616093] iwlwifi 0000:03:00.0: CONFIG_IWLWIFI_DEVICE_TRACING enabled

[    3.617199] iwlwifi 0000:03:00.0: Detected Intel(R) Centrino(R) Advanced-N 6205 AGN, REV=0xB0

```

modinfo iwlwifi

```
filename:       /lib/modules/5.13.12-gentoo/kernel/drivers/net/wireless/intel/iwlwifi/iwlwifi.ko

license:        GPL

author:         Intel Corporation <linuxwifi@intel.com>

description:    Intel(R) Wireless WiFi driver for Linux

firmware:       iwlwifi-100-5.ucode

firmware:       iwlwifi-1000-5.ucode

firmware:       iwlwifi-135-6.ucode

firmware:       iwlwifi-105-6.ucode

firmware:       iwlwifi-2030-6.ucode

firmware:       iwlwifi-2000-6.ucode

firmware:       iwlwifi-5150-2.ucode

firmware:       iwlwifi-5000-5.ucode

firmware:       iwlwifi-6000g2b-6.ucode

firmware:       iwlwifi-6000g2a-6.ucode

firmware:       iwlwifi-6050-5.ucode

firmware:       iwlwifi-6000-6.ucode

alias: ....

depends:        cfg80211

intree:         Y

name:           iwlwifi

vermagic:       5.13.12-gentoo SMP preempt mod_unload 

parm:           swcrypto:using crypto in software (default 0 [hardware]) (int)

parm:           11n_disable:disable 11n functionality, bitmap: 1: full, 2: disable agg TX, 4: disable agg RX, 8 enable agg TX (uint)

parm:           amsdu_size:amsdu size 0: 12K for multi Rx queue devices, 2K for AX210 devices, 4K for other devices 1:4K 2:8K 3:12K (16K buffers) 4: 2K (default 0) (int)

parm:           fw_restart:restart firmware in case of error (default true) (bool)

parm:           nvm_file:NVM file name (charp)

parm:           uapsd_disable:disable U-APSD functionality bitmap 1: BSS 2: P2P Client (default: 3) (uint)

parm:           enable_ini:Enable debug INI TLV FW debug infrastructure (default: true (bool)

parm:           bt_coex_active:enable wifi/bt co-exist (default: enable) (bool)

parm:           led_mode:0=system default, 1=On(RF On)/Off(RF Off), 2=blinking, 3=Off (default: 0) (int)

parm:           power_save:enable WiFi power management (default: disable) (bool)

parm:           power_level:default power save level (range from 1 - 5, default: 1) (int)

parm:           disable_11ac:Disable VHT capabilities (default: false) (bool)

parm:           remove_when_gone:Remove dev from PCIe bus if it is deemed inaccessible (default: false) (bool)

parm:           disable_11ax:Disable HE capabilities (default: false) (bool)
```

----------

## NeddySeagoon

yuri69,

```
Reason: 3=DEAUTH_LEAVING
```

means that the interface was commanded to disconnect.

It looks like you have already looked into too many network interface managers fighting over the interface.

How did you test?

My preference is to remove them all from any run levels, then reboot.

WiFi should not start. If it does, you missed one.

Once you can reboot with wifi not starting, start it by hand. Now you know exactly what's controlling the interface.

Add your preferred network interface manager back to the default runlevel.

----------

## yuri69

Disabled the NM service. Rebooted. WiFi was not connected. Started NM manually. WiFi went online.

So my guess is the network management is correct.

----------

## NeddySeagoon

yuri69,

That sounds good.

What does 

```
rc-update show --verbose
```

tell?

If you use systemd, that won't work.

----------

## yuri69

Yes, I do use systemd. The equivalent should be 

```
systemctl list-unit-files --state=enabled
```

Output:

```

UNIT FILE                          STATE   VENDOR PRESET

acpid.service                      enabled disabled     

chronyd.service                    enabled disabled     

getty@.service                     enabled enabled      

NetworkManager-dispatcher.service  enabled disabled     

NetworkManager-wait-online.service enabled disabled     

NetworkManager.service             enabled disabled     

preload.service                    enabled disabled     

rngd.service                       enabled disabled     

systemd-resolved.service           enabled enabled      

thermald.service                   enabled disabled     

acpid.socket                       enabled disabled     

machines.target                    enabled enabled      

remote-fs.target                   enabled enabled      

fstrim.timer                       enabled disabled     

xfs_scrub_all.timer                enabled disabled   
```

// edit: fixed command

----------

## yuri69

4 days ago I switched to 2.4GHz only in NM. So far got no disconnection since then. It seems like a problem with the 5GHz WiFi...

----------

