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 2184183 - virt-v2v conversions fail with "Multiple same specifications for /.*"
Summary: virt-v2v conversions fail with "Multiple same specifications for /.*"
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: virt-v2v
Version: 8.7
Hardware: x86_64
OS: Linux
unspecified
urgent
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Vera
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-04-03 20:27 UTC by Pieter Malan
Modified: 2023-05-16 09:02 UTC (History)
12 users (show)

Fixed In Version: virt-v2v-1.42.0-22.el8_8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-16 08:18:37 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
virt-v2v log (4.09 MB, text/plain)
2023-04-03 20:27 UTC, Pieter Malan
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-153965 0 None None None 2023-04-04 06:43:13 UTC
Red Hat Product Errata RHSA-2023:2757 0 None None None 2023-05-16 08:19:40 UTC

Description Pieter Malan 2023-04-03 20:27:30 UTC
Created attachment 1955582 [details]
virt-v2v log

Description of problem:

Customer disable SELINUX with kernel parameter selinux=0. virt-v2v does not pick up that SELINUX is disabled and try to do a relabel, and fails on relabeling.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Prepare a RHEL 7.2 on VMWare, standard minimal install
2. grubby --update-kernel=ALL --args="selinux=0"
3. dracut -f
4. Reboot
5. getenforce -> Disabled
6. /etc/selinux/config still contains:
    SELINUX=enforcing
    SELINUX=targeted

7. Migrate VM from VMWare


Actual results:

On line 5414: attached virt-v2v.log 

libguestfs: trace: v2v: selinux_relabel "/etc/selinux/targeted/contexts/files/file_contexts" "/" "force:true"
guestfsd: <= selinux_relabel (0x1d3) request length 108 bytes
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: setfiles -m
usage:  setfiles [-diIDlmnpqvEFW] [-e excludedir] [-r alt_root_path] [-c policyfile] spec_file pathname...
usage:  setfiles [-diIDlmnpqvEFW] [-e excludedir] [-r alt_root_path] [-c policyfile] spec_file -f filename
usage:  setfiles -s [-diIDlmnpqvFW] spec_file
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: setfiles -F -e /sysroot/dev -e /sysroot/proc -e /sysroot/selinux -e /sysroot/sys -m -r /sysroot -v /sysroot/etc/selinux/targeted/contexts/files/file_contexts /sysroot/
Can't stat exclude path "/sysroot/selinux", No such file or directory - ignoring.
setfiles: /sysroot/etc/selinux/targeted/contexts/files/file_contexts: Multiple same specifications for /.*.
/sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid argument
guestfsd: error: Can't stat exclude path "/sysroot/selinux", No such file or directory - ignoring.
setfiles: /sysroot/etc/selinux/targeted/contexts/files/file_contexts: Multiple same specifications for /.*.
/sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid argument
guestfsd: => selinux_relabel (0x1d3) took 0.12 secs
libguestfs: trace: v2v: selinux_relabel = -1 (error)
virt-v2v: error: libguestfs error: selinux_relabel: Can't stat exclude path 
"/sysroot/selinux", No such file or directory - ignoring.
setfiles: /sysroot/etc/selinux/targeted/contexts/files/file_contexts: 
Multiple same specifications for /.*.
/sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid 
argument
rm -rf '/var/tmp/null.WFupAO'
libguestfs: trace: v2v: close

Expected results:

Conversion successful. Committing all overlays to local disks.
    (0.00/100%)
     ....
    (100.00/100%)
Image committed.
Commit successful. Cleaning up.

Additional info:

Comment 1 Pieter Malan 2023-04-03 20:32:52 UTC
Don't have visibility into what was added after base install, and if selinux policies where maintained/installed for additional packages.

Comment 2 Pieter Malan 2023-04-03 21:39:43 UTC
Just received the /etc/selinux/config:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

Comment 4 Richard W.M. Jones 2023-04-04 06:44:03 UTC
This bug does not affect upstream virt-v2v.

Downstream fix posted:

https://listman.redhat.com/archives/libguestfs/2023-April/031206.html

Comment 5 Richard W.M. Jones 2023-04-04 06:45:52 UTC
My reproducer:

  $ virt-builder --format=qcow2 fedora-36 --append-line '/etc/selinux/targeted/contexts/files/file_contexts:/.* system_u:object_r:default_t:s0'

  $ virt-v2v -i disk fedora-36.qcow2 -o null

