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

Thread: [SOLVED] Sudo

  1. #1
    DeMus is offline I Ubuntu, Therefore, I Am
    Join Date
    May 2008
    Location
    The Netherlands
    Beans
    2,146

    [SOLVED] Sudo

    Hi,

    Everytime when I use sudo in a terminal I get the following message:

    jan@2-Quad:~$ sudo ls -l
    sudo: unable to resolve host 2-Quad
    [sudo] password for jan:

    ls -l is just an example instruction.
    I gave my computer the name 2-Quad, so that's the host name. But what does the message mean and how can I make it go away? I don't see that something is not working, I just get the message. Can somebody tell me what is wrong, where it is wrong and how to change it?

    Thanks,
    DeMus

  2. #2
    Join Date
    May 2008
    Location
    Eugene, OR, USA
    Beans
    435

    Re: Sudo

    The error message means that the system is unable to translate your system's hostname into an IP address. The easiest way to fix this is to update your /etc/hosts file. Find a line that looks like:

    Code:
    127.0.0.1		localhost.localdomain localhost
    Change it to

    Code:
    127.0.0.1		localhost.localdomain localhost 2-Quad
    That should make the error go away.
    Hal Pomeranz, Deer Run Associates
    [[ Various Linux/Unix related documents ]]
    [[ Command-Line Kung Fu blog ]]

  3. #3
    Join Date
    May 2008
    Beans
    168

    Re: Sudo

    That seems like a wierd error. Do we know why it happened to him? Seems like something that shouldn't happen. Bug?

    M

  4. #4
    Join Date
    May 2008
    Location
    Eugene, OR, USA
    Beans
    435

    Re: Sudo

    Quote Originally Posted by molotov00 View Post
    That seems like a wierd error. Do we know why it happened to him? Seems like something that shouldn't happen. Bug?
    If the original poster changed the system hostname after the initial install, it seems possible to me that the hostname may not have been propagated to all necessary system files. I'm not sure I'd call it a bug until I know exactly how the hostname change was done.

    DeMus, can you describe exactly how you changed the name of your machine?
    Hal Pomeranz, Deer Run Associates
    [[ Various Linux/Unix related documents ]]
    [[ Command-Line Kung Fu blog ]]

  5. #5
    Join Date
    Jun 2006
    Location
    Solihull, UK
    Beans
    1,413

  6. #6
    DeMus is offline I Ubuntu, Therefore, I Am
    Join Date
    May 2008
    Location
    The Netherlands
    Beans
    2,146

    Re: Sudo

    Quote Originally Posted by HalPomeranz View Post
    The error message means that the system is unable to translate your system's hostname into an IP address. The easiest way to fix this is to update your /etc/hosts file. Find a line that looks like:

    Code:
    127.0.0.1		localhost.localdomain localhost
    Change it to

    Code:
    127.0.0.1		localhost.localdomain localhost 2-Quad
    That should make the error go away.
    I don't know why but it worked. Thanks for the help. Can you also explain it to me?

    DeMus

  7. #7
    Join Date
    May 2008
    Location
    Eugene, OR, USA
    Beans
    435

    Re: Sudo

    Quote Originally Posted by DeMus View Post
    I don't know why but it worked. Thanks for the help. Can you also explain it to me?
    Sure. The problem was that there was no configuration on your system to allow it to convert your machine's hostname into an IP address. That's what the error message "unable to resolve host 2-Quad" means-- to "resolve" a host means to convert that name into an IP.

    Name resolution can happen in any one of several ways. On many networks you use DNS for name resolution, but there's also networked databases such as LDAP and NIS. Failing that, you can use /etc/hosts files, which is what I had you configure here.

    Each line in the /etc/hosts file lists an IP address and one or more host names associated with that IP. All I told you to do was to add your machine's hostname to the /etc/hosts entry for the loopback interface (127.0.0.1). sudo doesn't care which interface IP it gets when trying to resolve your hostname, just that it gets something as a result of the lookup. Once you added the name to a valid entry in the /etc/hosts file, sudo was satisfied and stopped throwing the error.
    Hal Pomeranz, Deer Run Associates
    [[ Various Linux/Unix related documents ]]
    [[ Command-Line Kung Fu blog ]]

  8. #8
    DeMus is offline I Ubuntu, Therefore, I Am
    Join Date
    May 2008
    Location
    The Netherlands
    Beans
    2,146

    Re: Sudo

    Quote Originally Posted by HalPomeranz View Post
    If the original poster changed the system hostname after the initial install, it seems possible to me that the hostname may not have been propagated to all necessary system files. I'm not sure I'd call it a bug until I know exactly how the hostname change was done.

    DeMus, can you describe exactly how you changed the name of your machine?
    No, I can not. It must have happened when I tried to install and configure Samba, but I can not tell you anymore what I had to do to make Samba work. I'm sorry.

    DeMus

  9. #9
    Join Date
    Feb 2009
    Beans
    1

    Re: [SOLVED] Sudo

    hi,
    im a new user of ubuntu and i now have this "unable to resolve host problem". i tried "sudo gedit/etc/hosts" changed the host name in the first line but still no luck.and now i dont know how to find the line 127.0.0.1 localhost.localdomain localhost.

    i need urgent help and i need to get rid off a recycler once the terminal starts accepting my commands.

  10. #10
    Join Date
    Mar 2006
    Location
    Williams Lake
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: [SOLVED] Sudo

    Press Alt-F2 and type:

    Code:
    gksu gedit /etc/hosts
    this will open /etc/hosts in gedit the file should look something like this:

    Code:
    cat /etc/hosts
    127.0.0.1	localhost
    127.0.1.1	jack
    192.168.1.200	willy
    192.168.1.202	minibuntu
    192.168.1.1	router
    
    # 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
    ff02::3 ip6-allhosts
    Jim

Page 1 of 2 12 LastLast

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
  •