Ubuntu20.04 有线网络图标消失解决方案
问题描述: ubuntu20.04系统提示的software updater有软件包更新,按提示安装更新软件包,重启系统后,ubuntu系统的网络图标消失不见;无法正常上网;检查网口,发现网卡上的灯也不亮;在系统Settings的Network项中,网络配置项也不见了,无法配置网络参数。
原因:这个是Ubuntu Network Manager Bug
解决方案:
sudo lshw -c Network
命令测试问题:
$ sudo lshw -c Network
*-network:0
description: Wireless interface
product: Cannon Point-LP CNVi [Wireless-AC]
vendor: Intel Corporation
physical id: 14.3
bus info: pci@0000:00:14.3
logical name: wlp0s20f3
version: 30
serial: 38:00:25:9b:44:2a
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=5.13.0-51-generic firmware=46.4d093a30.0 9000-pu-b0-jf-b0- ip=192.168.1.104 latency=0 link=yes multicast=yes wireless=IEEE 802.11
resources: irq:16 memory:c9738000-c973bfff
*-network:1 DISABLED
description: Ethernet interface
product: Ethernet Connection (6) I219-V
vendor: Intel Corporation
physical id: 1f.6
bus info: pci@0000:00:1f.6
logical name: enp0s31f6
version: 30
serial: 98:fa:9b:12:3e:10
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.13.0-51-generic firmware=0.5-3 latency=0 link=no multicast=yes port=twisted pair
resources: irq:167 memory:c9700000-c971ffff
*-network DISABLED
description: Ethernet interface
physical id: 2
bus info: usb@1:4
logical name: enx00e04f0000ce
serial: 00:e0:4f:00:00:ce
size: 100Mbit/s
capacity: 1Gbit/s
capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.12.12 duplex=full firmware=rtl8153a-4 v2 02/07/20 link=no multicast=yes port=MII speed=100Mbit/s
可见 Ethernet interface 状态为 DISABLE ,可以创建一个缺少的配置文件进而解决这个问题,具体操作如下:
sudo touch /etc/NetworkManager/conf.d/10-globally-managed-devices.conf
sudo systemctl restart NetworkManager
之后,继续用lshw命令测试结果如下:
$ sudo lshw -c Network
*-network:0 DISABLED
description: Wireless interface
product: Cannon Point-LP CNVi [Wireless-AC]
vendor: Intel Corporation
physical id: 14.3
bus info: pci@0000:00:14.3
logical name: wlp0s20f3
version: 30
serial: 38:00:25:9b:44:2a
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical wireless
configuration: broadcast=yes driver=iwlwifi driverversion=5.13.0-51-generic firmware=46.4d093a30.0 9000-pu-b0-jf-b0- latency=0 link=no multicast=yes wireless=IEEE 802.11
resources: irq:16 memory:c9738000-c973bfff
*-network:1
description: Ethernet interface
product: Ethernet Connection (6) I219-V
vendor: Intel Corporation
physical id: 1f.6
bus info: pci@0000:00:1f.6
logical name: enp0s31f6
version: 30
serial: 98:fa:9b:12:3e:10
capacity: 1Gbit/s
width: 32 bits
clock: 33MHz
capabilities: pm msi bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=5.13.0-51-generic firmware=0.5-3 latency=0 link=no multicast=yes port=twisted pair
resources: irq:167 memory:c9700000-c971ffff
*-network
description: Ethernet interface
physical id: 2
bus info: usb@1:4
logical name: enx00e04f0000ce
serial: 00:e0:4f:00:00:ce
size: 100Mbit/s
capacity: 1Gbit/s
capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.12.12 duplex=full firmware=rtl8153a-4 v2 02/07/20 ip=192.168.1.105 link=yes multicast=yes port=MII speed=100Mbit/s
可以看到physical id: 2的网卡已经恢复正常,同时网络图标也恢复正常可见。
以上是我的电脑网络修复的方案
其他方案参考:
在处理这个问题的过程中还看到有其他方案,但可能我电脑的状态不太一样,经过尝试并没有处理掉; 但如果有遇到网络图标消失的情况,也可进行尝试:
1、删除NetworkManager的缓存
$ sudo service NetworkManager stop
$ sudo rm /var/lib/NetworkManager/NetworkManager.state
$ sudo service NetworkManager start
2、修改配置,把其中的manage=false改为true
sudo vi /etc/NetworkManager/NetworkManager.conf
3、重启NetworkManager
sudo service NetworkManager restart
参考文章:https://blog.csdn.net/weixin_46721287/article/details/126098278