Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I recently change my hostname with

sudo hostname matthew-laptop

and edited /etc/hosts and checked cat /etc/hostname outputs matthew-laptop, which it does.

However when I try and login on startup, it goes to the terminal says cannot resolve host to 127.0.0.1 (I have apache installed maybe it's just that) and then redirects me to the login page. I am able to log on in a different.. workspace? (I press ctrl + alt + 2), so I have command line access but I don't know how to fix this.

[Edit]
My hosts file:
127.0.0.1    localhost
127.0.1.1    matthew-laptop
127.0.0.1    billyalmondart.dev

# 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

[Edit]

When I log in I get this briefly:

could not write bytes: Broken pipe
share|improve this question
I swapped the tabs for spaces because I thought that's why it wasn't displaying properly, I also added the backslash before the hash. I'll amend that now. There is no real point, it was just there by default. – Matthew Haworth Jul 20 '12 at 20:48
I don't think that is true - I use that very often setting up multiple virtual hosts. – Matthew Haworth Jul 20 '12 at 20:54
I'm pretty sure it's not the hosts file, the hosts file is exactly as it was before this error occured. I frequently modify my hosts file to have multiple entries for 127.0.0.1 and it is never a problem. – Matthew Haworth Jul 20 '12 at 20:59
Ok, fine, either you're lying about what you changed, or you're lying about the hosts file being exactly what it was before you changed. Either way, I'm done. – Paul Tomblin Jul 20 '12 at 21:03
1  
I appreciate you're help, but I know for certain that it has nothing to do with the hosts file. It's rather harsh to accuse somebody of lying just because you're unable to solve their problem. – Matthew Haworth Jul 20 '12 at 21:14
show 1 more comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.