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 2158431 - Virt-what does not return correct result when running inside a container using podman
Summary: Virt-what does not return correct result when running inside a container usin...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: virt-what
Version: 9.2
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: YongkuiGuo
URL:
Whiteboard:
Depends On: 2155233
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-01-05 12:54 UTC by Richard W.M. Jones
Modified: 2023-05-09 10:40 UTC (History)
7 users (show)

Fixed In Version: virt-what-1.25-2.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2155233
Environment:
Last Closed: 2023-05-09 08:24:47 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-144016 0 None None None 2023-01-05 12:56:33 UTC
Red Hat Product Errata RHBA-2023:2557 0 None None None 2023-05-09 08:24:52 UTC

Description Richard W.M. Jones 2023-01-05 12:54:55 UTC
+++ This bug was initially created as a clone of Bug #2155233 +++

Description of problem:
When running a ubi8/ubi-init:8.7 container using podman virt-what does not detect that RHEL is running inside a container when we try to register the system using the subscription manager the system is registered as physical machine.

Version-Release number of selected component (if applicable):
This behavior does not happen on ubi8/ubi-init:8.7 container. IT happens only using virt-what 1.25

How reproducible:
run a ubi8/ubi-init:8.7 using podman and execute virt-what

Steps to Reproduce:
1.Start a ubi8/ubi-init:8.7
2.Run virt-what

Actual results:
#virt-what

returns empty output and return code 0

Expected results:
#virt-what
oci

returns oci (or other container engine) and return code 0

Additional info:
This behavior happens only using podman, the container workss properly using docker-ce.

A patch for the issue is attached, it simply adds oci among other possible options.

--- Additional comment from YongkuiGuo on 2022-12-21 02:55:43 UTC ---

Hi, Alessandro

I can not reproduce this issue with the following steps:

On my rhel8.8 host:
# podman pull ubi8/ubi-init:8.7
# podman run -it ubi8/ubi-init:8.7 /bin/bash
[root@fa4c3c1ba2a1 /]# virt-what
podman
[root@fa4c3c1ba2a1 /]# rpm -q virt-what
virt-what-1.25-1.el8.x86_64


The output of virt-what is podman. I think it's expected according to the man page.

# man virt-what
...
podman
           This is a Podman container.

Is there anything I missed?

--- Additional comment from Richard W.M. Jones on 2022-12-22 10:27:06 UTC ---

Definitely going to need exact steps to reproduce this, so setting needinfo.

--- Additional comment from Alessandro Valentini on 2022-12-29 09:21:52 UTC ---



--- Additional comment from Alessandro Valentini on 2022-12-29 09:26:41 UTC ---

We face this issue on Fedora 37 with podman, which we use as development.

Environment
# podman --version
podman version 4.3.1
# cat /etc/redhat-release
Fedora release 37 (Thirty Seven)

Steps to reproduce

Run the container:
# podman pull ubi8/ubi-init:8.7
# podman run -it ubi8/ubi-init:8.7 /bin/bash

Inside the container
[root@96d2e63f6cd9 /]# virt-what
[root@96d2e63f6cd9 /]# echo $?
0
[root@96d2e63f6cd9 /]# subscription-manager status
+-------------------------------------------+
System Status Details
+-------------------------------------------+
Overall Status: Unknown
System Purpose Status: Unknown

If we subscribe the container it is recognized as physical system.

--- Additional comment from YongkuiGuo on 2023-01-03 05:40:21 UTC ---

(In reply to Alessandro Valentini from comment #5)
> We face this issue on Fedora 37 with podman, which we use as development.
> 
> Environment
> # podman --version
> podman version 4.3.1
> # cat /etc/redhat-release
> Fedora release 37 (Thirty Seven)
> 
> Steps to reproduce
> 
> Run the container:
> # podman pull ubi8/ubi-init:8.7
> # podman run -it ubi8/ubi-init:8.7 /bin/bash
> 
> Inside the container
> [root@96d2e63f6cd9 /]# virt-what
> [root@96d2e63f6cd9 /]# echo $?
> 0
> [root@96d2e63f6cd9 /]# subscription-manager status
> +-------------------------------------------+
> System Status Details
> +-------------------------------------------+
> Overall Status: Unknown
> System Purpose Status: Unknown
> 
> If we subscribe the container it is recognized as physical system.

Thanks. I can reproduce this issue with the following steps:

On Fedora 37 host:
# cat /etc/redhat-release 
Fedora release 37 (Thirty Seven)

# podman --version
podman version 4.3.1

# podman pull ubi8/ubi-init:8.7
# podman run -it ubi8/ubi-init:8.7 /bin/bash

Inside the container:
[root@2df77826f101 /]# virt-what
[root@2df77826f101 /]# rpm -q virt-what
virt-what-1.25-1.el8.x86_64
[root@2df77826f101 /]# cat "/proc/1/environ" | tr '\000' '\n' | grep container
container=oci

After applying your patch in the attachment:
[root@2df77826f101 /]# virt-what
oci

--- Additional comment from Richard W.M. Jones on 2023-01-03 15:47:13 UTC ---



--- Additional comment from Richard W.M. Jones on 2023-01-05 12:52:46 UTC ---

Fixed upstream in:
http://git.annexia.org/?p=virt-what.git;a=commit;h=54c2ad4a764658ec8a9aadc52c749eabf1de73a0

Comment 1 YongkuiGuo 2023-01-09 12:14:57 UTC
Tested with the virt-what-1.25-2.el9.x86_64 package:

On Fedora 37 host:
# cat /etc/redhat-release 
Fedora release 37 (Thirty Seven)

# podman --version
podman version 4.3.1

# podman pull ubi9/ubi-init
# podman run -it ubi9-init /bin/bash

Inside the container:
[root@f89c6ef9e53b /]# virt-what
oci
[root@f89c6ef9e53b /]# rpm -q virt-what
virt-what-1.25-2.el9.x86_64

Comment 4 YongkuiGuo 2023-01-18 07:52:46 UTC
Verified this bug per comment 1.

Comment 6 errata-xmlrpc 2023-05-09 08:24:47 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 (virt-what 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/RHBA-2023:2557


Note You need to log in before you can comment on or make changes to this bug.