Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0.0] converting CentOS 7 to RHEL 7 fails with an python error #1269

Open
mdc-webdb opened this issue Jun 19, 2024 · 11 comments
Open

[2.0.0] converting CentOS 7 to RHEL 7 fails with an python error #1269

mdc-webdb opened this issue Jun 19, 2024 · 11 comments

Comments

@mdc-webdb
Copy link

call:
convert2rhel analyze --no-rpm-va --debug
fails with:

[2024-06-19T06:38:57+0000] TASK - [Prepare: Subscription Manager - Subscribe system] *****************
Registering the system using subscription-manager ...
Unregistering the system to clear the server's state for our registration.
Unregistering the system.
[2024-06-19T06:38:57+0000] DEBUG - Calling command 'rpm --quiet -q subscription-manager'
[2024-06-19T06:38:57+0000] DEBUG - Calling command 'subscription-manager unregister'
WARNING - System unregistration result:
Traceback (most recent call last):
File "/sbin/subscription-manager", line 9, in
load_entry_point('subscription-manager==1.24.54', 'console_scripts', 'subscription-manager')()
File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 86, in main
return managercli.ManagerCLI().main()
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 3181, in init
CLI.init(self, command_classes=commands)
File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 101, in init
cmd = clazz()
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1642, in init
attr='addons', commands=['unset', 'add', 'remove'])
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 611, in init
self.store = self._get_synced_store()
File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 647, in _get_synced_store
return SyncedStore(uep=uep, consumer_uuid=self.identity.uuid)
File "/usr/lib/python2.7/site-packages/syspurpose/files.py", line 251, in init
self.local_contents = self.get_local_contents()
File "/usr/lib/python2.7/site-packages/syspurpose/files.py", line 331, in get_local_contents
self.update_local({})
File "/usr/lib/python2.7/site-packages/syspurpose/files.py", line 368, in update_local
return self.update_file(self.path, data)
File "/usr/lib/python2.7/site-packages/syspurpose/files.py", line 501, in update_file
f = io.open(path, mode, encoding='utf-8')
IOError: [Errno 2] No such file or directory: '/etc/rhsm/syspurpose/syspurpose.json'

