Score:2

Wifi stops working after reboot unless I boot Windows first

us flag

When I boot into Ubuntu (21.04), my laptop wifi usually stops working after a few minutes. It disconnects from the router, and can no longer detect any nearby routers. There is a workaround: my laptop is set up to dual-boot Windows, and if I boot to Windows and then immediately reboot back to Ubuntu, the wifi always works fine.

My problem seems similar to this one, but the fix that worked for that case (disabling "fast boot" on Windows) does not work in mine.

[Edit]: After further experimentation, it seems that the problem is triggered only when my laptop has been switched off for several hours and then started again. If my wifi is working and then I restart Ubuntu or even power off and immediately power on again, then the wifi seems to continue to work fine. But if I turn the computer off overnight and then power on in the morning, the wifi problem returns. When this happens, the only way to make it work again is by booting Windows and then restarting and booting Ubuntu.

My wifi chip is a Realtek RTL8821CE 802.11ac PCIe. I've pasted the output of a few wifi diagnostic commands below, in case that might help:

This is the output while the wifi is working:

sudo lshw -C network

  *-network
       description: Wireless interface
       product: RTL8821CE 802.11ac PCIe Wireless Network Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: wlp2s0
       version: 00
       serial: 28:39:26:70:6a:d9
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtw_8821ce driverversion=5.11.0-17-generic firmware=N/A ip=192.168.1.7 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:144 ioport:3000(size=256) memory:a4200000-a420ffff


rfkill list

0: ideapad_wlan: Wireless LAN
    Soft blocked: no
    Hard blocked: no
1: ideapad_bluetooth: Bluetooth
    Soft blocked: yes
    Hard blocked: no
2: phy0: Wireless LAN
    Soft blocked: no
    Hard blocked: no
3: hci0: Bluetooth
    Soft blocked: yes
    Hard blocked: no


lspci -nn | grep -i network

02:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter [10ec:c821]

uname -r # kernel version
5.11.0-18-generic


iwconfig

wlp2s0    IEEE 802.11  ESSID:"SRISUWAN"  
          Mode:Managed  Frequency:2.457 GHz  Access Point: FC:3F:7C:29:E6:F8   
          Bit Rate=65 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
          Link Quality=70/70  Signal level=-28 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:12   Missed beacon:0

And this is the output while it's not working:

sudo lshw -C network

*-generic                 
       description: Wireless interface
       product: RTL8821CE 802.11ac PCIe Wireless Network Adapter
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: wlp2s0
       version: ff
       serial: 28:39:26:70:6a:d9
       width: 32 bits
       clock: 66MHz
       capabilities: bus_master vga_palette cap_list ethernet physical wireless
       configuration: broadcast=yes driver=rtw_8821ce driverversion=5.11.0-17-generic firmware=N/A latency=255 link=no maxlatency=255 mingnt=255 multicast=yes wireless=IEEE 802.11
       resources: irq:144 ioport:3000(size=256) memory:a4200000-a420ffff


rfkill list

0: ideapad_wlan: Wireless LAN
        Soft blocked: no
        Hard blocked: no
1: ideapad_bluetooth: Bluetooth
        Soft blocked: yes
        Hard blocked: no
2: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
3: hci0: Bluetooth
        Soft blocked: yes
        Hard blocked: no


lspci -nn | grep -i network

02:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8821CE 802.11ac PCIe Wireless Network Adapter [10ec:c821] (rev ff)

iwconfig

wlp2s0    IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on

In response to sancho.s's suggestion, this is the output of inxi -Fxz while the wifi is working:

System:
  Kernel: 5.11.0-18-generic x86_64 bits: 64 compiler: gcc v: 10.2.1 
  Desktop: GNOME 3.38.4 Distro: Ubuntu 21.04 (Hirsute Hippo) 
Machine:
  Type: Laptop System: LENOVO product: 81MU v: Lenovo IdeaPad S145-14IWL 
  serial: <filter> 
  Mobo: LENOVO model: LNVNB161216 v: SDK0Q55756 WIN serial: <filter> 
  UEFI: LENOVO v: ASCN50WW date: 11/24/2020 
Battery:
  ID-1: BAT0 charge: 23.0 Wh condition: 23.0/30.0 Wh (77%) 
  model: LGC L17L2PF1 status: Full 
CPU:
  Info: Quad Core model: Intel Core i5-8265U bits: 64 type: MT MCP 
  arch: Kaby Lake note: check rev: C L2 cache: 6 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 28800 
  Speed: 800 MHz min/max: 400/1600 MHz Core speeds (MHz): 1: 800 2: 865 
  3: 800 4: 800 5: 799 6: 792 7: 800 8: 794 
