Bug 2089748

Summary: Removal of "--selinux-relabel" option breaks existing scripts
Product: Red Hat Enterprise Linux 9 Reporter: Cédric Jeanneret <cjeanner>
Component: guestfs-toolsAssignee: Laszlo Ersek <lersek>
Status: CLOSED ERRATA QA Contact: YongkuiGuo <yoguo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bdobreli, bstinson, jwboyer, lersek, qzhang, rjones, virt-maint, ymao, yoguo
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: guestfs-tools-1.48.2-4.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 09:52:44 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:
Bug Depends On:    
Bug Blocks: 2075718    

Description Cédric Jeanneret 2022-05-24 11:09:04 UTC
Description of problem:
It appears the removal of "--selinux-relabel" option was pushed in the 1.48.1 version, which is distributed in CentOS Stream 9.

While I'm completely OK with "default on relabel things", it breaks existing scripts that were calling on purpose the --selinux-relabel parameter:

virt-sysprep: unrecognized option '--selinux-relabel'


Version-Release number of selected component (if applicable):
guestfs-tools-1.48.1-1.el9.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Get a CentOS Stream 9 host, ensure all is up-to-date
2. install latest guestfs-tools
3. run any command with "--selinux-relabel", for instance: virt-sysprep -a {IMAGE} --selinux-relabel [... some other options] 

Actual results:
It fails due to a now unknown option

Expected results:
It should still succeed, but probably output a warning about the deprecation of that option

Additional info:
Apparently the patch is this one: https://github.com/libguestfs/libguestfs/commit/2f6a27f1077d32d1ab526427052fc88e188356f7
I started a discussion there, resulting in this BZ creation


Also: it will affect OSP CI, being upstream and downstream, and may lead to some major issues in our delivery processes... Hopefully I caught it early.

Comment 1 Richard W.M. Jones 2022-05-24 12:19:26 UTC
I confirmed this here too, commands such as "virt-builder fedora-36 --selinux-relabel"
fail with an unknown option.  See also the upstream series:

https://listman.redhat.com/archives/libguestfs/2022-May/thread.html#28826

and original bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1554735
https://bugzilla.redhat.com/show_bug.cgi?id=2075718

Comment 2 Laszlo Ersek 2022-05-25 07:20:58 UTC
[libguestfs PATCH] generator/customize: reintroduce "--selinux-relabel" as a compat option
Message-Id: <20220525071958.9612-1-lersek>
https://listman.redhat.com/archives/libguestfs/2022-May/028972.html

[libguestfs-common PATCH] mlcustomize: refresh generated files
Message-Id: <20220525072008.9689-1-lersek>
https://listman.redhat.com/archives/libguestfs/2022-May/028973.html

Comment 3 Laszlo Ersek 2022-05-25 11:07:31 UTC
(In reply to Laszlo Ersek from comment #2)
> [libguestfs PATCH] generator/customize: reintroduce "--selinux-relabel" as a compat option
> Message-Id: <20220525071958.9612-1-lersek>
> https://listman.redhat.com/archives/libguestfs/2022-May/028972.html

commit range 63b722b6c094..9e69a38d8234

> [libguestfs-common PATCH] mlcustomize: refresh generated files
> Message-Id: <20220525072008.9689-1-lersek>
> https://listman.redhat.com/archives/libguestfs/2022-May/028973.html

commit f8de5508fe75

guestfs-tools: commit 273de755dfe7 ("update common submodule", 2022-05-25)

Comment 6 YongkuiGuo 2022-05-27 02:51:16 UTC
Verified with guestfs-tools-1.48.2-1.el9.x86_64


Steps:

1. On rhel9.1 host
$ virt-builder fedora-36 --selinux-relabel
[   9.1] Downloading: http://builder.libguestfs.org/fedora-36.xz
###################################################################################################################### 100.0%###################################################################################################################### 100.0%
[  96.5] Planning how to build this image
[  96.5] Uncompressing
[  98.8] Opening the new disk
[ 107.6] Setting a random seed
[ 107.6] Setting passwords
virt-builder: Setting random password of root to QVWvz00xHSTuWIX8
[ 109.0] SELinux relabelling
[ 121.1] Finishing off
                   Output file: fedora-36.img
                   Output size: 6.0G
                 Output format: raw
            Total usable space: 6.0G
                    Free space: 4.7G (79%)

No error like this "virt-builder: unrecognized option '--selinux-relabel'".

Comment 7 Cédric Jeanneret 2022-05-30 07:01:49 UTC
Thank you!

Comment 9 errata-xmlrpc 2022-11-15 09:52:44 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 (Low: guestfs-tools security, 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/RHSA-2022:7959