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

Mat*_*t_M 6 dual-boot wireless networking realtek

当我启动 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
Run Code Online (Sandbox Code Playgroud)

这是不工作时的输出:

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
Run Code Online (Sandbox Code Playgroud)

根据 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 
Run Code Online (Sandbox Code Playgroud)

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/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 
Run Code Online (Sandbox Code Playgroud)

更多信息。根据要求,我在 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
Run Code Online (Sandbox Code Playgroud)

结果如下:

当 wifi 工作时:粘贴

当 wifi 不工作时:粘贴

虽然长时间断电后 wifi 无法工作:粘贴

Mar*_*ark 7

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

\n
\n

如果您有一台装有最新版本 Windows 的双引导计算机,并且\n在引导 Linux 时\n开始在 WiFi 设备初始化过程中看到问题,则该问题可能是由于 \xe2\x80\x9c 快速启动\xe2\x80\x9d 造成的功能\非 Windows。

\n

启用此功能后,Windows 不会真正关闭整个系统,而是保留部分运行状态,以便您可以再次更快地启动计算机。尝试禁用此选项,在 Windows 10 上,\n应位于 \xe2\x80\x9cControl Panel\xe2\x86\x92Hardware and Sound\xe2\x86\x92Power Options\xe2\x86\x92System\nSettings\xe2\x80\x9d 。选择 \xe2\x80\x9c选择电源按钮的功能\xe2\x80\x9d 以从电源选项访问\n系统设置。然后禁用 \xe2\x80\x9cShutdown Settings\xe2\x80\x9d 中的 \xe2\x80\x9cFast\nStartup\xe2\x80\x9d 选项。这将导致 Windows 完全关闭并可能解决该问题。

\n
\n

  • 你已经解决了你的问题。我把这个留给其他可能不会尝试的人。 (3认同)

san*_*lio 3

诊断

根据您显示的差异,发布下面命令的输出(网络工作/不工作)。如果有什么使它起作用,请发表评论。

$ 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
Run Code Online (Sandbox Code Playgroud)

编辑

添加

$ dmesg -T | grep -n rtw
$ modinfo rtw_8821ce
Run Code Online (Sandbox Code Playgroud)

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

可能的解决方案

您可能遇到了这个错误。最近有帖子报告了该问题的出现。

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

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

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

  4. 尝试将pcie_aspm策略更改为powersaveor performance,这解决了可能类似的问题。怎么做?有关如何修改 grub,请参阅此。在这种特殊情况下,似乎有不止一种方法可以更改参数,请尝试并回发您得到的内容。