Graphics:
  Device-1: Intel WhiskeyLake-U GT2 [UHD Graphics 620] vendor: Lenovo 
  driver: i915 v: kernel bus ID: 00:02.0 
  Device-2: NVIDIA GM108M [GeForce MX110] vendor: Lenovo driver: nvidia 
  v: 460.80 bus ID: 01:00.0 
  Device-3: Acer Integrated Camera type: USB driver: uvcvideo 
  bus ID: 1-7:3 
  Display: x11 server: X.Org 1.20.11 driver: loaded: modesetting,nvidia 
  unloaded: fbdev,nouveau,vesa resolution: 1920x1080~60Hz 
  OpenGL: renderer: GeForce MX110/PCIe/SSE2 v: 4.6.0 NVIDIA 460.80 
  direct render: Yes 
Audio:
  Device-1: Intel Cannon Point-LP High Definition Audio vendor: Lenovo 
  driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
  Sound Server: ALSA v: k5.11.0-18-generic 
Network:
  Device-1: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter 
  vendor: Lenovo driver: rtw_8821ce v: N/A port: 3000 bus ID: 02:00.0 
  IF: wlp2s0 state: up mac: <filter> 
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8 
  bus ID: 1-10:4 
  Report: ID: hci0 state: down address: <filter> 
Drives:
  Local Storage: total: 476.94 GiB used: 41.07 GiB (8.6%) 
  ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKNW512G8L size: 476.94 GiB 
  temp: 31.9 C 
Partition:
  ID-1: / size: 23.35 GiB used: 15.24 GiB (65.3%) fs: ext4 
  dev: /dev/nvme0n1p4 
  ID-2: /boot/efi size: 256 MiB used: 33.6 MiB (13.1%) fs: vfat 
  dev: /dev/nvme0n1p1 
  ID-3: /home size: 207.11 GiB used: 25.8 GiB (12.5%) fs: ext4 
  dev: /dev/nvme0n1p6 
Swap:
  ID-1: swap-1 type: partition size: 8.06 GiB used: 0 KiB (0.0%) 
  dev: /dev/nvme0n1p7 
Sensors:
  System Temperatures: cpu: 58.0 C mobo: N/A gpu: nvidia temp: 52 C 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 321 Uptime: 4h 34m Memory: 7.65 GiB used: 3.77 GiB (49.3%) 
  Init: systemd runlevel: 5 Compilers: gcc: 10.3.0 Packages: 2685 
  Shell: Bash v: 5.1.4 inxi: 3.3.01 

And the output of inxi -Fxz while the wifi is not working:

System:
  Kernel: 5.11.0-18-generic x86_64 bits: 64 compiler: gcc v: 10.2.1 
  Desktop: GNOME 3.38.4 Distro: Ubuntu 21.04 (Hirsute Hippo) 
Machine:
  Type: Laptop System: LENOVO product: 81MU v: Lenovo IdeaPad S145-14IWL 
  serial: <filter> 
  Mobo: LENOVO model: LNVNB161216 v: SDK0Q55756 WIN serial: <filter> 
  UEFI: LENOVO v: ASCN50WW date: 11/24/2020 
Battery:
  ID-1: BAT0 charge: 23.0 Wh condition: 23.0/30.0 Wh (77%) 
  model: LGC L17L2PF1 status: Full 
CPU:
  Info: Quad Core model: Intel Core i5-8265U bits: 64 type: MT MCP 
  arch: Kaby Lake note: check rev: C L2 cache: 6 MiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 28800 
  Speed: 800 MHz min/max: 400/3900 MHz Core speeds (MHz): 1: 800 2: 800 
  3: 800 4: 795 5: 800 6: 767 7: 800 8: 718 
Graphics:
  Device-1: Intel WhiskeyLake-U GT2 [UHD Graphics 620] vendor: Lenovo 
  driver: i915 v: kernel bus ID: 00:02.0 
  Device-2: NVIDIA GM108M [GeForce MX110] vendor: Lenovo driver: nvidia 
  v: 460.80 bus ID: 01:00.0 
  Device-3: Acer Integrated Camera type: USB driver: uvcvideo bus ID: 1-7:3 
  Display: x11 server: X.Org 1.20.11 driver: loaded: modesetting,nvidia 
  unloaded: fbdev,nouveau,vesa resolution: 1920x1080~60Hz 
  OpenGL: renderer: GeForce MX110/PCIe/SSE2 v: 4.6.0 NVIDIA 460.80 
  direct render: Yes 
Audio:
  Device-1: Intel Cannon Point-LP High Definition Audio vendor: Lenovo 
  driver: snd_hda_intel v: kernel bus ID: 00:1f.3 
  Sound Server: ALSA v: k5.11.0-18-generic 
Network:
  Device-1: Realtek RTL8821CE 802.11ac PCIe Wireless Network Adapter 
  driver: rtw_8821ce v: N/A port: 4000 bus ID: 02:00.0 
  IF: wlp2s0 state: down mac: <filter> 
Bluetooth:
  Device-1: Realtek Bluetooth Radio type: USB driver: btusb v: 0.8 
  bus ID: 1-10:4 
  Report: ID: hci0 state: down address: <filter> 
Drives:
  Local Storage: total: 476.94 GiB used: 40.89 GiB (8.6%) 
  ID-1: /dev/nvme0n1 vendor: Intel model: SSDPEKNW512G8L size: 476.94 GiB 
  temp: 30.9 C 
