Rogue Rogue - 3 months ago 9
Linux Question

Debian command-line cannot resolve host

I'm having an issue where my remote command-line cannot resolve the local hostname. It doesn't show as

user@localhost
,
user@ip
or any variant, but instead as
user@(none)
:

Using username "rogue".
rogue@<my-ip>'s password:
Linux (none) 3.13.7-x86_64-linode38 #1 SMP Tue Mar 25 12:59:48 EDT 2014 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun Apr 27 15:34:56 2014 from ---
rogue@(none):~$


Any proceeding commands cause this warning message:

rogue@(none):~$ sudo service nginx start
sudo: unable to resolve host (none)
[sudo] password for rogue:


Looking at my hosts and hostname files, I'm not seeing anything out of the ordinary:

/etc/hostname

127.0.0.1 localhost
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


/etc/hosts

127.0.0.1 localhost
127.0.1.1 debian

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


What could potentially be wrong with my network configuration? If possible, I would like that it says
user@my.domain
, but I need
localhost
to still route correctly to
127.0.0.1

Answer

Your /etc/hostname is very wrong. It should be plain text of FQDN, like example.com or localhost, instead of a similar copy of /etc/hosts

You may want to use command hostname to view and set hostname, man it

Comments