Stopping the RHSM service so that registration does not think that the host is already registered.
[2024-06-19T06:38:57+0000] DEBUG - Calling command '/bin/systemctl stop rhsm'
RHSM service stopped.
Gathering subscription-manager registration info ...
... organization detected
... activation key detected
Restoring /etc/os-release from backup
[2024-06-19T06:38:57+0000] DEBUG - File /etc/os-release restored.
[2024-06-19T06:38:57+0000] DEBUG - Getting a handle to the system dbus
[2024-06-19T06:38:57+0000] DEBUG - Getting a subscription-manager RegisterServer object from dbus
[2024-06-19T06:38:57+0000] DEBUG - Starting a private DBus to talk to subscription-manager
[2024-06-19T06:38:57+0000] DEBUG - Connecting to the private DBus
Organization: *****
Activation Key: *****
Connection Options: dbus.Dictionary({}, signature=dbus.Signature('sv'), variant_level=1)
Locale settings: C
[2024-06-19T06:38:57+0000] DEBUG - Shutting down private DBus instance
System registration failed with error: com.redhat.RHSM1.Error: {"exception": "ValidationError", "message": "Dieses System ist bereits registriert. Optionen zum \u00dcberschreiben verleihen Sie Kraft.", "severity
": "error"}

@hosekadam
Copy link
Member

Hello!

I wasn't able to reproduce this situation. But it feels to me like subscription-manager problem more than problem of convert2hel.

From Dieses System ist bereits registriert. I think the system was registered prior to the conversion, so the subscription-manager was already installed.

Could you share the full convert2rhel log (can be found in /var/log/convert2rhel/convert2rhel.log) or if you don't feel comfortable sharing it here, you can create Jira issue in our project: https://issues.redhat.com/projects/RHELC/summary (unfortunately, the provider of the Jira has some outages now) and add the log there.

Thanks!

@mdc-webdb
Copy link
Author

Because https://issues.redhat.com/projects/RHELC/summary is current broken, I have added the log files here.
log.tar.gz

@mdc-webdb
Copy link
Author

When I simple create the missing syspurpose.json via:

mkdir -p /etc/rhsm/syspurpose
touch /etc/rhsm/syspurpose/syspurpose.json

Then no python exception will occurs, but another error message:

[2024-06-19T13:53:44+0000] TASK - [Prepare: Subscription Manager - Disable all repositories] *********
CRITICAL - Could not disable subscription-manager repositories:
This system has no repositories available through subscriptions.

ERROR - (ERROR) SUBSCRIBE_SYSTEM::FAILED_TO_DISABLE_SUBSCRIPTION_MANAGER_REPOSITORIES - Could not disable repositories through subscription-manager.
Description: As part of the conversion process, convert2rhel disables all current subscription-manager repositories and enables only repositories required for the conversion. convert2rhel was unable to disable
these repositories, and the conversion is unable to proceed.
Diagnosis: Failed to disable repositories: This system has no repositories available through subscriptions.
.
Remediations: N/A

ERROR - Skipped ENSURE_KERNEL_MODULES_COMPATIBILITY. Skipped because SUBSCRIBE_SYSTEM was not successful
ERROR - Skipped VALIDATE_PACKAGE_MANAGER_TRANSACTION. Skipped because ENSURE_KERNEL_MODULES_COMPATIBILITY and SUBSCRIBE_SYSTEM were not successful
Writing breadcrumbs to '/etc/migration-results'.
Writing RHSM custom facts to '/etc/rhsm/facts/convert2rhel.facts'.
WARNING - Abnormal exit! Performing rollback .

@hosekadam
Copy link
Member

Looked over it and I'm able to reproduce it.

The problem is, that you have missing /etc/rhsm/syspurpose and /etc/rhsm/syspurpose/valid_fields.json. This will result in this type of error of missing the /etc/rhsm/syspurpose/syspurpose.json (and that's why I wasn't able to reproduce it - removing just the /etc/rhsm/syspurpose/syspurpose.json won't cause the error).

What helped me in the testing env was to reinstall the yum reinstall python-syspurpose package which owns those files. But I don't know why you don't have those on your system and if it could have some side effects.

Overall after reinstalling the python-syspurpose the unregistration should work.

@mdc-webdb
Copy link
Author

An reinstall of if will not fix it :(
After:
yum reinstall python-syspurpose
/etc/rhsm/syspurpose/syspurpose.json will be an empty json file containing only "{}".
But the error of "convert2rhel analyze" will be same as on #1269 (comment)
The error message is also totally bizarre.

This system has no repositories available through subscriptions.
Failed to disable repositories: This system has no repositories available through subscriptions.

How can something be disabled that is not there?
And there is no repo stored for the activation_key, as the website says that this is not necessary as the basic repos are always active.

@hosekadam
Copy link
Member

Hmm, I think there must be at least rhel-7-server-rpms available, otherwise you don't have access to the basic RHEL packages. And when we don't have access, we cannot try to do dry-run of transaction for replacing the packages (basically check if there are not any dependency issues). What's your source?

How can something be disabled that is not there?

The thing is, that we expect something to be here. Then we disable all of them and after that enable the needed ones. So you should see something like (with --debug):

[2024-06-19T12:55:40+0000] TASK - [Prepare: Subscription Manager - Disable all repositories] *********
[2024-06-19T12:55:40+0000] DEBUG - Calling command 'subscription-manager repos --list-enabled'
[2024-06-19T12:55:55+0000] DEBUG - Repositories enabled in the system prior to the conversion: rhel-7-server-rpms

But the error of "convert2rhel analyze" will be same as on #1269 (comment)

Yeah, sorry, I was writing the message already, haven't seen this one before sending it. But overall we moved, it's different problem than the first one.

@mdc-webdb
Copy link
Author

Yes, that's another one.
Unfortunately, it is not possible to log in to the administration portal because RH has a "small" problem with the access database. They have been trying to solve the problem for a week now. Therefore I only have the "activation key" and the "company id".

@mdc-webdb
Copy link
Author

mdc-webdb commented Jun 20, 2024

Yes it will be an problem with the activation key. Using another, the repo part will works.
But the part "Validate the yum transaction" fails without showing an error:

Running Transaction Check
Successfully validated the yum transaction set.
VALIDATE_PACKAGE_MANAGER_TRANSACTION has succeeded
Writing breadcrumbs to '/etc/migration-results'.
Writing RHSM custom facts to '/etc/rhsm/facts/convert2rhel.facts'.
WARNING - Abnormal exit! Performing rollback ...

But /etc/rhsm/facts/convert2rhel.facts notes:

{
    "conversions.executed": "/bin/convert2rhel analyze", 
    "conversions.target_os": "null", 
    "conversions.env": "null", 
    "conversions.packages.0.nevra": "0:convert2rhel-2.0.0-1.el7.noarch", 
    "conversions.version": "1", 
    "conversions.activity_ended": "2024-06-20T06:33:40.141502Z", 
    "conversions.run_id": "null", 
    "conversions.source_os.name": "CentOS Linux", 
    "conversions.packages.0.signature": "RSA/SHA256, Thu May 30 19:31:23 2024, Key ID 199e2f91fd431d51", 
    "conversions.source_os.version": "7.9", 
    "conversions.activity": "analysis", 
    "conversions.activity_started": "2024-06-20T06:23:33.881678Z", 
    "conversions.success": true, 
    "conversions.source_os.id": "Core"
}

@hosekadam
Copy link
Member

I know this can be a bit confusing, but the WARNING - Abnormal exit! Performing rollback ... is fine in this situation. We have a ticket for this, to change the message to something better. This is the situation, when you are doing analysis and do not want to continue to the conversion - we raise an exception to stop in the right place and this message is part of its handling.

The important thing for you is the [Pre-conversion analysis report]. It is printed in the end of the log and contains a complete summary - if there are some problems, info, etc. So at the bottom, you should see something like:

[2024-06-19T13:01:07+0000] TASK - [Pre-conversion analysis report] ***********************************

========== Success (No changes needed) ==========
(SUCCESS) CHECK_FIREWALLD_AVAILABILITY::SUCCESS - N/A
(SUCCESS) IS_LOADED_KERNEL_LATEST::SUCCESS - N/A
(SUCCESS) CUSTOM_REPOSITORIES_ARE_VALID::SUCCESS - N/A
(SUCCESS) VALIDATE_PACKAGE_MANAGER_TRANSACTION::SUCCESS - N/A
(SUCCESS) BACKUP_REPOSITORY::SUCCESS - N/A
.
.
.

@mdc-webdb
Copy link
Author

Yes, under I also see "Success (No changes needed)". And the convert was working.

@hosekadam
Copy link
Member

So you converted your system successfully? Great! I'm happy I was able to help you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants