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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值