sudo: unable to resolve host xxx解决办法

时间:2022-09-03 21:25:50

问题:

root@wiki:~# sudo lsb_release -a
sudo: unable to resolve host wiki
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.1 LTS
Release:        14.04
Codename:       trusty

可见我的主机名为wiki(机器hostname),每次执行sudo 就会出现这个警告sudo: unable to resolve host wiki。

解决办法:修改/etc/hosts

改前:127.0.0.1      localhost

改后:127.0.0.1      localhost  wiki