I recently got caught in this sudo trap, changed the hostname but not the hosts file and rebooted. Had to reboot into recovery mode and edit the hosts file to fix. -- floydwilde