![在 Windows 上玩游戏后 Linux 网络无法工作](https://linux22.com/image/227238/%E5%9C%A8%20Windows%20%E4%B8%8A%E7%8E%A9%E6%B8%B8%E6%88%8F%E5%90%8E%20Linux%20%E7%BD%91%E7%BB%9C%E6%97%A0%E6%B3%95%E5%B7%A5%E4%BD%9C.png)
我的电脑遇到了这个奇怪的问题。我在 Windows 上玩游戏后,Linux 网络停止工作。
情况
我有双启动,用于游戏的 Windows 10 和用于日常使用的 Manjaro linux。我使用电缆连接到路由器,因此速度快且稳定。我最近买了一款新游戏,我的典型 PC 使用情况如下:
- 我打开 PC 并启动到 Linux 来工作几个小时
- 我重新启动进入 Windows,我玩这个游戏大约一个小时左右
- 我再次重新启动进入linux
当我切换回 Linux 并尝试使用互联网时,它在下载了几百 KB 的数据(可能大约 1 MB 左右,很难准确地说)后停止了。
尝试调试和修复
第一次发生这种情况时,我以为是路由器问题或 ISP 问题。但不,我的家庭网络中的其他设备工作正常,所以 ISP 不行。电缆本身和路由器也很好,因为首次启动后互联网在 Linux 上一直可以工作,在 Windows 上玩游戏时也可以。我尝试过的其他事情:
- 使用网络小程序断开和连接❌
- 重新启动网络服务
sudo systemctl restart NetworkManager.service
❌ - 拔掉并重新插入网线❌
- 再次重启进入linux ❌
- 重新启动到 Windows(可以上网)并重新启动到 Linux ❌
- 关闭电脑,等待几秒钟,然后启动进入linux❌
- 关闭电脑,切断电源,等待大约30秒,然后再切换电源, 将 PC 引导至 linux ✅
让互联网恢复工作的唯一方法是断电,然后启动进入linux。
看起来这是一个硬件问题,但另一方面,即使刚玩完游戏,互联网也可以在 Windows 上正常工作。我还以为可能是某些东西过热,但同样,即使关闭我的电脑几个小时(不切断电源),它仍然无法在 Linux 上运行。
我不知道发生了什么事。您知道可能是什么原因吗?
调试信息
$ uname -a
Linux piotrek-pc 6.5.13-1-MANJARO #1 SMP PREEMPT_DYNAMIC Tue Nov 28 20:33:05 UTC 2023 x86_64 GNU/Linux
----
$ journalctl -p 3 -b0
gru 05 23:29:12 piotrek-pc colord-sane[1041]: io/hpmud/pp.c 627: unable to read device-id ret=-1
----
$ ping google.com
ping: google.com: Temporary failure in name resolution
----
$ sudo systemctl status NetworkManager.service
[sudo] password for piotrek:
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; preset: disabled)
Active: active (running) since Tue 2023-12-05 23:29:11 CET; 1h 3min ago
Docs: man:NetworkManager(8)
Main PID: 943 (NetworkManager)
Tasks: 4 (limit: 19101)
Memory: 20.1M
CPU: 233ms
CGroup: /system.slice/NetworkManager.service
└─943 /usr/bin/NetworkManager --no-daemon
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5796] device (vethb5f8884): carrier: link connected
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5798] device (docker0): carrier: link connected
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5799] device (enp30s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5809] device (enp30s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5810] device (enp30s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5812] manager: NetworkManager state is now CONNECTED_SITE
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5814] device (enp30s0): Activation: successful, device activated.
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.5818] manager: startup complete
gru 05 23:29:14 piotrek-pc NetworkManager[943]: <info> [1701815354.6467] manager: NetworkManager state is now CONNECTED_GLOBAL
gru 05 23:29:16 piotrek-pc NetworkManager[943]: <info> [1701815356.0664] agent-manager: agent[f36462a8b096765f,:1.35/org.kde.plasma.networkmanagement/1000]: agent registered
----
$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host noprefixroute
valid_lft forever preferred_lft forever
2: enp30s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 30:9c:23:86:19:ee brd ff:ff:ff:ff:ff:ff
inet 192.168.1.5/24 brd 192.168.1.255 scope global dynamic noprefixroute enp30s0
valid_lft 86140sec preferred_lft 86140sec
inet6 fe80::6bad:f8d:8529:725d/64 scope link noprefixroute
valid_lft forever preferred_lft forever
----
$ journalctl -p 3 -b0 -o short-iso
2023-12-06T17:52:47+0100 piotrek-pc colord-sane[1034]: io/hpmud/pp.c 627: unable to read device-id ret=-1
----
$ sudo dmesg -T --level=emerg,alert,crit,err,warn --time-format iso
2023-12-06T17:52:36,153817+01:00 ACPI BIOS Warning (bug): Optional FADT field Pm2ControlBlock has valid Length but zero Address: 0x0000000000000000/0x1 (20230331/tbfadt-615)
2023-12-06T17:52:36,153947+01:00 Speculative Return Stack Overflow: IBPB-extending microcode not applied!
2023-12-06T17:52:36,153947+01:00 Speculative Return Stack Overflow: WARNING: See https://kernel.org/doc/html/latest/admin-guide/hw-vuln/srso.html for mitigation options.
2023-12-06T17:52:36,328872+01:00 mtrr: your CPUs had inconsistent variable MTRR settings
2023-12-06T17:52:36,467031+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,467146+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,467245+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,467425+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,467588+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,467754+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,467910+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,468064+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,468211+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,468367+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,468547+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,468705+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,468859+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,468979+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,469114+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,469249+01:00 [Firmware Bug]: ACPI MWAIT C-state 0x0 not supported by HW (0x0)
2023-12-06T17:52:36,480090+01:00 amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled
2023-12-06T17:52:41,636165+01:00 vboxdrv: loading out-of-tree module taints kernel.
2023-12-06T17:52:41,679047+01:00 VBoxNetAdp: Successfully started.
2023-12-06T17:52:41,680999+01:00 VBoxNetFlt: Successfully started.
2023-12-06T17:52:42,529751+01:00 r8168 Copyright (C) 2023 Realtek NIC software team <[email protected]>
This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>.
This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>.
2023-12-06T17:52:49,704231+01:00 ksplashqml[1546]: memfd_create() called without MFD_EXEC or MFD_NOEXEC_SEAL set
----
$ sudo lspci -v -d ::0200
1e:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Subsystem: Micro-Star International Co., Ltd. [MSI] RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
Flags: bus master, fast devsel, latency 0, IRQ 33, IOMMU group 12
I/O ports at f000 [size=256]
Memory at fe604000 (64-bit, non-prefetchable) [size=4K]
Memory at fe600000 (64-bit, non-prefetchable) [size=16K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit+
Capabilities: [70] Express Endpoint, MSI 01
Capabilities: [b0] MSI-X: Enable+ Count=4 Masked-
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number 01-00-00-00-68-4c-e0-00
Capabilities: [170] Latency Tolerance Reporting
Capabilities: [178] L1 PM Substates
Kernel driver in use: r8168
Kernel modules: r8169, r8168
// 编辑
我做了一些测试,似乎游戏与此无关。 Windows 10 在重新启动后会以某种方式中断网络。我注意到我的路由器即使在关机后也能看到我的电脑,所以网卡可能仍在工作。在我断电并等待了大约 30 秒后,我的路由器连接 LED 不再处于活动状态,然后网络又在 Linux 上工作了。
有什么办法可以在关机后立即禁用网卡吗?我尝试在 BIOS 中搜索但找不到选项。
答案1
有时Windows 可能会将设备(您的网络芯片)设置为 Linux 驱动程序无法恢复的内部状态。尝试执行完全断电而不是重新启动(保持电源状态)。
答案2
我会回答我自己的问题,因为我最终能够解决它。我发现这在 Manjaro 论坛上,这让我检查我正在使用的驱动程序。lspci
显示两个可用的内核模块r8169
和r8168
。不知怎的,我正在使用旧的模块。我又检查了一些东西,发现了这个:
$ ls -la /etc/modprobe.d/
total 28K
drwxr-xr-x 2 root root 4,0K 12-07 08:19 .
drwxr-xr-x 131 root root 12K 12-07 17:21 ..
-rw-r--r-- 1 root root 16 2018-07-30 r8169_blacklist.conf
里面
$ cat /etc/modprobe.d/r8169_blacklist.conf
blacklist r8169
不知何故,新模块被列入了黑名单。我检查了pacman
谁拥有这个文件,发现它不属于任何软件包。可能是一些不再存在的旧软件包的残留。我将其重命名为/etc/modprobe.d/r8169_blacklist.conf.disabled
,重新启动,现在即使在使用 Windows 后,网络也可以正常工作。仍然不确定 Windows 上发生了什么变化,导致我的网络中断。无论如何,它能正常工作真是太好了。
感谢大家的回答以及对我的问题的兴趣。
答案3
禁用 Windows 的快速启动功能和关机。
当使用任何 Windows 8.x 或更高版本进行双启动时,必须禁用 Windows 中的快速启动。
该“功能”产生的更典型的问题是使 NTFS 分区(有时甚至是 FAT32 - 例如 ESP -)处于休眠状态。
有时,根据实际的硬件和固件(UEFI)或固件设置,它也可以“劫持”网络设备。