码迷,mamicode.com
首页 > 其他好文 > 详细

Error message when I run sudo: unable to resolve host

时间:2015-08-31 19:49:50      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:sudo

I have this issue on AWS on some servers. Whenever I run sudo the terminal is stuck doing seemingly nothing, until it finally spits out this error message. My terminal looks like this:

ubuntu@(none):~$ sudo true
sudo: unable to resolve host (none)

What can I do to solve it?

Please post the contents of /etc/hostname and /etc/hosts

make sure your hostname same with hosts. e.g. the hostname is ubuntu-pc and hosts is ubuntu-pcmust be same.

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

  1. That the /etc/hostname file contains just the name of the machine.

  2. That /etc/hosts has an entry for localhost. It should have something like:

     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.



本文出自 “PETER-疏狂少年” 博客,请务必保留此出处http://petervip.blog.51cto.com/3790959/1690217

Error message when I run sudo: unable to resolve host

标签:sudo

原文地址:http://petervip.blog.51cto.com/3790959/1690217

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!