背景

系统编程只读的了,进入到initramfs模式,执行了下边语句,发现不小心把windows也给执行了,报错很多乱码,强制退出
执行

blkid
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
挂载网卡
  1. 找个可以打开的控制台工具打开,我用vscode打开控制台
    执行语句挂在网卡,网卡灯就亮了,我的网卡名字叫eno1,有些网卡叫eth0什么的多试试就行
ifconfig eno1 up
启动network-manager
  1. 启动网卡还是失败,报上边的错误
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地址
  1. 启动成功但是还是无法获取ipv4地址

需要创建一个/etc/network/interfaces文件,内容如下: 网卡改成你自己的

 auto lo
 iface lo inet loopback
 auto eno1
 iface eno1 inet dhcp
 auto eno1
 iface eno1 inet dhcp

执行

sudo dhclient

就有ipv4地址了,可以正常连接

无法获取dns服务器,修改下面文件

/etc/systemd/resolved.conf

增加内容 

DNS=8.8.8.8 114.114.114.114

重启服务

systemctl restart systemd-resolved
systemctl enable systemd-resolved

ubuntu terminal打不开,重新安装
 

sudo apt-get remove gnome-terminal
sudo apt-get install gnome-terminal

Logo

一起探索未来云端世界的核心,云原生技术专区带您领略创新、高效和可扩展的云计算解决方案,引领您在数字化时代的成功之路。

更多推荐