Bug 1696822

Summary: Installed multiarch libraries results in incorrect package selection
Product: [Community] Virtualization Tools Reporter: bob
Component: superminAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: bob, ptoscano, rjones
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: 2019-04-15 09:44:16 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:
Attachments:
Description Flags
libguestfs-test-tool
none
supermin
none
libguestfs-test-tool
none
supermin
none
rpm -qa none

Description bob 2019-04-05 17:08:19 UTC
Description of problem:
Supermin appliances would panic as init was unable to load libgcc_s.so. Eventually I noticed that supermin was selecting libgcc.i686 instead of libgcc.x86_64 and uninstalling libgcc.i686 resolved the issue.

Version-Release number of selected component (if applicable):
supermin-5.1.20-2.fc29.x86_64

How reproducible:
Always, provided libgcc.i686 is installed.

Steps to Reproduce:
1. dnf install libgcc.i686
2. guestfish -i

Actual results:
Appliance kernel panic

Expected results:
Appliance boots and runs normally

Comment 1 Richard W.M. Jones 2019-04-08 16:57:50 UTC
Sorry for the delayed reply.  I cannot reproduce this, but there are a couple of commands you
could run which will collect more information for us:

libguestfs-test-tool

supermin --build -v -v -v --copy-kernel -f ext2 --host-cpu x86_64 /usr/lib64/guestfs/supermin.d -o /var/tmp/test

Please attach the *complete* output from both to the BZ.

Comment 2 bob 2019-04-10 15:58:17 UTC
Created attachment 1554288 [details]
libguestfs-test-tool

Comment 3 bob 2019-04-10 15:59:27 UTC
Created attachment 1554289 [details]
supermin

Comment 4 Richard W.M. Jones 2019-04-10 16:07:35 UTC
It's certainly picking the wrong package, although I'm not very clear why.  The logic
in the RPM code here is convoluted.
https://github.com/libguestfs/supermin/tree/master/src

Comment 5 Pino Toscano 2019-04-10 16:09:15 UTC
It looks like libgcc is installed both as i686 and x86_64, and that supermin picks the i686 version to resolve the dependencies.
Most probably it ought to use only either packages of the same architecture, or noarch packages.

I'll take a look at it.

Comment 6 Pino Toscano 2019-04-11 12:27:34 UTC
I cannot reproduce the issue, even with a similar environment (native libguestfs x86_64, and i686 multilib packages for libgcc & glibc).
A possible idea is that your libgcc.x86_64 is older than the libgcc.x86_64 version.
Can you please attach the output of `rpm -qa | sort`?

Comment 7 bob 2019-04-11 16:02:16 UTC
Sorry for being a pain in the neck, but I feel somewhat uncomfortable attaching that information. However, I have been able to reproduce the issue in a fresh VM, so I'll attach new debug logs and the package listing from there.

Installed supermin is the same: supermin-5.1.20-2.fc29.x86_64

Comment 8 bob 2019-04-11 16:03:05 UTC
Created attachment 1554590 [details]
libguestfs-test-tool

Comment 9 bob 2019-04-11 16:10:28 UTC
Created attachment 1554592 [details]
supermin

Comment 10 bob 2019-04-11 16:11:49 UTC
Created attachment 1554593 [details]
rpm -qa

Comment 11 bob 2019-04-11 16:14:45 UTC
FWIW, the problem is resolved by upgrading the libgcc.x86_64 package

Comment 12 Pino Toscano 2019-04-11 16:19:18 UTC
(In reply to bob from comment #10)
> Created attachment 1554593 [details]
> rpm -qa

libgcc-8.2.1-2.fc29.x86_64
libgcc-8.3.1-2.fc29.i686

As I suspected: your libgcc.x86_64 was older than the libgcc.x86_64 version.
I will change supermin to always prefer the higher version of the same architecture, rather than the higher version of all the installed architectures.

Comment 13 Pino Toscano 2019-04-12 10:58:51 UTC
Indeed, the way RPM packages are sorted was buggy.
This patch series should hopefully fix this issue:
https://www.redhat.com/archives/libguestfs/2019-April/msg00094.html

Thanks for the report.