Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm working with a fresh Debian Squeeze install from Linode, and it looks like hostname behaves differently (from lenny) in a way that makes certain other packages unhappy. Viz:

clements@debian:/tmp/npm$ hostname -A 
clements@debian:/tmp/npm$ hostname -f
hostname: Name or service not known

This behavior differs from an older (lenny) installation, where hostname -f does not signal an error. Reading the man page suggests to me that squeeze isn't a big fan of the -f option since machines can have multiple fqdns. That's fine with me, but packages like make-ssl-cert get crabby about it:

Setting up ssl-cert (1.0.28) ...
hostname: Name or service not known
make-ssl-cert: Could not get FQDN, using "debian".
make-ssl-cert: You may want to fix your /etc/hosts and/or DNS setup and run
make-ssl-cert: make-ssl-cert generate-default-snakeoil --force-overwrite
make-ssl-cert: again.

I'm hesitant to edit /etc/hosts; this wasn't required on my lenny VPS, and I have the feeling that it shouldn't be required here either.

Any suggestions greatly appreciated.

share|improve this question
up vote 3 down vote accepted

If you use FQDNFQDN (Fully Qualified Domain Name), then FQDN should be before short name in /etc/hosts. Correct       ubuntu-1010-server-01.local ubuntu-1010-server-01

wrong;       ubuntu-1010-server-01 ubuntu-1010-server-01.local

or run:

sudo make-ssl-cert generate-default-snakeoil --force-overwrite
share|improve this answer
can you shed some light on the change from lenny to squeeze? Why was this not required in lenny? Specifically, my lenny /etc/hosts has only the localhost line, and everything works fine. – John Clements Feb 26 '11 at 19:16
attach /etc/hosts to question. If you use FQDN, then FQDN should be before short name. – ooshro Feb 26 '11 at 19:19
I still feel like there's many things I don't understand going on here--other packages that provide this functionality--but adding the line you suggest certainly had the desired effect. Many thanks. – John Clements Mar 15 '11 at 19:18
ran into this - needed to add fqdn, and aws's funky hostname to the hosts to resolve. – tsykoduk Sep 9 '11 at 17:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.