Partition:
  ID-1: / size: 23.35 GiB used: 15.17 GiB (65.0%) fs: ext4 
  dev: /dev/nvme0n1p4 
  ID-2: /boot/efi size: 256 MiB used: 33.6 MiB (13.1%) fs: vfat 
  dev: /dev/nvme0n1p1 
  ID-3: /home size: 207.11 GiB used: 25.69 GiB (12.4%) fs: ext4 
  dev: /dev/nvme0n1p6 
Swap:
  ID-1: swap-1 type: partition size: 8.06 GiB used: 0 KiB (0.0%) 
  dev: /dev/nvme0n1p7 
Sensors:
  System Temperatures: cpu: 54.0 C mobo: N/A gpu: nvidia temp: 48 C 
  Fan Speeds (RPM): N/A 
Info:
  Processes: 285 Uptime: 11m Memory: 7.65 GiB used: 2.08 GiB (27.2%) 
  Init: systemd runlevel: 5 Compilers: gcc: 10.3.0 Packages: 2685 
  Shell: Bash v: 5.1.4 inxi: 3.3.01 

Further information. As requested, I ran the following series of commands while the wifi was working and while it was not:

$ nmcli networking connectivity
$ nmcli radio all
$ nmcli connection show
$ nmcli device status 
$ nmcli device show wlp2s0
$ dmesg -T | grep rtw
$ nmcli networking on
$ nmcli device connect wlp2s0
$ nmcli connection up SRISUWAN

The results were as follows:

While the wifi was working: paste

While the wifi was not working: paste

While the wifi was not working after an extended power-off: paste

sancho.s ReinstateMonicaCellio avatar
pl flag
Please add the output of `inxi -Fxz` when wifi is working, and when it is not. Further, it would help if you clarify under which condition you posted your commands, and add the corresponding output for *the other* condition.
us flag
@sancho.sReinstateMonicaCellio: I've done as you suggested; you should see the results in my post now. I've also added some extra information in my post about what conditions trigger the wifi problem (it seems to only occur when the computer has been started again after being turned off for several hours).
sancho.s ReinstateMonicaCellio avatar
pl flag
The outputs provided (exactly as suggested, which is, strangely, uncommon here in askubuntu) were very useful. Please see added answer.
HuHa avatar
es flag
Just a wild guess: Firmware for that WiFi contoller needs to be loaded first, and Windows has firmware for it, while Linux has not; or you might need to install a firmware package for it.
Score:2
ma flag

https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi#about_dual-boot_with_windows_and_fast-boot_enabled solved the problem for me:

If you have a dual-boot machine with a recent version of Windows and start seeing problems during initialization of the WiFi device when booting Linux, the problem could be due to the “fast startup” feature on Windows.

With this feature enabled, Windows don't really shut down the entire system, but leaves things partially running so you can start the machine faster again. Try to disable this option, on Windows 10 it should be in “Control Panel→Hardware and Sound→Power Options→System Settings”. Select “Chooose what the power buttons do” to access the System Settings from the Power Options. Then disable the “Fast Startup” option in “Shutdown Settings”. This will cause Windows to fully shutdown and may solve the issue.

us flag
As I noted in my original description of my problem: "My problem seems similar to [link], but the fix that worked for that case (disabling "fast boot" on Windows) does not work in mine."
ma flag
You've already solved your issue. I'm leaving this here for others that might otherwise not try it.
George avatar
fj flag
Thanks, this solves the issue
Alex M.M. avatar
cn flag
Upvoted, this solved my problem too.
Score:2
pl flag

Diagnosis

As per the differences you show, post the output (with network working/not working) of commands below. If anything makes it work, please comment.

$ nmcli networking connectivity
$ nmcli radio all
$ nmcli connection show
$ nmcli device status 
$ nmcli device show wlp2s0
$ dmesg -T | grep rtw
$ nmcli networking on
$ nmcli device connect wlp2s0
$ nmcli connection up SRISUWAN

EDIT.

Add

$ dmesg -T | grep -n rtw
$ modinfo rtw_8821ce

It would be very useful if you also added the pastebin, in the working/non-working states, of wireless-info.

Possible solutions

You might have hit this bug. There are recent posts reporting the issue shows up.

  1. You may try adding options rtw88_pci disable_aspm=1 to /etc/modprobe.d/rtw88_pci.conf, and rebooting with due sequence to get WiFi working. Check if WiFi then fails again.

  2. Also, try disabling secure boot.

  3. Also read the rest of the bug report.

  4. Try changing pcie_aspm policy to either powersave or performance, which solved a possibly similar issue. How to do it? See this and this for how to modify grub. In this particular case, there seems to be more than one way of changing the parameter, please try and post back what you get.

us flag
I can confirm that Possible Solution #1: "You may try adding `options rtw88_pci disable_aspm=1` to `/etc/modprobe.d/rtw88_pci.conf` has worked perfectly to fix the problem for me. Thanks again for your help.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.