Hello, Richard.
-----Original Message-----
From: Richard W.M. Jones [mailto:rjones@redhat.com]
Sent: Monday, March 5, 2018 8:42 PM
To: Зиновик Игорь Анатольевич <ZinovikIA(a)nspk.ru>
Cc: libguestfs(a)redhat.com
Subject: Re: [Libguestfs] virt-v2v 1.38 fails to convert .vmx VM: setfiles ...
Multiple same specifications for /.*.
On Mon, Mar 05, 2018 at 02:03:17PM +0000, Зиновик Игорь Анатольевич
wrote:
> Hello.
>
> I'm trying to convert VMware based virtual machines (CentOS 7.2) and output
them into oVirt.
> virt-v2v fails with following error:
> setfiles: /sysroot/etc/selinux/targeted/contexts/files/file_contexts: Multiple
same specifications for /.*.
>
> File `file_contexts' looks same like in recent CentOS 7.4. My
> conversion server is Fedora 28 (Rawhide), since it contains virt-v2v 1.38.
This has got to be a bug of some kind in the SELinux ‘setfiles’
program.
Fedora rawhide has policycoreutils-2.7-11.fc28.x86_64 (setfiles is shipped inside that rpm
package).
What happens if you run these commands (which should be safe to run
because they only operate on a throw-away overlay):
qemu-img create -f qcow2 throwaway.qcow2 /mnt/knp1-vm-otp02/knp1-vm-
otp02.vmdk
Seems that qemu-img 2.11 (which I have on my fedora rawhide) does not support
such format of invocation. VM have two disks (/boot and LVM partitioned one).
I converted both disks to .qcow2 format and executed virt-customize on them:
# qemu-img convert -f vmdk -O qcow2 /mnt/knp1-vm-otp02/knp1-vm-otp02.vmdk ta.qcow2
# qemu-img convert -f vmdk -O qcow2 /mnt/knp1-vm-otp02/knp1-vm-otp02_1.vmdk ta1.qcow2
# virt-customize --colours -v -x --selinux-relabel -a ta.qcow2 -a ta1.qcow2
virt-customize --selinux-relabel -a throwaway.qcow2
rm throwaway.qcow2
Here is a most interesting snippet from `virt-customize -v -x --selinux-relabel -a
ta.qcow2 -a ta1.qcow2' output:
... many lines skipped ...
libguestfs: trace: aug_ls "/files/etc/selinux/config"
guestfsd: <= aug_ls (0x1c) request length 72 bytes
libguestfs: trace: aug_ls = ["/files/etc/selinux/config/#comment[1]",
"/files/etc/selinux/config/#comment[2]",
"/files/etc/selinux/config/#comment[3]",
"/files/etc/selinux/config/#comment[4]",
"/files/etc/selinux/config/#comment[5]",
iles/etc/selinux/config/#comment[6]",
"/files/etc/selinux/config/#comment[7]",
"/files/etc/selinux/config/#comment[8]",
"/files/etc/selinux/config/#comment[9]",
"/files/etc/selinux/config/SELINUX[1]",
"/files/etc/selinux/config/SELINU]"]
libguestfs: trace: aug_close
guestfsd: => aug_ls (0x1c) took 0.00 secs
guestfsd: <= aug_close (0x1a) request length 40 bytes
libguestfs: trace: aug_close = 0
libguestfs: trace: grep "vdagentd.\pid"
"/etc/selinux/targeted/contexts/files/file_contexts" "fixed:true"
guestfsd: => aug_close (0x1a) took 0.14 secs
guestfsd: <= grep (0x97) request length 132 bytes
commandrvf: stdout=y stderr=y flags=0x20004
commandrvf: grep -F vdagentd.\pid
libguestfs: trace: grep = []
libguestfs: trace: selinux_relabel
"/etc/selinux/targeted/contexts/files/file_contexts" "/"
"force:true"
guestfsd: => grep (0x97) took 0.12 secs
guestfsd: <= selinux_relabel (0x1d3) request length 108 bytes
commandrvf: stdout=n stderr=y flags=0x0
commandrvf: setfiles -m
usage: setfiles [-diIDlmnpqvFW] [-e excludedir] [-r alt_root_path] spec_file pathname...
usage: setfiles [-diIDlmnpqvFW] [-e excludedir] [-r alt_root_path] spec_file -f filename
usage: setfiles -s [-diIDlmnpqvFW] spec_file
usage: setfiles -c policyfile 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
libguestfs: trace: selinux_relabel = -1 (error)
virt-customize: 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
libguestfs: trace: close
libguestfs: closing guestfs handle 0x1cf9d90 (state 2)
libguestfs: trace: internal_autosync
guestfsd: => selinux_relabel (0x1d3) took 3.49 secs
guestfsd: <= internal_autosync (0x11a) request length 40 bytes
Настоящее сообщение, направленное по электронной почте, и любые вложения - это
корреспонденция, содержащая информацию, доступ к которой ограничен в соответствии с
законодательством Российской Федерации и которая предназначена только для использования
уполномоченными АО «НСПК» получателями сообщения (уполномоченными лицами). Если Вы не
являетесь уполномоченным лицом или Вам не известно, являетесь ли Вы таким уполномоченным
получателем сообщения от АО «НСПК», то уведомляем, что любое раскрытие, распространение
или копирование этого сообщения влечет за собой установленную законом ответственность.
Если Вы не являетесь уполномоченным получателем сообщения, просим Вас незамедлительно
информировать об этом отправителя и удалить полученное сообщение из системы. This e-mail
message together with any attachments hereto contains confidential information and is
intended for recipients authorized by NSPK only. Any disclosure, distribution or copying
of this message entails liability established by law. If you are not an authorized
recipient, please immediately inform the sender and delete this message from your
information system.