On RHEL 8 (virt-v2v-1.42.0-21.module+el8.8.0+16781+9f4724c2.x86_64) it fails like this:

  virt-v2v: error: libguestfs error: selinux_relabel: Can't stat exclude path 
  "/sysroot/selinux", No such file or directory - ignoring.
  setfiles: /sysroot/etc/selinux/targeted/contexts/files/file_contexts: 
  Multiple same specifications for /.*.
  /sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid 
  argument

On RHEL 9 (virt-v2v-2.0.7-6.el9.x86_64) it works fine.

Fedora and upstream are also fine.

Comment 13 Vera 2023-04-06 04:21:21 UTC
Reproduced with virt-v2v-1.42.0-21.module+el8.8.0+16781+9f4724c2.x86_64.

Steps:
1. Prepare a RHEL 7.9/8.7 on ESXi8.0

2. Check:
[root@localhost ~]# getenforce
Disabled
[root@localhost ~]# 
[root@localhost ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

3. Add the line with content "/.* system_u:object_r:default_t:s0" into /etc/selinux/targeted/contexts/files/file_contexts
[root@localhost ~]# vi /etc/selinux/targeted/contexts/files/file_contexts
/.* system_u:object_r:default_t:s0
/.* system_u:object_r:default_t:s0
.....

4. Convert via virt-v2v
# virt-v2v -i libvirt -ic vpx://root.212.149/data/10.73.212.36/?no_verify=1 -o null  -ip /v2v-ops/esxpw esx8.0-rhel7.9-x86_64-bz2184183
[   0.0] Opening the source -i libvirt -ic vpx://root.212.149/data/10.73.212.36/?no_verify=1 esx8.0-rhel7.9-x86_64-bz2184183
[   4.9] Creating an overlay to protect the source from being modified
[   6.8] Opening the overlay
[  39.8] Inspecting the overlay
[ 558.6] Checking for sufficient free disk space in the guest
[ 558.6] Estimating space required on target for each disk
[ 558.6] Converting Red Hat Enterprise Linux Server 7.9 (Maipo) to run on KVM
virt-v2v: error: libguestfs error: selinux_relabel: Can't stat exclude path 
"/sysroot/selinux", No such file or directory - ignoring.
setfiles: /sysroot/etc/selinux/targeted/contexts/files/file_contexts: 
Multiple same specifications for /.*.
/sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid 
argument

If reporting bugs, run virt-v2v with debugging enabled and include the 
complete output:

  virt-v2v -v -x [...]


Verified with virt-v2v-1.42.0-22.module+el8.8.0+18565+360d99ae.x86_64.The conversion can work successfully.

# rpm -qa virt-v2v
virt-v2v-1.42.0-22.module+el8.8.0+18565+360d99ae.x86_64
# virt-v2v -i libvirt -ic vpx://root.212.149/data/10.73.212.36/?no_verify=1 -o null  -ip /v2v-ops/esxpw esx8.0-rhel7.9-x86_64-bz2184183
[   0.0] Opening the source -i libvirt -ic vpx://root.212.149/data/10.73.212.36/?no_verify=1 esx8.0-rhel7.9-x86_64-bz2184183
[   5.0] Creating an overlay to protect the source from being modified
[   7.1] Opening the overlay
[  47.5] Inspecting the overlay
[ 562.0] Checking for sufficient free disk space in the guest
[ 562.0] Estimating space required on target for each disk
[ 562.0] Converting Red Hat Enterprise Linux Server 7.9 (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[2044.3] Mapping filesystem data to avoid copying unused and blank areas
[2046.7] Closing the overlay
[2047.0] Assigning disks to buses
[2047.0] Checking if the guest needs BIOS or UEFI to boot
[2047.0] Initializing the target -o null
[2047.0] Copying disk 1/2 to qemu URI json:{ "file.driver": "null-co", "file.size": "1E" } (raw)
    (100.00/100%)
[3654.7] Copying disk 2/2 to qemu URI json:{ "file.driver": "null-co", "file.size": "1E" } (raw)
    (100.00/100%)
[3883.9] Creating output metadata
[3883.9] Finishing off

Comment 21 errata-xmlrpc 2023-05-16 08:18:37 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 (Moderate: virt:rhel and virt-devel:rhel 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-2023:2757


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