ubuntu机器重启后netplan命令丢失

机器重启后网卡不显示ip,netplan命令丢失,ifconfig eth0 up 无效,由于上不了网,无法通过网络在线安装包

通过其他机器下在netplan.io包拷贝后安装报错,缺少python环境

root@ceph-osd01:~# netplan  apply 
Traceback (most recent call last):
  File "/usr/sbin/netplan", line 20, in <module>
    from netplan import Netplan
  File "/usr/share/netplan/netplan/__init__.py", line 18, in <module>
    from netplan.cli.core import Netplan
  File "/usr/share/netplan/netplan/cli/core.py", line 24, in <module>
    import netplan.cli.utils as utils
  File "/usr/share/netplan/netplan/cli/utils.py", line 23, in <module>
    import netifaces
ModuleNotFoundError: No module named 'netifaces'

配置临时ip和网关,dns后,可以联网,在线安装python环境

ifconfig  eth0 192.168.1.166 netmask 255.255.255.0
route add default  gw 192.168.1.1 dev eth0
root@ceph-osd01:~# vi /etc/resolv.conf 
安装pip
root@ceph-osd01:~# apt install python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 netplan.io : Depends: python3-netifaces but it is not going to be installed
 python3-pip : Depends: python3-setuptools but it is not going to be installed
               Depends: python3-wheel but it is not going to be installed
               Depends: python-pip-whl (= 20.0.2-5ubuntu1.8) but it is not going to be installed
               Recommends: build-essential but it is not going to be installed
               Recommends: python3-dev (>= 3.2) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

直接输入apt --fix-broken install 后重新安装

恢复
root@ceph-osd01:~# netplan apply

你可能感兴趣的:(ubuntu,linux,运维)