hostname - weakish/cheat GitHub Wiki

You may need to check /etc/network/interfaces and /etc/resolv.conf. They should have been configured, though.

If /etc/hosts and /etc/hostname has not been configured yet:

echo '127.0.0.1    foo.example.com foo' >> /etc/hosts
echo foo > /etc/hostname
hostname foo