您当前的位置: 首页 >  ubuntu
  • 2浏览

    0关注

    478博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Ubuntu ERROR: sudo: unable to resolve host ubuntu: Name or service not known

高精度计算机视觉 发布时间:2022-03-05 22:35:06 ,浏览量:2

ubuntu系统报错:sudo: unable to resolve host ubuntu: Name or service not known

检查一下,

ubuntu@ubuntu:~/mc$ cat /etc/hostname
ubuntu
ubuntu@ubuntu:~/mc$ cat /etc/hosts
127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

修改一下,

sudo vim /etc/hosts

添加了一行"127.0.1.1 ubuntu"(也可以是127.0.0.1 ubuntu),如下,

127.0.0.1 localhost
127.0.1.1 ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

再检查 

username@ubuntu ~ $ cat /etc/hostname
ubuntu

username@ubuntu ~ $ cat /etc/hosts
127.0.0.1       localhost
127.0.1.1       ubuntu

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

问题解决。

关注
打赏
1659856567
查看更多评论
立即登录/注册

微信扫码登录

0.0669s