sudo, unable to resolve host

Reference:
 Error message when I run sudo: unable to resolve host (none)

 现象是这样的。

1
2
xxx@...:~$ sudo true
sudo: unable to resolve host (...)

 解决的方法如下。

Two things to check (assuming your machine is called my-machine, you can change this as appropriate):

  • That the /etc/hostname file contains just the name of the machine.
  • That /etc/hosts has an entry for localhost. It should have something like:
    1
    2
    127.0.0.1    localhost.localdomain localhost
    127.0.1.1 my-machine

If either of these files aren’t correct (since you can’t sudo), you may have to reboot the machine into recovery mode and make the modifications, then reboot to your usual environment.

 我遇到的问题是,通过UI系统设置修改了机器名,/etc/hostname 是修改过来了,但是 /etc/hosts 中却还是保留了原来的机器名。
 这个问题,在使用 Networking-ROS 的运行过程中使得通过网络连接的分布式 masterslave 无法正常通讯。

文章目录