apt-get出现Package ‘ping‘ has no installation candidate解决

在使用乌班图容器时,出现apt-get失败,无法安装ping命令

root@932bafeee187:/# apt-get install -y ping
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package ping is a virtual package provided by:
  inetutils-ping 2:1.9.4-11
  iputils-ping 3:20190709-3
You should explicitly select one to install.
E: Package 'ping' has no installation candidate

网上说在前面加上这两个命令

apt-get update
apt-get -y upgrade

不过我试了还是不行

root@932bafeee187:/# apt-get install -y ping
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package ping is a virtual package provided by:
  inetutils-ping 2:1.9.4-11
  iputils-ping 3:20190709-3
You should explicitly select one to install.
E: Package 'ping' has no installation candidate

不过这次有新的提示,说ping在以下包里存在
安装提示中的包

root@932bafeee187:/# apt-get install -y inetutils-ping 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
...
Preparing to unpack .../inetutils-ping_2%3a1.9.4-11_amd64.deb ...
Unpacking inetutils-ping (2:1.9.4-11) ...
Setting up libidn11:amd64 (1.33-2.2ubuntu2) ...
Setting up netbase (6.1) ...
Setting up inetutils-ping (2:1.9.4-11) ...
Processing triggers for libc-bin (2.31-0ubuntu9.1) ...

使用ping成功(安装另一个iputils-ping 也可以正常使用ping,可以自行选择)

root@932bafeee187:/# ping www.baidu.com
PING www.a.shifen.com (180.101.49.12): 56 data bytes
64 bytes from 180.101.49.12: icmp_seq=0 ttl=49 time=9.146 ms
64 bytes from 180.101.49.12: icmp_seq=1 ttl=49 time=9.153 ms
上一篇:摩尔投票解决多数元素问题


下一篇:PXE