oamg / convert2rhel

A tool to automate converting Oracle/CentOS/Scientific/Rocky/Alma Linux to Red Hat Enterprise Linux

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

_check_internet_access() in systeminfo.py may fail to return value

lees07 opened this issue · comments

When I run convert2rhel in disconnected environment, there is error occured, the convert process can't continue.
The logs are below:
[01/06/2023 11:34:25] TASK - [Prepare: Gather system information] *******************************
[01/06/2023 11:34:25] FILE - Calling command 'uname -i'
Skipping the execution of 'rpm -Va'.
[01/06/2023 11:34:25] FILE - Calling command 'uname -r'
[01/06/2023 11:34:25] FILE - Booted kernel VRA (version, release, architecture): 3.10.0-1160.el7.x86_64
Checking internet connectivity using address 'http://static.redhat.com/test/rhel-networkmanager.txt'.
[01/06/2023 11:34:26] FILE - Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/convert2rhel/main.py", line 90, in main
systeminfo.system_info.resolve_system_info()
File "/usr/lib/python2.7/site-packages/convert2rhel/systeminfo.py", line 127, in resolve_system_info
self.has_internet_access = self._check_internet_access()
File "/usr/lib/python2.7/site-packages/convert2rhel/systeminfo.py", line 389, in _check_internet_access
response = urllib.request.urlopen(CHECK_INTERNET_CONNECTION_ADDRESS)
File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python2.7/urllib2.py", line 431, in open
response = self._open(req, data)
File "/usr/lib64/python2.7/urllib2.py", line 449, in _open
'_open', req)
File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib64/python2.7/urllib2.py", line 1244, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib64/python2.7/urllib2.py", line 1217, in do_open
r = h.getresponse(buffering=True)
File "/usr/lib64/python2.7/httplib.py", line 1128, in getresponse
response.begin()
File "/usr/lib64/python2.7/httplib.py", line 453, in begin
version, status, reason = self._read_status()
File "/usr/lib64/python2.7/httplib.py", line 409, in _read_status
line = self.fp.readline(_MAXLINE + 1)
File "/usr/lib64/python2.7/socket.py", line 476, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 104] Connection reset by peer

Writing breadcrumbs to '/etc/migration-results'.
[01/06/2023 11:34:26] FILE - Prior migration log: {"activities": [{"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:16:22.387992Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:17:48.515418Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:20:01.544640Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:25:14.877480Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:35:52.691630Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:40:08.781060Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:43:07.159313Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:43:22.897346Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:47:32.791511Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:59:34.084117Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:05:37.442019Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:07:45.204848Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:11:13.638941Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:11:30.562953Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:11:35.013192Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:16:06.802146Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-06T03:32:42.564620Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}]}
[01/06/2023 11:34:26] FILE - Updated migration log: {"activities": [{"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:16:22.387992Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:17:48.515418Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:20:01.544640Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:25:14.877480Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:35:52.691630Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:40:08.781060Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:43:07.159313Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:43:22.897346Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:47:32.791511Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T06:59:34.084117Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:05:37.442019Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:07:45.204848Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:11:13.638941Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:11:30.562953Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:11:35.013192Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-04T07:16:06.802146Z", "target_os": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "activity_started": "null"}, {"executed": "null", "success": false, "run_id": "null", "activity_ended": "2023-01-06T03:32:42.564620Z", "activity_started": "null", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null"}, {"executed": "null", "run_id": "null", "packages": [{"nevra": "null", "signature": "null"}], "target_os": "null", "success": false, "activity_ended": "2023-01-06T03:34:26.248100Z", "version": "1", "env": {}, "activity": "conversion", "source_os": "null", "activity_started": "null"}]}
Writing RHSM custom facts to '/etc/rhsm/facts/convert2rhel.facts'.
WARNING - Unable to find RHSM facts folder at '/etc/rhsm/facts'.
No changes were made to the system.

Hi, @lees07! Thanks for opening this issue for us (and welcome, of course!).

I think I might know what is going wrong here. Probably we are not catching some exceptions that could be thrown during this check, this way, it just fails for you with this horrible message. I will follow up with @SpyTec to track this bug down and propose a fix in the next few days.

In the meantime, could you expand a bit how you got go this scenario? I mean, were you disconnected from the internet entirely, or do you have some sort of firewall, rule, or anything like that, that prevents access to the external websites? Any information that can help us reproduce the error locally would be nice 😄.

Hello, @r0x0d !
There are some network security equipments(gateway) to drop tcp packets to prevent internet access in the disconnected environment.
So, catch exception in urllib or set default "False" value to parameter "has_internet_access" could fix the issue.
But I recommend to add parameter in command line "convert2rhel" to set "has_internet_access" value manually, because each enterprise customers' network environment is very complex, you may not catch all exceptions correctly, but the operators will know if the machine can access internet.
Thanks,
LSHU

Hi @lees07. We might have fixed this in v1.1 due to #587. We released it downstream only on Jan 4th so just curious if this bug is present in v1.1 or not

Could you give me the version you used?

Hello, @r0x0d ! There are some network security equipments(gateway) to drop tcp packets to prevent internet access in the disconnected environment. So, catch exception in urllib or set default "False" value to parameter "has_internet_access" could fix the issue. But I recommend to add parameter in command line "convert2rhel" to set "has_internet_access" value manually, because each enterprise customers' network environment is very complex, you may not catch all exceptions correctly, but the operators will know if the machine can access internet. Thanks, LSHU

Thanks for the suggestion, @lees07! I agree with you, it would be very difficult to determine all the ways to check against internet connection access. I will create a Jira issue in the next days to track this down and validate that with the team.

Hi @lees07. We might have fixed this in v1.1 due to #587. We released it downstream only on Jan 4th so just curious if this bug is present in v1.1 or not

Could you give me the version you used?

From the looks of the logs (failures) it seems it's using v1.1.

Hello, @r0x0d and @SpyTec ,
Yes, the issue occurs in v1.1, converting centos 7.9 to rhel 7.9.

regards,
LSHU

Thanks for the info! I'll let you know soon whether we can make it for the next release