System registration to customer portal fails with error "Name or service not known"

Solution Verified - Updated -

Environment

  • 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 [Errno -2] Name or service not known :

    2024-06-12 18:53:08,069 [INFO] subscription-manager:5200:MainThread @connection.py:924 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=basic username=xxxxx
    2024-06-12 18:53:08,072 [ERROR] subscription-manager:5200:MainThread @managercli.py:217 - Error during registration: [Errno -2] Name or service not known
    2024-06-12 18:53:08,072 [ERROR] subscription-manager:5200:MainThread @managercli.py:218 - [Errno -2] Name or service not known
    
  • yum update fails with Error communicating with server. The message was Name or service unknown

Resolution

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.rhsm.redhat.com
    
    # Server prefix:
    prefix = /subscription
    
  • Once the DNS issue is resolved, try again to register system.

Root Cause

  • The system was not able to resolve the Red Hat hostname due to DNS configiration issue on the client.
  • 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 subscription.rhsm.redhat.com 443
    # telnet cdn.redhat.com 443
    # nc -v subscription.rhsm.redhat.com 443
    # nc -v cdn.redhat.com 443
    # curl -v https://subscription.rhsm.redhat.com/subscription/ --cacert /etc/rhsm/ca/redhat-uep.pem          
    

For system registered with Red Hat Subscription Manager

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

    [server]
    # Server hostname:
    hostname = subscription.rhsm.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