NetworkManager: WiFi is delayed to reconnect after resume from standby (suspend to ram)

This is a minor issue which I’m facing since I use Manjaro, but which I also encoutered with other distributions: when I put my laptop to standby (suspend to ram), after resume, the wifi connection is delayed on reconnection (it took about 15 seconds) ; when I was using Win7, instead, after resume, the wifi reconnection was instant.

But this issue only occurs after resume: when I restart or I do a cold boot, when the Desktop appears, the wifi took a pair of seconds to connect.
I also tried to set static IP addresses, but didn’t helped.
I also noticed that, if I put laptop to sleep and I resume it after few seconds*, the connection is still active; instead, if I resume it after more seconds, minutes, hours and so on, the connection is dead and as I’ve said, there is a delay for the reconnection.

*=I tried various times, and I noticed that, if I resume the laptop within 10 seconds, I find the wifi connection active; so there is something that deactivate NetworkManager after this lapse of time.

EDIT: PARTIAL SOLUTION:
By consulting the great Arch Wiki, I discovered that is possible disable the MAC address randomization in /etc/NetworkManager/NetworkManager.conf; in this way, now, after resume from suspend, the connection takes 6 seconds instead of 15.
Is not a real solution for me, because as I’ve said, after a reboot or cold boot, the connection is estabilished after a pair of seconds. So I wait for someone which could give me some more advances hints/tricks.

I’m not concerned for the randomization: I can make an udev rule that when the usb wifi adaptor is connected, can trigger macchanger -r wlan0.

Some system info:

iwconfig wlan0

wlan0     IEEE 802.11AC  ESSID:"MY_SSID"  Nickname:"<WIFI@REALTEK>"
          Mode:Managed  Frequency:5.18 GHz  Access Point: xx:xx:xx:xx:xx:xx   
          Bit Rate:1.3 Gb/s   Sensitivity:0/0  
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=92/100  Signal level=61/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

iw dev wlan0 link

Connected to xx:xx:xx:xx:xx:xx (on wlan0)
	SSID: MY_SSID
	freq: 5180
	signal: -39 dBm
	tx bitrate: 1300.0 MBit/s

	bss flags:	short-slot-time
	dtim period:	0
	beacon int:	100

lsusb
(click on ► to expand the output, since is huge)

Summary
 Bus 004 Device 017: ID 2357:0106 TP-Link Archer T9UH v1 [Realtek RTL8814AU]
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x2357 TP-Link
  idProduct          0x0106 Archer T9UH v1 [Realtek RTL8814AU]
  bcdDevice            0.00
  iManufacturer           1 Realtek
  iProduct                2 802.11ac NIC
  iSerial                 3 123456
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0053
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              864mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           5
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst               4
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x85  EP 5 IN
        bmAttributes           19
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Feedback
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
        bMaxBurst               0
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x00000002
      HIRD Link Power Management (LPM) Supported
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000e
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat          10 micro seconds
    bU2DevExitLat         255 micro seconds
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0004
  (Bus Powered)
  U1 Enabled

Is attached to USB 3.0 port, confirmed by 864mA of power and:
lsusb -t
Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M Port 3: Dev 17, If 0, Class=Vendor Specific Class, Driver=8814au, 5000M

/etc/NetworkManager/conf.d/default-wifi-powersave-off.conf

[connection]
wifi.powersave = 2

I also tried to set these options in NetworkManager applet:


(here I specified the BSSID)

But despite the Power Management:off and wifi.powersave = 2
Such delay still occurs and in the journal logs I see:

NetworkManager[2975] <info> sleep requested (sleeping: no enabled: yes)

Maybe there is some command to get rid of NetworkManager sleep? Or avoid to deactivate or speed it up on resume? I also tried to disable the rfkill service.
I have no idea what could be done about.

The USB WiFi adaptor is not the culprit, since this issue also occurs with the internal wifi card adaptor Intel Dual Band Wireless-AC 7260.

Hi @D.Dave ,

One member of the forum reported a similar problem with your wifi card.
Please, consider to read it. At the end of the post the final thoughts are written.
https://forum.manjaro.org/t/rtl88xxau-aircrack-driver-problem/27946/2

Hope it help, regards,

This link brings to a post by myself :slightly_smiling_face:
https://forum.manjaro.org/t/rtl88xxau-aircrack-driver-problem/27946/2

Anyway, the 88XXau driver is deprecated, now there is 8814au instead (the one which I’m using as I said)

Which, at least for me, no longer causes the delay on reboot, shutdown and suspension (currently the suspension, instead, is instant).

The problem is opposite, instead: on resume after suspend, the connection tooks six seconds (by removing the MAC address randomization, otherwise 15 seconds), but after a reboot or cold boot, the connection is almost instant).

And however, the described issue also occurs wth any other wifi card: the problem relies in NetworkManager which is slow to reactivate after resume.

1 Like

I have the same problem, but disabling mac randomization does not help.

$ iwconfig
lo        no wireless extensions.

wlp2s0    IEEE 802.11  ESSID:"ROUTER_SSID"  
          Mode:Managed  Frequency:2.422 GHz  Access Point: xx:xx:xx:xx:xx:xx   
          Bit Rate=117 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=53/70  Signal level=-57 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

also

$ lsmod | grep rtw
rtw88_8822ce           16384  0
rtw88_8822c           331776  1 rtw88_8822ce
rtw88_pci              28672  1 rtw88_8822ce
rtw88_core            196608  2 rtw88_pci,rtw88_8822c
mac80211             1110016  2 rtw88_pci,rtw88_core
cfg80211              987136  2 rtw88_core,mac80211

To be sure: did you edit /etc/NetworkManager/NetworkManager.conf by adding, under [device] section, wifi.scan-rand-mac-address=no ?

You can also try by making /etc/NetworkManager/conf.d/default-wifi-powersave-off.conf and adding:

[connection]
wifi.powersave = 2

For avoiding the sleep state of the device, which could delayed the reconnection after resume.

then restart NM: systemctl restart NetworkManager

Anyway, currently after months, after the changes which I reported, on resume from sleep, for me, the wifi reconnection has been instant… Maybe is thanks to the kernel, who knows… We are on a rolling release :slight_smile:

2 Likes

Following your suggestion now it seems to be faster (even though just a little bit)
thanks!