Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: sudo: unable to resolve host ubuntu-server

  1. #1
    Join Date
    Jan 2010
    Beans
    4

    sudo: unable to resolve host ubuntu-server

    Hi All,

    I am having the "sudo: unable to resolve host <hostname>" issue that some others have reported over the years. This is a fresh install of 14.04LTS that is up to date.

    When I use the command

    Code:
    cat /etc/hostname
    I get back:
    <hostname>

    Likewise when I use:

    Code:
    cat /etc/hosts
    I get back:
    127.0.0.1 localhost
    127.0.1.1 <hostname>

    # 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

    I am not really sure what to try next, the hostname and hosts file both contain the same hostname....any ideas?

    Cheers!

  2. #2
    Join Date
    Jun 2007
    Location
    China
    Beans
    996
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: sudo: unable to resolve host ubuntu-server

    I think you just need to give your system a host name

    Open a terminal and run
    Code:
    sudo gedit /etc/hostname
    and add something to the file for example
    himayloco
    then
    Code:
    sudo gedit /etc/hosts
    amd modify it so that it looks like

    Code:
    127.0.0.1       localhost
    127.0.1.1       himayloco
    
    # 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
    Then reboot and all should be well

  3. #3
    Join Date
    Jan 2010
    Beans
    4

    Re: sudo: unable to resolve host ubuntu-server

    Hi GoneFishing, thanks for the reply!

    Thats the weird thing. I do have a hostname in both places. When this problem first appeared, I had a different hostname with a capital letter in it, so I changed it to something simpler with no special characters or capitals. I used
    Code:
    sudo gedit /etc/hostname
    to change the hostname file and
    Code:
    sudo gedit /etc/hosts
    to change the hosts file to be that new host name. I then restarted the machine and nothing....the problem is still there.

    Since you took the time to reply, and so that we can be precise, I have changed my hostname to "himayloco" for the time being. I have edited both the /etc/hostname and /etc/hosts files to reflect this hostname. I then restarted the machine and I still have the problem.

  4. #4
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: sudo: unable to resolve host ubuntu-server

    Hi

    Does you hostname contain spaces or other unusual characters ?

    EDIT: we were cross posting so I guess not ?

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  5. #5
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: sudo: unable to resolve host ubuntu-server

    Hi

    Can you post the output of this command.

    Code:
    hostname
    and

    Code:
    grep $(hostname) /etc/hosts
    Kind regards
    Last edited by matt_symes; December 6th, 2014 at 04:21 PM.
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  6. #6
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,269
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: sudo: unable to resolve host ubuntu-server

    I am having the "sudo: unable to resolve host <hostname>" issue that some others have reported over the years. This is a fresh install of 14.04LTS that is up to date.
    OK. So this is the error you are getting? But the hostname and hosts file are correct already?

    What terminal commands shows that error?

  7. #7
    Join Date
    Jan 2010
    Beans
    4

    Re: sudo: unable to resolve host ubuntu-server

    For matt_symes:

    Code:
    hostname
    output:
    himayloco

    Code:
    grep $(hostname) /etc/hosts
    output:
    127.0.1.1 himayloco


    For nerdtron:
    Any terminal command that contains "sudo"

    Thanks to both of you!

  8. #8
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,269
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: sudo: unable to resolve host ubuntu-server

    HHmmm this is plain weird. I remember this happening to me once and I just corrected the entry on the /etc/hosts. Yours is correct already, well, there's no typo.

    Have you tried suggestions here: http://askubuntu.com/questions/59458...olve-host-none

  9. #9
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: sudo: unable to resolve host ubuntu-server

    Hi

    That is odd. Can we also check your sudoers files.

    boot into the recovery terminal and type

    Code:
    grep -nH "^[^#]" /etc/sudoers{,.d/*}
    Capital H above. Maybe easier to copy and paste it into the terminal.

    Kind regards
    Last edited by matt_symes; December 6th, 2014 at 06:14 PM.
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  10. #10
    Join Date
    Aug 2009
    Location
    Makati City, Philippines
    Beans
    2,269
    Distro
    Xubuntu 16.04 Xenial Xerus

    Re: sudo: unable to resolve host ubuntu-server

    After the fresh install what else did you do? any changes on system files? What else did you install?

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •