Results 1 to 3 of 3

Thread: Changed hostname, closed before changing hosts, now sudo is broken, catch-22!

  1. #1
    Join Date
    Sep 2010
    Beans
    32

    Changed hostname, closed before changing hosts, now sudo is broken, catch-22!

    I'm using Lubuntu 12.04.
    I was trying to change my computer name to "main" and I messed up, I'm not sure what to do now.
    I was following the directions on this page.
    Here's what I did:

    sudo leafpad /etc/hostname

    I changed the name, then stupidly closed the file, before changing "/etc/hosts"

    Now when I try to move on to the next step (sudo leafpad /etc/hosts), or try any command that begins with "sudo" I get this error:

    sudo: unable to resolve host main
    No protocol specified
    No protocol specified


    I can see that the problem is that I've changed the hostname, so the computer's bewildered by my efforts to use sudo because now hostname and hosts don't match. All I need to do is change the name in hosts, but of course I can't do that without sudo.


    Any ideas?

    And if there isn't a way to fix it, reinstalling Lubuntu 12.04 will work, yes?
    Last edited by begtognen; July 12th, 2013 at 03:18 PM.

  2. #2
    Join Date
    Apr 2012
    Beans
    7,256

    Re: Changed hostname, closed before changing hosts, now sudo is broken, catch-22!

    You should be able to fix it from the recovery console, you will need to remount the filesystem with rw permissions and then use a commandline editor e.g. after dropping to the root shell,

    Code:
    # mount -o remount,rw /
    # nano /etc/hosts
    and make your changes... Ctrl-o to save and Ctrl-x to quit

    --> http://www.psychocats.net/ubuntu/fixsudo

  3. #3
    Join Date
    Sep 2010
    Beans
    32

    Re: Changed hostname, closed before changing hosts, now sudo is broken, catch-22!

    Thank you so much! This worked a treat.

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
  •