2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-03 07:57:02 +00:00

Degrade gracefully when squashfs-tools is missing

imageboot falls back to cp when unsquashfs is unavailable, but the build
side did not: a bare dracut_install/copy_exec aborts initramfs generation
when the binary is absent, and the capture prerequisite check refused to
capture the image at all.

Mark the initramfs copies optional and report the missing package as an
advisory rather than a hard prerequisite, so such images still build and
capture, just without the faster extraction path. Widen the EL check to
every release past el8 so future ones inherit it.
This commit is contained in:
Markus Hilger
2026-07-28 01:49:01 +02:00
parent cfc4490fe1
commit 62465812a3
4 changed files with 24 additions and 8 deletions
+2 -1
View File
@@ -3,7 +3,8 @@ dracut_install /lib64/libtss2-tcti-device.so.0
dracut_install tpm2_create tpm2_pcrread tpm2_createpolicy tpm2_createprimary
dracut_install tpm2_load tpm2_unseal tpm2_getcap tpm2_evictcontrol
dracut_install tpm2_pcrextend tpm2_policypcr tpm2_flushcontext tpm2_startauthsession
dracut_install curl openssl tar cpio gzip lsmod ethtool xz unsquashfs lsmod ethtool
dracut_install curl openssl tar cpio gzip lsmod ethtool xz lsmod ethtool
dracut_install -o unsquashfs # optional, imageboot extracts with cp when absent
dracut_install modprobe touch echo cut wc bash uniq grep ip hostname
dracut_install awk egrep dirname expr sort
dracut_install ssh sshd reboot parted mkfs mkfs.ext4 mkfs.xfs xfs_db mkswap
+2 -1
View File
@@ -3,7 +3,8 @@ dracut_install /lib64/libtss2-tcti-device.so.0
dracut_install tpm2_create tpm2_pcrread tpm2_createpolicy tpm2_createprimary
dracut_install tpm2_load tpm2_unseal tpm2_getcap tpm2_evictcontrol
dracut_install tpm2_pcrextend tpm2_policypcr tpm2_flushcontext tpm2_startauthsession
dracut_install curl openssl tar cpio gzip lsmod ethtool xz unsquashfs lsmod ethtool
dracut_install curl openssl tar cpio gzip lsmod ethtool xz lsmod ethtool
dracut_install -o unsquashfs # optional, imageboot extracts with cp when absent
dracut_install modprobe touch echo cut wc bash uniq grep ip hostname
dracut_install awk egrep dirname expr sort
dracut_install ssh sshd reboot parted mkfs mkfs.ext4 mkfs.xfs xfs_db mkswap
+19 -5
View File
@@ -222,6 +222,8 @@ async def capture_remote(args):
for cmd in unmet:
sys.stderr.write(cmd + '\n')
sys.exit(1)
for cmd in finfo.get('optionalprereqs', []):
sys.stderr.write(cmd + '\n')
oscat = finfo['oscategory']
subprocess.check_call(['ssh', '-o', 'LogLevel=QUIET', '-t', targ, 'python3', '/run/imgutil/capenv/imgutil', 'capturelocal'])
utillib = __file__.replace('bin/imgutil', 'lib/imgutil')
@@ -471,6 +473,7 @@ class OsHandler(object):
self.sourcepath = None
self.osname = '{}-{}-{}'.format(name, version, arch)
self.captureprereqs = []
self.captureadvisories = []
try:
pkglist = args.packagelist
except AttributeError:
@@ -507,7 +510,8 @@ class OsHandler(object):
if not isinstance(odata[idx], str):
odata[idx] = odata[idx].decode('utf8')
info = {'oscategory': odata[0],
'version': odata[1], 'arch': odata[2], 'name': odata[3], 'unmetprereqs': self.captureprereqs}
'version': odata[1], 'arch': odata[2], 'name': odata[3], 'unmetprereqs': self.captureprereqs,
'optionalprereqs': self.captureadvisories}
return json.dumps(info)
def prep_root_premount(self, args):
@@ -681,16 +685,21 @@ class DebHandler(OsHandler):
self.oscategory = name + version
super().__init__(name, version, arch, args)
needpkgs = []
wantpkgs = []
if not os.path.exists(os.path.join(hostpath, 'usr/bin/tpm2_getcap')):
needpkgs.append('tpm2-tools')
if not os.path.exists(os.path.join(hostpath, 'usr/bin/unsquashfs')):
needpkgs.append('squashfs-tools')
lfuses = glob.glob(os.path.join(hostpath, '/lib/*/libfuse.so.2'))
if not lfuses:
needpkgs.append('libfuse2')
if not os.path.exists(os.path.join(hostpath, 'usr/bin/unsquashfs')):
wantpkgs.append('squashfs-tools')
if needpkgs:
needapt = 'Missing packages needed in target for capture, to add required packages: apt install ' + ' '.join(needpkgs)
self.captureprereqs.append(needapt)
if wantpkgs:
wantapt = ('Missing optional packages in target, untethered boot will extract the image more slowly, '
'to add them: apt install ' + ' '.join(wantpkgs))
self.captureadvisories.append(wantapt)
def add_pkglists(self):
self.includepkgs.extend(self.list_packages())
@@ -768,6 +777,7 @@ class ElHandler(OsHandler):
self.yumargs = []
super().__init__(name, version, arch, args)
needpkgs = []
wantpkgs = []
if not hostpath:
return
if not os.path.exists(os.path.join(hostpath, 'usr/bin/tpm2_getcap')):
@@ -781,13 +791,17 @@ class ElHandler(OsHandler):
needpkgs.append('dhcp-client')
if not os.path.exists(os.path.join(hostpath, 'usr/sbin/mount.nfs')):
needpkgs.append('nfs-utils')
if (self.oscategory in ('el9', 'el10') and
if (self.oscategory not in ('el7', 'el8') and
not os.path.exists(os.path.join(hostpath, 'usr/sbin/unsquashfs')) and
not os.path.exists(os.path.join(hostpath, 'usr/bin/unsquashfs'))):
needpkgs.append('squashfs-tools')
wantpkgs.append('squashfs-tools')
if needpkgs:
needapt = 'Missing packages needed in target for capture, to add required packages: dnf install ' + ' '.join(needpkgs)
self.captureprereqs.append(needapt)
if wantpkgs:
wantdnf = ('Missing optional packages in target, untethered boot will extract the image more slowly, '
'to add them: dnf install ' + ' '.join(wantpkgs))
self.captureadvisories.append(wantdnf)
def add_pkglists(self):
self.yumargs.extend(self.list_packages())
@@ -33,7 +33,7 @@ copy_exec /usr/bin/tpm2_pcrextend
copy_exec /usr/bin/ssh-keygen
copy_exec /usr/sbin/sshd
copy_exec /usr/sbin/mkfs.xfs
copy_exec /usr/bin/unsquashfs
[ -e /usr/bin/unsquashfs ] && copy_exec /usr/bin/unsquashfs
[ -e /usr/lib/openssh/sshd-session ] && copy_exec /usr/lib/openssh/sshd-session
[ -e /usr/lib/x86_64-linux-gnu/libfuse.so.2 ] && copy_exec /usr/lib/x86_64-linux-gnu/libfuse.so.2
[ -e /usr/lib/aarch64-linux-gnu/libfuse.so.2 ] && copy_exec /usr/lib/aarch64-linux-gnu/libfuse.so.2