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 2155233 - 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 8
Classification: Red Hat
Component: virt-what
Version: 8.7
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: YongkuiGuo
URL:
Whiteboard:
: 2077879 (view as bug list)
Depends On:
Blocks: 2158431
TreeView+ depends on / blocked
 
Reported: 2022-12-20 13:19 UTC by Alessandro Valentini
Modified: 2023-05-16 11:19 UTC (History)
5 users (show)

Fixed In Version: virt-what-1.25-2.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2158431 (view as bug list)
Environment:
Last Closed: 2023-05-16 09:11:18 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Add oci environment to virt-what cases (523 bytes, patch)
2022-12-20 13:19 UTC, Alessandro Valentini
no flags Details | Diff
container subscribed as physical system (14.51 KB, image/png)
2022-12-29 09:21 UTC, Alessandro Valentini
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-142964 0 None None None 2022-12-20 13:28:17 UTC
Red Hat Product Errata RHBA-2023:3033 0 None None None 2023-05-16 09:11:23 UTC

Description Alessandro Valentini 2022-12-20 13:19:48 UTC
Created attachment 1933763 [details]
Add oci environment to virt-what cases

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.

Comment 1 YongkuiGuo 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?

Comment 2 Richard W.M. Jones 2022-12-22 10:27:06 UTC
Definitely going to need exact steps to reproduce this, so setting needinfo.

Comment 4 Alessandro Valentini 2022-12-29 09:21:52 UTC
Created attachment 1934858 [details]
container subscribed as physical system

Comment 5 Alessandro Valentini 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.

Comment 6 YongkuiGuo 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

Comment 7 Richard W.M. Jones 2023-01-03 15:47:13 UTC
*** Bug 2077879 has been marked as a duplicate of this bug. ***

Comment 9 YongkuiGuo 2023-01-09 11:58:07 UTC
Tested with the virt-what-1.25-2.el8.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 ubi8/ubi-init:8.7
# podman run -it ubi8/ubi-init:8.7 /bin/bash

Inside the container:
[root@1919a2d450bc ~]# virt-what
oci
[root@1919a2d450bc ~]# rpm -q virt-what
virt-what-1.25-2.el8.x86_64

Comment 14 YongkuiGuo 2023-01-18 07:36:08 UTC
Verified this bug per comment 9.

Comment 18 errata-xmlrpc 2023-05-16 09:11:18 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:3033


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