Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2151424

Summary: convert2rhel fails with "ValueError: need more than 1 value to unpack"
Product: Red Hat Enterprise Linux 7 Reporter: Pradeep Jagtap <prjagtap>
Component: convert2rhelAssignee: Michal Bocek <mbocek>
Status: CLOSED ERRATA QA Contact: Upgrades and Supportability <upgrades-and-supportability>
Severity: medium Docs Contact: Miriam Portman <mportman>
Priority: unspecified    
Version: 7.9CC: ddiblik, fgustavs, mbocek
Target Milestone: rcFlags: pm-rhel: mirror+
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: 2023-03-14 10:10:55 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 Pradeep Jagtap 2022-12-07 03:58:58 UTC
Description of problem:
========================
Convert2rhel fails with below traceback and message 

Message:
----------
Repo convert2rhel-for-rhel-7-rpms forced skip_if_unavailable=True due to: /etc/rhsm/ca/redhat-uep.pem

Traceback:
-----------
FILE - Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/convert2rhel/main.py", line 94, in main
    checks.perform_pre_checks()
  File "/usr/lib/python2.7/site-packages/convert2rhel/checks.py", line 68, in perform_pre_checks
    is_loaded_kernel_latest()
  File "/usr/lib/python2.7/site-packages/convert2rhel/checks.py", line 661, in is_loaded_kernel_latest
    _, latest_kernel, repoid = packages[0]
ValueError: need more than 1 value to unpack

No changes were made to the system.

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

How reproducible:
===================

Steps to Reproduce:
1. Start conversion
          # convert2rhel -h

2. Proceed with yes option for below tasks:
         TASK - [Convert: Remove excluded packages]
         Continue with the system conversion? [y/n]: y

         TASK - [Convert: Subscription Manager - Replace]
         Continue with the system conversion? [y/n]: y

3. Now subscription-manager packages would be installed and system would be registered

4. Once system is registered and you get confirmation request for below task. Here provide n option to roll back transaction
         TASK - [Convert: Remove packages containing .repo files]
         Continue with the system conversion? [y/n]: n

5. Now if you rerun convert2rhel it does not proceed.

Actual results:
=================
1. Last Messages on the console/terminal
---------8<---------8<---------8<---------8<
[12/07/2022 09:23:06] TASK - [Prepare: Checking if the installed packages are up-to-date] *******
Loaded plugins: fastestmirror
Repo convert2rhel-for-rhel-7-rpms forced skip_if_unavailable=True due to: /etc/rhsm/ca/redhat-uep.pem
Loading mirror speeds from cached hostfile
 * base: mirror.myfahim.com
 * extras: mirrors.nhanhoa.com
 * updates: mirror.myfahim.com
System is up-to-date.

[12/07/2022 09:23:13] TASK - [Prepare: Checking if the loaded kernel version is the most recent] 
No changes were made to the system.

---------8<---------8<---------8<---------8<

2. Traceback in /var/log/convert2rhel/convert2rhel.log
---------8<---------8<---------8<---------8<
[12/07/2022 09:23:13] TASK - [Prepare: Checking if the loaded kernel version is the most recent] 
[12/07/2022 09:23:13] FILE - Calling command 'repoquery --quiet --qf "%{BUILDTIME}\t%{VERSION}-%{RELEASE}\t%{REPOID}" kernel'
[12/07/2022 09:23:13] FILE - Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/convert2rhel/main.py", line 94, in main
    checks.perform_pre_checks()
  File "/usr/lib/python2.7/site-packages/convert2rhel/checks.py", line 68, in perform_pre_checks
    is_loaded_kernel_latest()
  File "/usr/lib/python2.7/site-packages/convert2rhel/checks.py", line 661, in is_loaded_kernel_latest
    _, latest_kernel, repoid = packages[0]
ValueError: need more than 1 value to unpack
---------8<---------8<---------8<---------8<


Expected results:
==================
Should be able to run convert2rhel again.

Comment 3 Pradeep Jagtap 2022-12-07 04:06:18 UTC
Workaround:

When convert2rhel rollback occurs, convert2rhel unregisters the system and removes subscription-manager, subscription-manager-rhsm-certificates and subscription-manager-rhsm packages
In this process, the /etc/rhsm/ca/redhat-uep.pem file is removed. (as part of subscription-manager-rhsm-certificates package removal)

Now before running convert2rhel again, we also need to download the SSL certificate which resolves the issue.
       # curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem

Comment 5 Michal Bocek 2022-12-12 16:27:46 UTC
    [root@hosting01 ~]# repoquery --quiet --qf "%{BUILDTIME}\t%{VERSION}-%{RELEASE}\t%{REPOID}" kernel
    Repo convert2rhel-for-rhel-7-rpms forced skip_if_unavailable=True due to: /etc/rhsm/ca/redhat-uep.pem    <----- this line is creating mess
    1667923576      3.10.0-1160.80.1.el7    updates

Thanks, Pradeep, for the investigation. 

Indeed, our code is unable to handle this line of the repoquery output. The https://github.com/oamg/convert2rhel/pull/557 (https://issues.redhat.com/browse/RHELC-689) is not going to fix that. It's merely going to print out the repoquery output so that the user has more information on how to proceed/what went wrong, instead of seeing a traceback.

My suggestion to fix the issue in a more generic way so that we parse only the messages containing the information about the available kernels. Currently we exclude from parsing only lines that contain "listed more than once in the configuration" but that is too specific: https://github.com/oamg/convert2rhel/blob/v1.1/convert2rhel/checks.py#L753.

Comment 8 Daniel Diblik 2023-03-09 17:31:26 UTC
The bug was verified as a part of automated test suite on versions *convert2rhel-1.1-1.el7.noarch.rpm*/*convert2rhel-1.1-1.el8.noarch.rpm* and *convert2rhel-1.2-2.el7.noarch.rpm*/*convert2rhel-1.2-2.el8.noarch.rpm* with their respective results provided in the JIRA issue comments due to BZ comment limitations.

See: https://issues.redhat.com/browse/RHELC-829?focusedCommentId=21861583&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-21861583

Comment 10 errata-xmlrpc 2023-03-14 10:10:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (convert2rhel bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2023:1197