除非我先启动 Windows,否则 Wifi 会在重启后停止工作

除非我先启动 Windows,否则 Wifi 会在重启后停止工作

当我启动 Ubuntu (21.04) 时,我的笔记本电脑 wifi 通常会在几分钟后停止工作。它会断开与路由器的连接,并且无法再检测到附近的任何路由器。有一个解决方法:我的笔记本电脑设置为双启动 Windows,如果我启动 Windows 然后立即重新启动回 Ubuntu,wifi 总是可以正常工作。

我的问题似乎类似这个,但是在这种情况下有效的修复方法(在 Windows 上禁用“快速启动”)在我的系统中不起作用。

[编辑]:经过进一步的实验,似乎只有当我的笔记本电脑关闭几个小时然后再次启动时才会触发此问题。如果我的 wifi 正常工作,然后我重新启动 Ubuntu 甚至关闭电源并立即再次打开电源,那么 wifi 似乎可以继续正常工作。但如果我晚上关闭电脑然后在早上打开电源,wifi 问题就会再次出现。发生这种情况时,让它再次工作的唯一方法是启动 Windows,然后重新启动并启动 Ubuntu。

我的 wifi 芯片是 Realtek RTL8821CE 802.11ac PCIe。我已将一些 wifi 诊断命令的输出粘贴在下面,希望对您有所帮助:

这是 WiFi 工作时的输出:

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

这是不工作时的输出:

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

响应 sancho.s 的建议,这是inxi -Fxzwifi 工作时的输出:

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 

inxi -Fxz当 wifi 不工作时的输出:

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 

更多信息。根据要求,我在 wifi 工作时和不工作时运行了以下一系列命令:

$ 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

结果如下:

当 WiFi 工作时:粘贴

当 Wi-Fi 无法使用时:粘贴

长时间断电后,WiFi 无法工作:粘贴

答案1

https://wireless.wiki.kernel.org/en/users/drivers/iwlwifi#about_dual-boot_with_windows_and_fast-boot_enabled为我解决了这个问题:

如果您有一台装有较新版 Windows 的双启动机器,并且在启动 Linux 时在 WiFi 设备初始化过程中开始看到问题,则问题可能是由于 Windows 上的“快速启动”功能造成的。

启用此功能后,Windows 不会真正关闭整个系统,而是让部分系统继续运行,以便您可以更快地再次启动机器。尝试禁用此选项,在 Windows 10 上,它应该位于“控制面板→硬件和声音→电源选项→系统设置”中。选择“选择电源按钮的功能”以从电源选项访问系统设置。然后禁用“关机设置”中的“快速启动”选项。这将导致 Windows 完全关闭并可能解决问题。

答案2

诊断

根据您显示的不同,发布以下命令的输出(网络工作/不工作)。如果有任何方法可以使其工作,请发表评论。

$ 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

编辑

添加

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

这将非常有用如果您还添加了 pastebin,则处于工作/非工作状态wireless-info

可能的解决方案

你可能已经击中这个错误。最近有帖子报告了该问题的出现。

  1. 您可以尝试添加 options rtw88_pci disable_aspm=1,并按 /etc/modprobe.d/rtw88_pci.conf要求顺序重新启动以使 WiFi 正常工作。检查 WiFi 是否再次失败。

  2. 另外,尝试禁用安全启动

  3. 还请阅读错误报告的其余部分。

  4. 尝试将策略pcie_aspm更改powersaveperformance解决了可能类似的问题。如何操作?查看有关如何修改 grub。在这个特殊情况下,似乎有多种方法可以改变参数,请尝试并回复您得到的结果。

相关内容