How To Break Ubuntu In Thirty Seconds

adamw@ubuntu510:~$ sudo scp 192.168.2.7:/etc/hosts /etc

adamw@ubuntu510:~$ sudo nano /etc/hosts

sudo: unable to lookup ubuntu510 via gethostbyname()

…yeah, sudo, it’s all very clever until someone loses an eye!

I have a bunch of entries in /etc/hosts because of having four local systems plus a bunch of VMware machines etc. So now when I set up a new VMware machine I just copy the /etc/hosts from the real machine over to the VM then edit a couple of lines to match the VM, instead of re-editing it all from scratch. Only, as you can see, this utterly breaks Ubuntu…all I need to do to fix the sudo problem is edit /etc/hosts so 127.0.0.1 is ‘ubuntu510’ (the name of the VM) rather than ‘zen’ (the name of the real machine), but I can’t do it, because sudo doesn’t work…

the only way out of this that I can see is single-user mode or the recovery console. Not too smart! Surely sudo shouldn’t ABSOLUTELY NEED to look up the host it’s running on?

Leave a Reply

Your email address will not be published. Required fields are marked *