title: socket.getfqdn() returns no domain, but socket.gethostname() does?
body: <p>I do not understand this:</p>
  
  <pre><code>Python 2.7.3 (default, Apr 14 2012, 08:58:41) [GCC] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import socket
  &gt;&gt;&gt; socket.getfqdn()
  'SR-MW001'
  &gt;&gt;&gt; socket.gethostname()
  'sr-mw001.foo-domain.de'
  </code></pre>
  
  <p>What is wrong here?</p>
  
  <p>According to the docs of <a href="https://docs.python.org/2/library/socket.html#socket.getfqdn" rel="nofollow noreferrer">socket.getfqdn()</a> the "a fully qualified domain name" should get returned.</p>
  
  <h1>Update</h1>
  
  <p>More infos:</p>
  
  <p>/etc/hosts</p>
  
  <pre><code>sr-mw001:~ # grep -iP 'SR-MW001|localhost|foo-domain' /etc/hosts
  127.0.0.1       localhost
  ::1             localhost ipv6-localhost ipv6-loopback
  10.189.217.11   SR-MW001 foo-work
  </code></pre>
  
  <p>IPs</p>
  
  <pre><code>sr-mw001:~ # ip a
  1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN qlen 1
      link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
      inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
         valid_lft forever preferred_lft forever
  2: eth0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc mq state UP qlen 1000
      link/ether 00:50:56:a8:6e:eb brd ff:ff:ff:ff:ff:ff
      inet 10.189.217.11/24 brd 10.189.217.255 scope global eth0
         valid_lft forever preferred_lft forever
  </code></pre>
  
  <p>socket.gethostbyaddr()</p>
  
  <pre><code>&gt;&gt;&gt; socket.gethostbyaddr('sr-mw001.stadtwerke-gt.de')
  ('SR-MW001', ['foo-work'], ['10.189.217.11'])
  </code></pre>
  
  <p>More details:</p>
  
  <pre><code>&gt; uname -n
  sr-mw001.foo-domain.de
  
  &gt; hostname
  sr-mw001.foo-domain.de
  
  &gt; domainname
  (none)
  
  &gt; nisdomainname
  -bash: nisdomainname: command not found
  
  &gt; dnsdomainname
  foo-domain.de
  
  &gt; ypdomainname
  -bash: ypdomainname: command not found
  </code></pre>
  
  <p>Related question: <a href="https://serverfault.com/questions/972034/etc-hostname-on-suse-short-name-or-fqdn">/etc/HOSTNAME on SuSE: short name or FQDN?</a></p>