Screwed up Hostname on Ubuntu 6.06 LTS

Discussion in 'Server Operation' started by FrozenPixel, Nov 14, 2006.

  1. FrozenPixel

    FrozenPixel New Member

    Ok I not only edited the hostname in:

    /etc/host

    where I added the IP address: X.X.X.X server1.example.com server1

    but also in

    /etc/hostname

    and this is where I screwed up. Instead of just entering:
    server1.example.com

    I went -
    #server1
    server1.example.com

    And now I can't get back in to correct the problem, I keep getting
    sudo: unable to lookup #server1

    Now what should I do, reinstall??

    Ubuntu Server 6.06 LTS with LAMP

    Thanks
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. FrozenPixel

    FrozenPixel New Member

    Thank you Falko. I had tried that but to no avail, having the 2 lines hostname has stopped any type of repair. I even just booted into recovery mode to no avail. I am currently reinstalling the OS and will chalk this up to a learning experience for a beginner Linux user.

    I did however rename the hostname because the steps in both the 6.10 and 6.06 version on the HowTo's do not produce the results as stated by issuing the commands:

    hostname

    hostname -f

    as per instructions.

    After editing the /etc/host file as instructed those commands did not give identical results so hence the reason I went into /etc/hostname file top begin with.

    I also did not use the sudo passwd root but rather just executed the sudo -s as one members comments had suggested.

    These HowTo's are the best.
     
    Last edited: Nov 14, 2006
  4. falko

    falko Super Moderator Howtoforge Staff

    It's /etc/hosts, not /etc/host.
     
  5. FrozenPixel

    FrozenPixel New Member

    Yes you are correct that was just a posting error, not when I actually issued the command.
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Ok, what's in /etc/hosts and /etc/hostname, and what's the output of
    Code:
    hostname
    and
    Code:
    hostname -f
    ?
     
  7. FrozenPixel

    FrozenPixel New Member

    Ok prior to editing /etc/hosts

    127.0.0.1 localhost
    127.0.0.1 myserver1

    After editing /etc/hosts

    127.0.0.1 localhost.localdomain localhost
    192.168.0.1 myserver1.example.com myserver1

    Execute after rebooting:

    hostname
    myserver1

    hostname -f
    myserver1.example.com

    Prior to editing /etc/hostname
    myserver1

    After editing:
    myserver1.example.com

    Now issuing both commands matches each result.
    myserver1.example.com
     
    Last edited: Nov 17, 2006
  8. falko

    falko Super Moderator Howtoforge Staff

    So the problem is solved?
     
  9. FrozenPixel

    FrozenPixel New Member


    Yes it is thank you.
     

Share This Page