[sf-lug] ERROR: getaddrinfo: Name or service not known

Rick Moen rick at linuxmafia.com
Thu Nov 8 15:59:36 PST 2012

Quoting Christian Einfeldt (einfeldt at gmail.com):

> I am trying to remotely dial in to my boss's server so that I can work from
> wherever I want using 12.04.  He is using a Windows server, probably
> Microsoft Windows 7.  I have successfully dialed in before using several
> different computers, but just recently recently have been getting this
> error:
> cje at rb:~$ rdesktop rds.xxx.xxx.xxx.xxx -f -a 16  -k en-us
> ERROR: getaddrinfo: Name or service not known
> I changed the IP address of my boss's server above to xxx.xxx.xxx.xxx
> because I am not sure if it is smart to put that info up on the Internet.

In a follow-up:

> I have connected to the server in two ways:
> cje at rb:~$ rdesktop rds.xxx.xxx.xxx.xxx -f -a 16  -k en-us
> and
> cje at rb:~$ rdesktop rds.domainname.com -f -a 16  -k en-us

Christian did not say what happened when he typed 

    rdesktop rds.domainname.com -f -a 16  -k en-us

...but impliedly he's at least _suggesting_ that he got something like
'Name or service not known'.

Here, Christian says something that hints at a (very) key problem:

   rdesktop rds.xxx.xxx.xxx.xxx

He says that 'xxx.xxx.xxx.xxx' is the IP address of the server in
question.  So, for example, my own main Internet server has DNS name 
(among others) 'linuxmafia.com', which resolves to IP address  You can always look up DNS resolution using the 'host'

$ host linuxmafia.com 
linuxmafia.com has address
linuxmafia.com mail is handled by 10 linuxmafia.com.

So, Christian is saying that he was trying to make rdesktop connect to
'rds.', where my '' IP address stands in,
here, for the real workplace IP address he's using.

That would be a problem, because 'rds.' (and similar)
doesn't make sense.  The thing you tell rdesktop to connect to has to be
either a real resolvable name or a real IP address.
'rds.xxx.xxx.xxx.xxx' is neither of those things.

You cannot just prepend 'rds.' to a real target specifier and hope that
the rdesktop software will figure out what you mean.  You need to give
the name or IP number of the place you want rdesktop to connect to.

Using Christian's shorthand, that would be either 

    rdesktop xxx.xxx.xxx.xxx
    rdesktop SOMENAME

where SOMENAME is a server hostname that can be resolved to an IP.
And _what_ names resolve to IPs?  That's where 'Avahi' might be in the
picture and be relevant, or it might not.  Christian found
http://ubuntuforums.org/showthread.php?t=1044302 and went chasing after
the ideas in that thread under the idea of them being relevant, but 
ought to question whether the ZeroConf/Bonjour/Rendezvous[1] network
service (which the Avahi daemon deals with) even exists in his boss's
office -- and, if it exists, has anything in it about the Windows
Terminal Server (or other RDP = Remote Desktop Protocol service) box
that's even relevant.

Moreover, ZeroConf/Bonjour is, like DNS, just a complicated way of 
looking up an IP given a name, or vice-versa.  Christian says he 
already has the IP, given in his message as 'xxx.xxx.xxx.xxx'.  So,
this should work:

    rdesktop xxx.xxx.xxx.xxx
   rdesktop SOMENAME

...where SOMENAME is a name his system can look up (e.g., test that
assumption using 'dig').

FWIW, the ZeroConf aka Bonjour aka Rendezvous name-service protocol is 
intended to be a chatty, local network service supporting devices'
ability to autodiscover things nearby they might want to talk to.  E.g.,
you might put a printer on the office LAN with ZeroConf broadcasting
enabled.  The printer then cheerfully announces in ZeroConf speak 
'Hi, I'm a [foo]-type printer at IP address xxx.xxx.xxx.xxx named [bar],
and available for your local use'.  Other devices that hear the 
broadcast can then decide to do so, or not.

ZeroConf and DNS are two forms of name-resolution to determine IPs
(and reverse-resolve).  There are others.  Some Microsoft-oriented
offices use Active Directory as a name service.  That creates a 
Microsoft-derived extension to the local DNS space in the form of a
[hostname].local name tree.

But, hey, if you already have the IP, and it's static (doesn't
occasionally change under you), then use the IP, and none of the rest of
that matters.  Clear?

> I changed the avahi.conf file to .alocal but that didn';t work so I changed
> /etc/nsswitch.conf.

Honestly, don't mess with /etc/nsswitch.conf unless you _really_ 
know what you're doing.

One last thing.  I noticed:

> cje at rb:~$ rdesktop rds.xxx.xxx.xxx.xxx -f -a 16  -k en-us

You used this sort of syntax:

   command argument options

A Unix command's options traditionally are the things that have hyphens
in front of them, and the associated text.  These are options you

    -a 16
    -k en-us

The '-f' is fullscreen mode.
The '-a 16' is 16-bit colour depth.
The '-k en-us' signifies to assume a US-English keyboard.

That's all great, _but_ you put all of that in the wrong order.
The manpage for rdesktop says the required command syntax is:

   rdesktop [options] server[:port]

In other word:

   command options argument
   command argument options

I cannot think offhand of _any_ Unix command that doesn't expect options
to come first.  So, in addition to your not specifying a name or IP that
made any sense, you also were putting all your options in the wrong
place, and odds are they were getting ignored.

To sum, try:

  rdesktop  -f  -a 16  -k en-us  xxx.xxx.xxx.xxx
  rdesktop  -f  -a 16  -k en-us  SOMENAME

(No, the number of spaces doesn't matter as long as there is at least
one space between items on a command line.  I just grouped for clarity.)

'Hope that helps.

[1] The official IETF name is ZeroConf.  Rendezvous and Bonjour are
marketing names.  There have been some fights over trademarks.

More information about the sf-lug mailing list