Satellite 6 : virt-who fails with gaierror: [Errno -2] Name or service not known
Environment
Red Hat Satellite 6
virt-who
Issue
In satellite 6, the virt-who failed to start with the below error:
gaierror: [Errno -2] Name or service not known
MainProcess(111282):MainThread @executor.py:terminate:222 - virt-who is shutting down
Resolution
- Check virt-who configuration file from /etc/virt-who.d/x.conf and make sure the rhsm_hostname is not specified with "https://satellite-hostname".
rshm_hostname in the virt-who configuration file should be only hostname not Content from hostname is not included.https://hostname/
for example:
rhsm_hostname=https://satellite.hostname
Instead it should be :
rhsm_hostname=satellite.hostname
For more KB articles/solutions related to Virt-who and Virtual Datacenter (VDC) Subscriptions Issues, please refer to the Consolidated Troubleshooting Article for Virt-who and Virtual Datacenter (VDC) Subscriptions Issues
Root Cause
The value specified in rhsm_hostname, counted as a FQDN .
So as a result, when we specify "https://satellite-hostname" , the full value including 'https' is counted as hostname. As a result it fails to resolve this name.
Diagnostic Steps
$ more rhsm.log :
2018-08-31 01:39:02,294 [virtwho.destination_-75142xxxxxx3434
DEBUG] MainProcess(111282):Thread-9 @virt.py:run:393 - Thread 'destination_-7514xxxxx58287734' terminated
2018-08-31 01:39:02,277 [virtwho.destination_781xxx328566452 ERROR] MainProcess(111282):Thread-8 @virt.py:run:388 - Thread 'destination_781016338xxx8566452' fails with exception:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 379, in run
self._run()
File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 335, in _run
self._send_data(data_to_send)
File "/usr/lib/python2.7/site-packages/virtwho/virt/virt.py", line 623, in _send_data
options=self.options)
File "/usr/lib/python2.7/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 238, in hypervisorCheckIn
connection = self._connect(report.config)
File "/usr/lib/python2.7/site-packages/virtwho/manager/subscriptionmanager/subscriptionmanager.py", line 197, in _connect
if not self.connection.ping()['result']:
File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 929, in ping
return self.conn.request_get("/status/")
File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 690, in request_get
return self._request("GET", method, headers=headers)
File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 716, in _request
info=info, headers=headers)
File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 555, in _request
conn.request(request_type, handler, body=body, headers=final_headers)
File "/usr/lib64/python2.7/httplib.py", line 1041, in request
self._send_request(method, url, body, headers)
File "/usr/lib64/python2.7/httplib.py", line 1075, in _send_request
self.endheaders(body)
File "/usr/lib64/python2.7/httplib.py", line 1037, in endheaders
self._send_output(message_body)
File "/usr/lib64/python2.7/httplib.py", line 881, in _send_output
self.send(msg)
File "/usr/lib64/python2.7/httplib.py", line 843, in send
self.connect()
File "/usr/lib64/python2.7/httplib.py", line 1251, in connect
HTTPConnection.connect(self)
File "/usr/lib64/python2.7/httplib.py", line 824, in connect
self.timeout, self.source_address)
File "/usr/lib64/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known
2018-08-31 01:39:02,312 [virtwho.destination_781016338xxx6452 INFO] MainProcess(111282):Thread-8 @virt.py:_send_data:553 - Error report received
2018-08-31 01:39:02,314 [virtwho.destination_781016338xxxx452 DEBUG] MainProcess(111282):Thread-8 @virt.py:run:402 - Thread 'destination_78101633xxxx66452' stopped after running once
2018-08-31 01:39:02,322 [virtwho.destination_8880776689104931077 INFO] MainProcess(111282):Thread-11 @virt.py:_send_data:589 - Hosts-to-guests mapping for config "virt-who-config-5": 0 hypervisors and 0 guests found
2018-08-31 01:39:02,322 [virtwho.destination_8880xxxx104931077 DEBUG] MainProcess(111282):Thread-11 @virt.py:run:393 - Thread 'destination_8880776689104931077' terminated
2018-08-31 01:39:02,336 [virtwho.destination_-2423113xxxx2933148 INFO] MainProcess(111282):Thread-10 @virt.py:_send_data:589 - Hosts-to-guests mapping for config "virt-who-config-2": 0 hypervisors and 0 guests found
2018-08-31 01:39:02,337 [virtwho.destination_-2423113490932933148 DEBUG] MainProcess(111282):Thread-10 @virt.py:run:393 - Thread 'destination_-2423113490932933148' terminated
2018-08-31 01:39:05,248 [virtwho.main DEBUG] MainProcess(111282):MainThread @__main__.py:main:23 - virt-who terminated
2018-08-31 01:39:05,249 [virtwho.main DEBUG] MainProcess(111282):MainThread @executor.py:terminate:222 - virt-who is shutting down
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.