sudo: unable to resolve host hostname: Name or service not known
问题复现
使用 hostnamectl hostname
命令更改 hostname 之后使用 sudo
后出现报错 sudo: unable to resolve host cloudcone: Name or service not known
解决方案
修改 /etc/hosts
文件 添加 127.0.0.1 cloudcone
::1 cloudcone
cloudcone 是我设置的新 hostname
1 | 27.0.0.1 localhost |