Why doesn't "hostname --fqdn" work on my Ubuntu computer?

Can you provide the content of /etc/nsswitch.conf ?

It looks like /etc/nsswitch.conf has a bad value for the "hosts" line. Does it start with "files" ?

Otherwise the FQDN is set by editing /etc/hosts and putting the FQDN on the line where the hostname appears. Suppose you have an hostname "foo", and you find a line:

127.0.0.1 foo

You would edit it like this:

127.0.0.1 foo.localdomain foo

foo.localdomain would be your new FQDN.


edit /etc/hosts to add your FQDN

Information on syntax located here: http://www.faqs.org/docs/securing/chap9sec95.html

update: reading over your question again it almost sounds like you either don't have your path set right, or there is something wrong with the hostname program.

do 'which hostname'

it should return with the path '/bin/hostname'

if that works try the command again like,

'/bin/hostname --fqdn'