System registration fails with "Name or service not known"

Solution Verified - Updated -

Environment

  • Red Hat Network(RHN)
  • Red Hat Enterprise Linux(RHEL)
  • Red Hat subscription Manager(RHSM)

Issue

  • System registration fails with error Name or service not known :

    Error communicating with server. The message was:
    Name or service not known
    
  • Unable to register system its fails error gaierror: [Errno -2] Name or service not known :

    2014-06-18 14:33:50,133 [ERROR]  @managercli.py:151 - Error during registration: [Errno -2] Name or service not known
    2014-06-18 14:33:50,134 [ERROR]  @managercli.py:152 - [Errno -2] Name or service not known
    Traceback (most recent call last):
      File "/usr/share/rhsm/subscription_manager/managercli.py", line 1045, in _do_command
        owner_key = self._determine_owner_key(admin_cp)
      File "/usr/share/rhsm/subscription_manager/managercli.py", line 1148, in _determine_owner_key
        owners = cp.getOwnerList(self.username)
      File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 852, in getOwnerList
        return self.conn.request_get(method)
      File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 541, in request_get
        return self._request("GET", method)
      File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 448, in _request
        conn.request(request_type, handler, body=body, headers=headers)
      File "/usr/lib64/python2.6/httplib.py", line 914, in request
        self._send_request(method, url, body, headers)
      File "/usr/lib64/python2.6/httplib.py", line 951, in _send_request
        self.endheaders()
      File "/usr/lib64/python2.6/httplib.py", line 908, in endheaders
        self._send_output()
      File "/usr/lib64/python2.6/httplib.py", line 780, in _send_output
        self.send(msg)
      File "/usr/lib64/python2.6/httplib.py", line 739, in send
        self.connect()
      File "/usr/lib64/python2.6/site-packages/M2Crypto/httpslib.py", line 51, in connect
        socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM):
    gaierror: [Errno -2] Name or service not known
    
  • yum update fails with Error communicating with server. The message was Name or service unknown

Resolution

  • Start the messagebus and haldaemon services, if not running.

  • Check /etc/resolv.conf file to see if the DNS server entry is present in this file. If not, then verify your DNS server and then add its entry.

    # vi /etc/resolv.conf
    
    nameserver <dns_server_ip>
    
  • Check if sslCACert is define properly in /etc/sysconfig/rhn/up2date
    It should be:

      sslCACert=/usr/share/rhn/RHNS-CA-CERT
    
  • Restart network service:

    # service network restart
    

For a system registered with RHSM:

  • Correct Server hostname and Server prefix entries in /etc/rhsm/rhsm.conf file as below:

    [server]
    # Server hostname:
    hostname = subscription.rhn.redhat.com
    
    # Server prefix:
    prefix = /subscription
    
  • Now register system

For a system registered with Satellite/Capsule:

  • Set the correct Satellite hostname in Capsule /etc/hosts file.

Root Cause

  • Firewall blocking some ports.
  • Incorrect CA certificate in /etc/sysconfig/rhn/up2date
    For system registered using RHN Classic, value is "sslCACert=/usr/share/rhn/RHNS-CA-CERT"
  • Incorrect Server hostname and Server prefix entries in /etc/rhsm/rhsm.conf file.

Diagnostic Steps

  • From error message it seems that there is an issue with name resolution.

  • Check whether inbound and outbound ports i.e. 443 and 80 are open.

  • To check communication between client and server,

    # telnet xmlrpc.rhn.redhat.com 80
    # telnet xmlrpc.rhn.redhat.com 443
    # nc -z rhn.redhat.com 80 -Xconnect
    # nc -z rhn.redhat.com 443 -Xconnect
    # echo -e "TRACE / HTTP/1.1\nHost: xmlrpc.rhn.redhat.com\n\n" | nc xmlrpc.rhn.redhat.com 80          
    
  • Check whether messagebus and haldaemon services are running:

    # /etc/init.d/messagebus status
    # /etc/init.d/haldaemon status
    

For system registered with Red Hat Subscription Manager

  • Check /etc/rhsm/rhsm.conf file to verify following entries :

    [server]
    # Server hostname:
    hostname = subscription.rhn.redhat.com
    
    # Server prefix:
    prefix = /subscription
    

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments