Commit 49b89e3
committed
base_image: force SELinux relabeling for Fedora on Debian hosts
Fedora guest images created on Debian hosts fail to boot with exit code 127
errors because the filesystem lacks proper SELinux contexts. All files have
unlabeled_t context causing SELinux to block all binary execution.
virt-builder's --selinux-relabel flag is a no-op compatibility option. While
virt-builder attempts automatic relabeling, it fails silently on non-SELinux
hosts and falls back to creating /.autorelabel, which triggers a chicken-and-egg
problem where the relabeling service itself cannot execute.
Add a post-processing step that runs virt-customize --selinux-relabel after
virt-builder creates the image. This runs only when building Fedora guests on
Debian/Ubuntu hosts, ensuring proper SELinux contexts before first boot.
The implementation uses separate register variables for system and user libvirt
tasks to avoid overwriting results, and checks ansible_distribution instead of
os_family for more reliable Debian detection.
Generated-by: Claude AI
Signed-off-by: Daniel Gomez <[email protected]>1 parent 88f94e7 commit 49b89e3
1 file changed
+32
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
74 | 106 | | |
75 | 107 | | |
76 | 108 | | |
| |||
0 commit comments