Leapp preupgrade error: exception in Actor remove_obsolete_gpg_keys

Problem:
Hello brain trust I’m getting an exception following the instructions in the 3.12 upgrade guide to upgrade from CentOS Stream 8 to Stream 9.

leapp preupgrade failed with:

====> * remove_obsolete_gpg_keys
        Remove obsoleted RPM GPG keys.
Process Process-303:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
...
  File "/etc/leapp/repos.d/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py", line 16, in _get_obsolete_keys
    for key in obsoleted_keys_map[str(version)]:
KeyError: '7'

Expected outcome:
Exception handling - maybe do a obsoleted_keys_map.get(str(version)) and check value for issues?

Foreman and Proxy versions:

  • foreman-3.12.0-1.el8.noarch
  • foreman-proxy-3.12.0-1.el8.noarch
  • katello-4.14.0-1.el8.noarch

Foreman and Proxy plugin versions:

foreman-proxy-3.12.0-1.el8.noarch
foreman-selinux-3.12.0-1.el8.noarch
foreman-debug-3.12.0-1.el8.noarch
katello-selinux-5.0.2-1.el8.noarch
katello-common-4.14.0-1.el8.noarch
foreman-installer-3.12.0-1.el8.noarch
katello-4.14.0-1.el8.noarch
foreman-redis-3.12.0-1.el8.noarch
foreman-cli-3.12.0-1.el8.noarch
katello-repos-4.14.0-1.el8.noarch
foreman-3.12.0-1.el8.noarch
katello-debug-4.14.0-1.el8.noarch
foreman-libvirt-3.12.0-1.el8.noarch
katello-client-bootstrap-1.7.9-2.el8.noarch
katello-certs-tools-2.10.0-1.el8.noarch
foreman-release-3.12.0-1.el8.noarch
foreman-postgresql-3.12.0-1.el8.noarch
foreman-dynflow-sidekiq-3.12.0-1.el8.noarch
foreman-installer-katello-3.12.0-1.el8.noarch
foreman-service-3.12.0-1.el8.noarch
foreman-obsolete-packages-1.10-1.el8.noarch

Distribution and version:

CentOS Stream 8. Running behind a firewall, with proxy access to the internet.

Other relevant data:
From /var/log/leapp/leapp-preupgrade.log:

2024-10-03 02:02:43.74  ERROR    PID: 5353 leapp.workflow.FactsCollection: Actor remove_obsolete_gpg_keys has crashed: Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/leapp/repository/actor_definition.py", line 74, in _do_run
    actor_instance.run(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/leapp/actors/__init__.py", line 296, in run
    self.process(*args)
  File "/etc/leapp/repos.d/system_upgrade/common/actors/removeobsoletegpgkeys/actor.py", line 24, in process
    removeobsoleterpmgpgkeys.process()
  File "/etc/leapp/repos.d/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py", line 35, in process
    keys = _get_obsolete_keys()
  File "/etc/leapp/repos.d/system_upgrade/common/actors/removeobsoletegpgkeys/libraries/removeobsoleterpmgpgkeys.py", line 16, in _get_obsolete_keys
    for key in obsoleted_keys_map[str(version)]:
KeyError: '7'

2024-10-03 02:02:43.119 INFO     PID: 5353 leapp: Answerfile will be created at /var/log/leapp/answerfile
2024-10-03 02:02:43.125 WARNING  PID: 5353 leapp.reporting: Stable Key report entry not provided, dynamically generating one - 051ff352d7441a0d1d54c449684e1ef44f730585
2024-10-03 02:02:43.135 WARNING  PID: 5353 leapp.reporting: Stable Key report entry not provided, dynamically generating one - 051ff352d7441a0d1d54c449684e1ef44f730585

Same error shown in /var/log/leapp/leapp-report.txt.

Am I doing something stupid?

No, it’s a bug I fixed later (don't require all versions to be defined for obsoleted keys by evgeni · Pull Request #1285 · oamg/leapp-repository · GitHub, properly scope try/except when loading obsoleted keys by evgeni · Pull Request #1286 · oamg/leapp-repository · GitHub), but didn’t backport to the packages we offer. Sorry!

The easiest thing for you is to edit /usr/share/leapp-repository/repositories/system_upgrade/common/files/distro/centos/gpg-signatures.json to have entries in obsoleted-keys like this:

   "obsoleted-keys": {
       "7": [],
       "8": [],
       "9": []
   }

As an alternative – apply the patches :slight_smile:

1 Like