Skip to content

Commit 8b2b653

Browse files
committed
Install dracut tools
1 parent 460fa07 commit 8b2b653

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

rhel-stig/Dockerfile.rhel9

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,20 @@ RUN if [ -f /boot/initrd ] || ls /boot/initramfs-* 1>/dev/null 2>&1 || ls /boot/
135135
INITRD=$(ls -1 /boot/initramfs-* /boot/initrd-* /boot/initrd 2>/dev/null | head -n1); \
136136
echo "Using initrd: $INITRD"; \
137137
ls -lh "$INITRD" || true; \
138-
echo "Checking initramfs contents for required modules and scripts..."; \
139138
if ! command -v lsinitrd >/dev/null 2>&1; then \
140-
echo "ERROR: lsinitrd missing - cannot verify initramfs contents"; \
141-
echo "This should not happen as dracut is installed earlier in the build"; \
142-
exit 1; \
139+
echo "lsinitrd missing; installing dracut-tools..."; \
140+
dnf install -y dracut-tools && dnf clean all; \
141+
fi; \
142+
if command -v lsinitrd >/dev/null 2>&1; then \
143+
echo "=== dmsquash-live ==="; \
144+
lsinitrd "$INITRD" 2>/dev/null | grep -E "(90dmsquash-live|dmsquash-live|dmsquash-liveroot|parse-live|iso-scan|CDLABEL)" || echo "WARNING: dmsquash-live scripts not found"; \
145+
echo "=== rootfsbase ==="; \
146+
lsinitrd "$INITRD" 2>/dev/null | grep -E "(rootfsbase|90rootfsbase)" || echo "WARNING: rootfsbase module not found"; \
147+
echo "=== required kernel modules ==="; \
148+
lsinitrd "$INITRD" 2>/dev/null | grep -E "/lib/modules/.*/kernel/fs/squashfs/squashfs\.ko|/lib/modules/.*/kernel/fs/overlayfs/overlay\.ko|/lib/modules/.*/kernel/drivers/block/loop\.ko" || echo "WARNING: Some required kernel modules not found (may be built-in)"; \
149+
else \
150+
echo "WARNING: lsinitrd still missing; skipping initramfs inspection"; \
143151
fi; \
144-
echo "=== Checking for dmsquash-live module and scripts ==="; \
145-
lsinitrd "$INITRD" 2>/dev/null | grep -E "(90dmsquash-live|dmsquash-live|dmsquash-liveroot|parse-live.sh|iso-scan|CDLABEL)" || echo "WARNING: dmsquash-live scripts not found in initramfs"; \
146-
echo "=== Checking for rootfsbase module ==="; \
147-
lsinitrd "$INITRD" 2>/dev/null | grep -E "(rootfsbase|90rootfsbase)" || echo "WARNING: rootfsbase module not found in initramfs"; \
148-
echo "=== Checking for required kernel modules ==="; \
149-
lsinitrd "$INITRD" 2>/dev/null | grep -E "/lib/modules/.*/kernel/fs/squashfs/squashfs\.ko|/lib/modules/.*/kernel/fs/overlayfs/overlay\.ko|/lib/modules/.*/kernel/drivers/block/loop\.ko" || echo "WARNING: Some required kernel modules not found (may be built-in)"; \
150152
else \
151153
echo "ERROR: No initramfs found in /boot after kairos-init -s init"; \
152154
ls -la /boot/ || true; \

rhel-stig/Dockerfile.rhel9-fips

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,20 @@ RUN if [ -f /boot/initrd ] || ls /boot/initramfs-* 1>/dev/null 2>&1 || ls /boot/
134134
INITRD=$(ls -1 /boot/initramfs-* /boot/initrd-* /boot/initrd 2>/dev/null | head -n1); \
135135
echo "Using initrd: $INITRD"; \
136136
ls -lh "$INITRD" || true; \
137-
echo "Checking initramfs contents for required modules and scripts..."; \
138137
if ! command -v lsinitrd >/dev/null 2>&1; then \
139-
echo "ERROR: lsinitrd missing - cannot verify initramfs contents"; \
140-
echo "This should not happen as dracut is installed earlier in the build"; \
141-
exit 1; \
138+
echo "lsinitrd missing; installing dracut-tools..."; \
139+
dnf install -y dracut-tools && dnf clean all; \
140+
fi; \
141+
if command -v lsinitrd >/dev/null 2>&1; then \
142+
echo "=== dmsquash-live ==="; \
143+
lsinitrd "$INITRD" 2>/dev/null | grep -E "(90dmsquash-live|dmsquash-live|dmsquash-liveroot|parse-live|iso-scan|CDLABEL)" || echo "WARNING: dmsquash-live scripts not found"; \
144+
echo "=== rootfsbase ==="; \
145+
lsinitrd "$INITRD" 2>/dev/null | grep -E "(rootfsbase|90rootfsbase)" || echo "WARNING: rootfsbase module not found"; \
146+
echo "=== required kernel modules ==="; \
147+
lsinitrd "$INITRD" 2>/dev/null | grep -E "/lib/modules/.*/kernel/fs/squashfs/squashfs\.ko|/lib/modules/.*/kernel/fs/overlayfs/overlay\.ko|/lib/modules/.*/kernel/drivers/block/loop\.ko" || echo "WARNING: Some required kernel modules not found (may be built-in)"; \
148+
else \
149+
echo "WARNING: lsinitrd still missing; skipping initramfs inspection"; \
142150
fi; \
143-
echo "=== Checking for dmsquash-live module and scripts ==="; \
144-
lsinitrd "$INITRD" 2>/dev/null | grep -E "(90dmsquash-live|dmsquash-live|dmsquash-liveroot|parse-live.sh|iso-scan|CDLABEL)" || echo "WARNING: dmsquash-live scripts not found in initramfs"; \
145-
echo "=== Checking for rootfsbase module ==="; \
146-
lsinitrd "$INITRD" 2>/dev/null | grep -E "(rootfsbase|90rootfsbase)" || echo "WARNING: rootfsbase module not found in initramfs"; \
147-
echo "=== Checking for required kernel modules ==="; \
148-
lsinitrd "$INITRD" 2>/dev/null | grep -E "/lib/modules/.*/kernel/fs/squashfs/squashfs\.ko|/lib/modules/.*/kernel/fs/overlayfs/overlay\.ko|/lib/modules/.*/kernel/drivers/block/loop\.ko" || echo "WARNING: Some required kernel modules not found (may be built-in)"; \
149151
else \
150152
echo "ERROR: No initramfs found in /boot after kairos-init -s init"; \
151153
ls -la /boot/ || true; \

0 commit comments

Comments
 (0)