Bug 1830769

Summary: convert2rhel fails hard when GPG key is not imported
Product: [Fedora] Fedora EPEL Reporter: Till Maas <opensource>
Component: convert2rhelAssignee: Michal Bocek <mbocek>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: lkuprova, mbocek, opensource, till
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-28 14:50:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Till Maas 2020-05-03 18:39:34 UTC
Description of problem:

convert2rhel just fails when the GPG key is missing instead of allowing to import/continue after importing it:


Continue with the system conversion? [y/n]: y



[05/03/2020 20:34:41] TASK - [Convert: Prepare kernel] ******************************************
Installing RHEL kernel ...
[05/03/2020 20:34:41] DEBUG - Calling command 'yum install -y --disablerepo=*  --enablerepo=mnt_rhel  kernel'
Geladene Plugins: etckeeper, fastestmirror
Loading mirror speeds from cached hostfile
Abhängigkeiten werden aufgelöst
--> Transaktionsprüfung wird ausgeführt
---> Paket kernel.x86_64 0:3.10.0-1127.el7 markiert, um installiert zu werden
--> Abhängigkeit system-release wird für Paket kernel-3.10.0-1127.el7.x86_64 verarbeitet
--> Transaktionsprüfung wird ausgeführt
---> Paket redhat-release-server.x86_64 0:7.8-2.el7 markiert, um installiert zu werden
--> Abhängigkeitsauflösung beendet
--> Transaktionsprüfung wird ausgeführt
---> Paket kernel.x86_64 0:3.10.0-957.27.2.el7 markiert, um gelöscht zu werden
--> Abhängigkeitsauflösung beendet

Abhängigkeiten aufgelöst

================================================================================
 Package                  Arch      Version                 Paketquelle   Größe
================================================================================
Installieren:
 kernel                   x86_64    3.10.0-1127.el7         mnt_rhel       50 M
Entfernen:
 kernel                   x86_64    3.10.0-957.27.2.el7     @updates/7     63 M
Als Abhängigkeiten installiert:
 redhat-release-server    x86_64    7.8-2.el7               mnt_rhel       29 k

Transaktionsübersicht
================================================================================
Installieren  1 Paket (+1 Abhängiges Paket)
Entfernen     1 Paket

Gesamte Downloadgröße: 50 M


Downloading packages:
Warnung: /mnt/rhel/Packages/kernel-3.10.0-1127.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, Schlüssel-ID fd431d51: NOKEY
Öffentlicher Schlüssel für kernel-3.10.0-1127.el7.x86_64.rpm ist nicht installiert
--------------------------------------------------------------------------------
Gesamt                                              66 MB/s |  50 MB  00:00     


Öffentlicher Schlüssel für kernel-3.10.0-1127.el7.x86_64.rpm ist nicht installiert
[05/03/2020 20:34:56] CRITICAL - Error occured while attempting to install the RHEL kernel
[05/03/2020 20:34:56] DEBUG - Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/convert2rhel/main.py", line 86, in main
    post_ponr_conversion()
  File "/usr/lib/python2.7/site-packages/convert2rhel/main.py", line 189, in post_ponr_conversion
    pkghandler.preserve_only_rhel_kernel()
  File "/usr/lib/python2.7/site-packages/convert2rhel/pkghandler.py", line 353, in preserve_only_rhel_kernel
    needs_update = install_rhel_kernel()
  File "/usr/lib/python2.7/site-packages/convert2rhel/pkghandler.py", line 373, in install_rhel_kernel
    loggerinst.critical("Error occured while attempting to install the"
  File "/usr/lib/python2.7/site-packages/convert2rhel/logger.py", line 100, in critical
    sys.exit(1)
SystemExit: 1





Version-Release number of selected component (if applicable):
convert2rhel-0.9-1.el7.noarch

Comment 1 Till Maas 2020-05-03 18:48:32 UTC
Additional info: After this error, they system was broken so that convert2rhel cannot be called anymore because it seems to have removed /etc/system-release at this point.

Comment 2 Michal Bocek 2020-05-04 07:50:24 UTC
Hi Till, thanks for the report and sorry for the troubles. We know about the issue and we're working on it.

There are these three possible workarounds for now:
- import the RHEL GPG key before running the conversion
  `rpm --import /<mnt_rhel repo baseurl path>/RPM-GPG-KEY-redhat-release`
- add "gpgcheck=0" to the mnt_rhel repo definition
- add "gpgkey=file:///<mnt_rhel repo baseurl path>/RPM-GPG-KEY-redhat-release" to the mnt_rhel repo definition

Comment 4 Till Maas 2020-05-04 08:19:59 UTC
(In reply to Michal Bocek from comment #2)
> Hi Till, thanks for the report and sorry for the troubles. We know about the
> issue and we're working on it.
> 
> There are these three possible workarounds for now:
> - import the RHEL GPG key before running the conversion
>   `rpm --import /<mnt_rhel repo baseurl path>/RPM-GPG-KEY-redhat-release`
> - add "gpgcheck=0" to the mnt_rhel repo definition
> - add "gpgkey=file:///<mnt_rhel repo baseurl
> path>/RPM-GPG-KEY-redhat-release" to the mnt_rhel repo definition

Thanks, it would be great if you would add this info to the documentation at:

https://access.redhat.com/articles/2360841

Comment 5 Michal Bocek 2020-05-04 08:41:16 UTC
Indeed. We're on it.

Comment 6 Michal Bocek 2020-05-07 14:46:56 UTC
We've added the following to the documentation:
"Important: The convert2rhel utility currently does not import GPG keys automatically. To prevent a conversion failure, either import the RHEL GPG key (release key 2) before running convert2rhel, or ensure that yum skips the GPG key check by adding the gpgcheck=0 directive to the custom repository definitions."

Comment 7 Michal Bocek 2020-05-07 14:48:51 UTC
There's an upstream PR that should resolve the issue: https://github.com/oamg/convert2rhel/pull/31

Comment 8 Fedora Update System 2020-08-19 15:43:32 UTC
FEDORA-EPEL-2020-d0a4bcf7f1 has been submitted as an update to Fedora EPEL 6. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-d0a4bcf7f1

Comment 9 Fedora Update System 2020-08-20 02:08:21 UTC
FEDORA-EPEL-2020-baa69bfeef has been pushed to the Fedora EPEL 7 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-baa69bfeef

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2020-08-20 02:11:41 UTC
FEDORA-EPEL-2020-d0a4bcf7f1 has been pushed to the Fedora EPEL 6 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2020-d0a4bcf7f1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2020-08-22 01:52:51 UTC
FEDORA-EPEL-2020-baa69bfeef has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2020-08-26 15:12:23 UTC
FEDORA-EPEL-2020-d0a4bcf7f1 has been pushed to the Fedora EPEL 6 stable repository.
If problem still persists, please make note of it in this bug report.