本文主要是介绍ubuntu 20.04无法连接网络,网线灯不亮,network-manager也启动不了,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
背景
系统编程只读的了,进入到initramfs模式,执行了下边语句,发现不小心把windows也给执行了,报错很多乱码,强制退出
执行
fsck -y /dev/sdb4
fsck -t ext4 /dev/sdb5 -y ## windows
时强制退出了导致很多文件损坏,虽然能正常开机了
但是terminal打不开,NetworkManager启动不了,网卡也掉了,折腾了好久才解决重新连上网
解决办法
看系统日志报错,网线灯也不亮
bus-manager: fatal failure to acquire D-Bus service "org.freedesktop.NetworkManager: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Connection ":1.293" is not allowed to own the service "org.freedesktop.NetworkManager" due to security policies in the configuration fil
挂载网卡
- 找个可以打开的控制台工具打开,我用vscode打开控制台
执行语句挂在网卡,网卡灯就亮了,我的网卡名字叫eno1,有些网卡叫eth0什么的多试试就行
ifconfig eno1 up
启动network-manager
- 启动网卡还是失败,报上边的错误
sudo service network-manager start
创建一个文件叫org.freedesktop.NetworkManager.conf,拷贝到
sudo cp org.freedesktop.NetworkManager.conf /etc/dbus-1/system.d/
内容如下:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE busconfig PUBLIC"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN""http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig><!-- Only root can own the service --><policy user="root"><allow own="org.freedesktop.NetworkManager"/></policy><policy context="default"><allow send_destination="org.freedesktop.NetworkManager"/><allow send_destination="org.freedesktop.NetworkManager"send_interface="org.freedesktop.DBus.Properties"/><allow send_destination="org.freedesktop.NetworkManager"send_interface="org.freedesktop.DBus.Introspectable"/><allow send_destination="org.freedesktop.NetworkManager.User"send_interface="org.freedesktop.DBus.Properties"/><allow send_destination="org.freedesktop.NetworkManager.User"send_interface="org.freedesktop.DBus.Introspectable"/></policy></busconfig>
再次启动network-manager,启动成功
sudo service network-manager start
查看窗台
sudo service network-manager status
获取ipv4地址
- 启动成功但是还是无法获取ipv4地址
需要创建一个/etc/network/interfaces文件,内容如下: 网卡改成你自己的
auto loiface lo inet loopbackauto eno1iface eno1 inet dhcpauto eno1iface eno1 inet dhcp
执行
sudo dhclient
就有ipv4地址了,可以正常连接
这篇关于ubuntu 20.04无法连接网络,网线灯不亮,network-manager也启动不了的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!