Bug 1370816

Summary: virt-builder rhel-6.5 --selinux-relabel fails
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ptoscano, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-26 13:23:41 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:

Description Richard W.M. Jones 2016-08-27 13:06:44 UTC
Description of problem:

$ virt-builder rhel-6.5 --selinux-relabel
[   0.2] Downloading: .../rhel-6.5.xz
[   0.8] Planning how to build this image
[   0.8] Uncompressing
[  13.3] Opening the new disk
[  25.9] Setting a random seed
[  25.9] Setting passwords
virt-builder: Setting random password of root to 9tUGCecjfvaHS3Wm
[  27.0] SELinux relabelling
virt-builder: error: libguestfs error: selinux_relabel: 
/sysroot/etc/selinux/targeted/contexts/files/file_contexts: Invalid 
argument: Success

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

libguestfs-1.34.0-1.fc24.x86_64

How reproducible:

100%

However it is not a problem with later versions of RHEL,
eg. rhel-6.8 works fine.

Steps to Reproduce:
1. See above.

Comment 1 Pino Toscano 2017-06-26 13:23:41 UTC
In the end, it was worked around in libguestfs by manually fixing a faulty selinux file_context file -- see more discussion in bug 1374232.

Fixed with commits
https://github.com/libguestfs/libguestfs/commit/25772a8123a1a800caf3472fb79c8eb3b4a074f3
https://github.com/libguestfs/libguestfs/commit/c6d8d68a4643794128c1d617bc83fc22438cc7c5
which are in libguestfs >= 1.37.1.