command ‘ifconfig‘ not found, but can be installed with:解决办法

文章目录

    • 报错
    • 解决

报错

在ubuntu18.04中,使用ifconfig命令查看ip地址,但是报错了。

command ‘ifconfig‘ not found, but can be installed with:解决办法_第1张图片

解决

根据提示,使用 sudo apt install net-tools 命令,安装网络工具。

command ‘ifconfig‘ not found, but can be installed with:解决办法_第2张图片

以上说明apt被某个进程锁住了,找到进程,kill 就完了,如下:

删除占用进程

强制重新配置软件包,升级下apt,但是又报错。

升级apt报错

使用指令sudo rm /var/lib/dpkg/lock-frontendsudo rm /var/lib/dpkg/lock删除占用进程

删除占用

移除锁定文件

使用指令sudo apt update再次尝试更新apt,成功!

command ‘ifconfig‘ not found, but can be installed with:解决办法_第3张图片

使用指令sudo apt install net-tools安装网络工具。

command ‘ifconfig‘ not found, but can be installed with:解决办法_第4张图片

使用ifconfig,查看ip

command ‘ifconfig‘ not found, but can be installed with:解决办法_第5张图片

注意:虚拟机的网络链接要设置成桥接模式,桥接到有线网卡。

尝试使用ping命令,本机和虚拟机互ping,成功ping通。

本机和虚拟机互ping

你可能感兴趣的:(踩过的坑,ubuntu报错,驱动开发)