Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Relevant files (slightly anonymized):

heinzi@d2:~$ cat /etc/hostname
heinzi@d2:~$ cat /etc/hosts       localhost
<myexternalip>  d2.<myname>.at    <myname>.<myprovider>.at       <myname>

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

This output is correct:

heinzi@d2:~$ hostname
heinzi@d2:~$ hostname --all-fqdns

But this I don't understand:

heinzi@d2:~$ hostname --fqdn

Shouldn't it be d2.<myname>.at, since that's the first entry after <myexternalip>? And if it's the second entry, shouldn't it by <myname>.<myprovider>.at instead of just the domain name?

I'm aware that I could probably fix this by playing around with the hosts file, but I'd really like to understand why this happens. I read the hostname man page and googled and think that it should return d2.<myname>.at in my case. Thus, I'd really prefer an answer along the lines of "This is because ..." instead of "Try ... and see if it works.".

The system is Debian 7.5 "wheezy".

share|improve this question

migrated from serverfault.com May 13 '14 at 14:12

This question came from our site for system and network administrators.

Instead of using <my name> use the words 'foo' and 'bar', it is easier to read. –  spuder May 13 '14 at 14:39
@spuder: Thanks, I'll keep that in mind for my next question. –  Heinzi May 13 '14 at 14:53
@spuder I see your point, but here, the term Name or Provider in the names are useful. Hmm... maybe you meant replacing <myname> not by foo, but by fooName? That's much better indeed. –  Volker Siegel Nov 15 '14 at 8:26

1 Answer 1

As it turns out, the culprit was /etc/resolv.conf. Changing:

search <myprovider>.at
nameserver ...
nameserver ...
nameserver ...


search <myname>.at <myprovider>.at
nameserver ...
nameserver ...
nameserver ...

fixes the issue.

(I'll leave the question open for the time being, just in case someone can come up with an explanation for this.)

share|improve this answer

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.