I'm testing a VPS provider, and recently created a virtual machine with a hostname testserver using an ubuntu template. This VPS provider reserves and bills resources by the month, so if you create a VM for a small job, it's sensible to keep it around in case you need another VM for some other job later.
I came back to VM after a couple of weeks for another job, and wanted to rename the hostname to webserver. I edited /etc/hostname and rebooted, and the OS recognises that the hostname is now webserver. According to the VPS vendor, it's apparently impossible to change the hostname of the VM in the hypervisor resource group (read they haven't created a controller view and form template to do so), so I'm stuck with it being called testserver there. sudo works, but when I sudo I get a warning:
sudo: unable to resolve host webserver
Anyone know why? This is obviously just a minor inconvenience, but I thought I would ask in case anyone knows of a solution.
grep hosts: /etc/nsswitch.conf) include 'files'? If so, an entry in /etc/hosts should do it.