激活网络连接失败 - 从 Windows 重新启动时修复

激活网络连接失败 - 从 Windows 重新启动时修复

我有 Windows 10 和 Ubuntu 20.14 双启动。

从前段时间开始,我的电脑出现了问题...当它在 Ubuntu 中启动时有时会随机(我的意思是,大约 30% 的启动就会出现问题)说Activation of network connection failed,这是一台台式电脑,所以我使用以太网端口。

当问题出现时,尝试了网上的一些解决方案,但都无法解决问题。我尝试过:

  • 建议重新启用有线连接这里
  • 重启所有路由器 - 我有 2 个路由器,连接方式如下:[ISP 路由器] <LAN 端口 - WAN 端口> [Tplinkrouter] <LAN 端口 - Eth 端口> [PC]。建议的解决方案这里
  • 重新安装网络管理器并重新启动:sudo apt-get install --reinstall network-manager ; sudo reboot now建议这里

另外,真正有趣的是,当我从 Windows 10 重新启动到 Ubuntu 时,问题消失,如果我从 Ubuntu 重新启动到 Ubuntu,问题又会出现……

关于我的系统的一些背景信息:

  • Windows 10 快速启动已禁用
  • 双启动在 nvme 驱动器上
  • Windows 上从未出现过此问题
  • sudo lshw -C network输出(当没有出现问题时):
*-network                 
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:05:00.0
logical name: enp5s0
version: 0c
serial: b4:2e:99:e7:89:ea
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.8.0-48-generic duplex=full firmware=rtl8168g-2_0.0.1 02/06/13 ip=192.168.1.65 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s
resources: irq:35 ioport:f000(size=256) memory:fcb00000-fcb00fff memory:f0300000-f0303fff

有什么可以解决这个恼人的故障吗?

提前致谢。

编辑1:

lspci -nn | grep -i ethernet输出:

05:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c)

编辑2:

遵循@heynnema 解决方案:

步骤1。将脚本“r8169_disable_msi”添加到/etc/initramfs-tools/scripts/init-top路径并对其执行chmod a+x

检查这里是否ls -l /etc/initramfs-tools/scripts/init-top输出:

total 4
-rwxr-xr-x 1 root root 1118 mar 30 11:59 r8169_disable_msi

第2步。 “将‘r8169_disable_msi’添加到内核命令行(通常为 /etc/default/grub、GRUB_CMDLINE_LINUX_DEFAULT="quiet splash")。”因此我对 /etc/default/grub 文件进行了如下修改:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash r8169_disable_msi"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
GRUB_GFXMODE=1920x1080

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

步骤3. sudo update-initramfs -c -k $(uname -r)输出:

update-initramfs: Generating /boot/initrd.img-5.8.0-48-generic
W: Possible missing firmware /lib/firmware/amdgpu/navi12_gpu_info.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_gpu_info.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_ta.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_asd.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_sos.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_ta.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_asd.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_sos.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_rlc.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_mec2.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_mec.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_rlc.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_mec2.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_mec.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_me.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_pfp.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_ce.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/arcturus_sdma.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_sdma1.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_sdma.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi10_mes.bin for module amdgpu
W: Possible missing firmware /lib/firmware/amdgpu/navi12_dmcu.bin for module amdgpu
I: The initramfs will attempt to resume from /dev/nvme0n1p6
I: (UUID=64e37a0f-3360-471d-8c6d-02a5865d7e77)
I: Set the RESUME variable to override this.

步骤4。 sudo update-grub输出:

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.8.0-48-generic
Found initrd image: /boot/initrd.img-5.8.0-48-generic
Found linux image: /boot/vmlinuz-5.8.0-45-generic
Found initrd image: /boot/initrd.img-5.8.0-45-generic
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings
done

这个解决方案有效。

答案1

链接速度

您的以太网卡能够达到 1Gb 的速度,但只能以 100Mb 的速度使用。这通常表示电缆存在问题,或者某些网络设备(如以太网集线器/交换机/路由器)无法提供 1G 的速度。首先,检查您使用的是 cat 5e 还是 cat 6 以太网电缆。

sudo lshw -C network

size: 100Mbit/s
capacity: 1Gbit/s

乙太網驅動程式

r8169 驱动程序已知存在一些问题。安装此驱动程序并查看情况是否有所改善。

sudo apt update

sudo apt install dkms r8168-dkms

reboot

MSI 中断问题

一些 r816x 以太网卡无法正确处理 MSI/MSIX 中断。如果需要,我们可能需要实施补丁来解决该问题。需要时提供信息。显示:

lspci -nn | grep -i ethernet

05:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 0c)

这是所需的补丁。说明在脚本中。请密切关注。

# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1779817

# filename: r8169_disable_msi

# Drop it in /etc/initramfs-tools/scripts/init-top and chmod a+x it. Add 'r8169_disable_msi'
# to your kernel command line (/etc/default/grub, GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# usually.) 

# Remember to update-initramfs and update-grub as necessary.

# sudo update-initramfs -c -k $(uname -r)
# sudo update-grub
# reboot

# For the moment it disables MSI on everything with the ID 0x10ec:0x8168, as there seems to
# be no way to get the MAC version from userspace - and certainly not before the driver is
# loaded. Other PCI IDs may need adding..

PREREQ=""
prereqs()
{
    echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
    prereqs
    exit 0
    ;;
esac

disable_msi () {
    for i in /sys/bus/pci/devices/*; do 
        if [ $(cat $i/vendor) = "0x10ec" -a $(cat $i/device) = "0x8168" ]; then
            echo 0 >$i/msi_bus
        fi
    done
}

for x in $(cat /proc/cmdline); do
        case ${x} in
        r8169_disable_msi)
        disable_msi
        break
                ;;
        esac
done

相关内容