Today I tried to to a major upgrade of my local ubuntu based server. I hadn’t done this in a while. When starting update-manager it got stuck and refused to download any upgrades. So I first attempted to run aptitude to get around. But as soon the I needed to sudo I got this nasty “unable to resolve host ” error. So basically coulddn’t get any permissions to make changes to the system.

I found this bug which explains wht’s going on. I don’t know how it happened but my /etc/hosts file contained an invalid hostname. I was able to start the network-admin panel (strangely here sudo-ing worked, I was prompted for the password) and fixed the hostname.