2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-10 19:46:26 +00:00
Commit Graph

245 Commits

Author SHA1 Message Date
Jarrod Johnson f3f1e692ea Merge pull request #300 from Obihoernchen/fix/imgutil-chkstat
Actually run chkstat on the SUSE image
2026-09-09 08:32:29 -04:00
Markus Hilger 583e2fa321 Import the signing key SLE 16 media ships
Building a SUSE 16 image from SLE media failed every package with
"key ID fec28eaf09d9ea69: NOKEY". Leap publishes that key as
gpg-pubkey-*.asc, which the existing glob picks up; SLE publishes the
same key only as repodata/repomd.xml.key, so nothing was imported.

15 media carries both spellings, so this changes nothing there.
2026-09-07 13:30:11 +02:00
Markus Hilger c66d7bcb7e Give the SUSE 16 initramfs libkmod
udev's kmod builtin dlopens libkmod, and dracut installs it from an
inst_libdir_file line in a module-setup.sh rather than by following
NEEDED. Which module carries that line moved: the dracut on SLE 16
media declares it only in 00systemd, which the diskless module set
never loads, so the image came up with no libkmod, udev autoloaded
nothing, and the guest reached the network scan with only loopback.
Leap's newer dracut also declares it in 95udev-rules, which base
depends on, which is why Leap was unaffected.
2026-09-07 13:30:11 +02:00
Markus Hilger d069328dd2 Put the sshd helpers in the SUSE 16 diskless initramfs
OpenSSH 10 splits each connection into sshd-session and that into
sshd-auth, so the initramfs sshd on 2222 could not serve a single
session. el10 added sshd-session for the same reason.
2026-09-07 07:07:03 +02:00
Markus Hilger d7a25a9933 Use dhcpcd for SUSE 16 diskless
SLES 16 ships no ISC dhclient and nothing provides dhcp-client, so the
image could not be built from SLES media at all. Leap carries dhcpcd
too, so one client covers both. el10 made the same move when RHEL
dropped dhclient.
2026-09-07 07:07:03 +02:00
Markus Hilger dfa80306b5 Install timezone data in SUSE 16 images
Without it onboot.sh cannot apply deployment.timezone.
2026-09-07 06:14:54 +02:00
Markus Hilger 9089d3700b Find ssh-keysign where SUSE 16 puts it
The permissions.local rule named /usr/lib/ssh, so keysign kept mode 0755
and hostbased auth failed with 'could not open any host key'.
2026-09-07 06:14:54 +02:00
Markus Hilger 5ac3880764 Actually run chkstat on the SUSE image
A trailing comma made args.cmd a tuple holding the argv list, so
fancy_chroot called startswith on a list and the child died before exec.
permissions.local was written but never applied, leaving ssh-keysign
0755 and hostbased auth inoperative on SUSE diskless images.
2026-09-07 05:54:16 +02:00
Markus Hilger 939a46d8d1 Fix SUSE 16 diskless boot 2026-09-05 02:12:18 +02:00
Markus Hilger 9dd5802698 Fill in the spots the SUSE 16 work missed
- the aarch64 osdeploy spec builds the stateful suse16 addons but its
  diskless loop was never extended, so the aarch64 rpm shipped suse16
  without suse16-diskless and a packed image got a dangling addons.cpio.
- imgutil's builddeb keeps its own copy of the directory list that
  confluent_imgutil.spec.tmpl has, and it had learned about neither suse16
  nor el10.
- gather_bootloader gained a /usr/share/efi fallback for shim on both
  architectures but only for x86_64 on grub, so an aarch64 root found a
  shim and then died copying grub.

Finally, rewriting repos.d file by file rather than copying the tree meant
a subdirectory or a file that is not valid UTF-8 aborted the build before
any package was installed, which also regressed SUSE 15. Pass anything
that is not a plain text repo definition through untouched and restore the
modes on the ones that are rewritten.
2026-09-05 02:12:18 +02:00
Markus Hilger 5645fb5cfd Build SUSE 16 images with imgutil
SuseHandler refused anything but 15.x. What 16 needed beyond widening it:

- its repo urls are written in terms of ${releasever}, which zypper
  resolves from the target root's os-release, a file that does not exist
  yet when the first packages go in
- its repos name a zypper service backed by a package-provided directory
  the target root does not have, so zypper discarded every one of them
  as an orphan
- there is no mkinitrd to work out which kernel to build for, and bare
  dracut would build for the build host's running kernel
- the efi payloads moved out of /usr/lib64/efi, arping out of /usr/sbin,
  nsswitch.conf and protocols under /usr/etc, and the presets enable
  sshd already
- the module list predated virtio, so an image built for a KVM guest had
  no network at all, and dm-crypt could not allocate a transform for the
  encrypted image without the aes-xts modules
- urlmount still links libpthread, an empty stub since glibc 2.34 that
  nothing else in the initramfs pulls in
2026-09-05 02:11:53 +02:00
Jarrod Johnson 6d0e364f0e Fixes for media based image boot 2026-09-01 16:23:52 -04:00
Jarrod Johnson 3496f90fb7 Make sure a child can't except out of a forked child
If an exception were incurred in child in fork, the code could break out.
2026-08-25 09:05:04 -04:00
Jarrod Johnson 3e2c03ed9d Correct imgutil argument handling 2026-08-14 08:02:49 -04:00
Jarrod Johnson 4a5e20735d Normalize scratchdir globally
There remain issues where relative path can screw up the transient mounts.  Normalize it to be consistent using absolute path every time.
2026-08-13 13:30:12 -04:00
Markus Hilger c6c2d3112e Tidy comparisons, statement layout and a redundant alias (E711, E712, E701, PLC0414)
Hand written rather than autofixed, since three of the four need the
surrounding code read to be sure they are equivalent:

- confetty: `powerstate == None` -> `is None`.
- nodeconfig: `setmode != True` / `!= False` -> `not setmode` / `setmode`.
  Safe because setmode only ever holds None, True or False, and the two
  lines above each test normalise None away first.
- pam: split two `if cond: stmt` one-liners.
- imgutil: `from shutil import copytree as copytree`, an alias that renames
  nothing.  Not a re-export marker, this is a script.
2026-08-10 05:32:00 +02:00
Jarrod Johnson 3501f70c37 Merge pull request #247 from Obihoernchen/unsquashfs
Use multi-threaded unsquashfs to extract untethered images
2026-07-28 08:59:38 -04:00
Jarrod Johnson 86e4603b82 Merge pull request #258 from Obihoernchen/imgutil-async
imgutil: fix async-port fallout in the image pack/capture path
2026-07-28 08:45:18 -04:00
Markus Hilger ab13ec9e94 Remove duplicate "dracut_install lsmod ethtool" 2026-07-28 02:04:00 +02:00
Markus Hilger 62465812a3 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.
2026-07-28 01:49:01 +02:00
Markus Hilger a9d7b67929 Derive build versions from a tracked VERSION file
Release tags do not live on master: 3.15.2 through 3.15.6 were tagged on branch
3.15, so git describe reaches only 3.15.1 and dev builds were stamped
3.15.2.dev<n>. Besides being confusing, rpm and dpkg both rank the released
3.15.6 above that, so a dev package will not install over a released one.

Add a top-level VERSION file naming the release the branch is working toward
(4.0.0 on master) and a mkversion helper that stamps packages from it, keeping
the tag-derived value as a floor so a forgotten bump cannot go backwards.
mkversion also replaces the block copy-pasted into seven build scripts, and
makesetup no longer writes a per-package VERSION file, so the stale checked-in
confluent_common/VERSION goes with it.
2026-07-27 20:06:22 +02:00
Markus Hilger 4f112fb78d Skip the profile manifest when the server libraries are absent
confluent_imgutil does not depend on confluent_server, and the yaml
import is optional too, yet both capture and pack dereference osimage
and yaml unconditionally when writing manifest.yaml.  With
confluent_osdeploy present but the server absent that raises rather
than producing a profile.

Guard the manifest on both being importable and say so, since rebase
is what the manifest exists for.  The yaml fallback now binds None
instead of leaving the name undefined.

The two call sites carried the manifest write verbatim in both, so fold
them into one function rather than duplicate the guard as well.
2026-07-27 18:49:48 +02:00
Markus Hilger 547ecf16d4 Release the crypt device if encrypt_image is interrupted
Nothing unwound the loop device and dm-crypt mapping when the copy loop
raised, so interrupting a pack stranded both, still holding the profile's
rootimg.sfs.

Tear them down from a finally.  The retry loop moves with them, so also
honour its tries counter, as unpack_image already does; spinning forever
inside a finally would hang the interrupt it is meant to clean up after.

A bounded retry loop can also give up, and the detach that follows would
then fail with EBUSY and, raising from a finally, replace the exception
that brought us here.  Warn and leave both in place instead.
2026-07-27 17:01:49 +02:00
Markus Hilger 4e9052012f Keep imgutil pack and capture synchronous
Both functions became coroutines solely to await one get_hashes call,
but their bodies are long stretches of blocking work: mksquashfs, the
encrypt_image copy loop, rsync, ssh and osdeploy.

From Python 3.11 on, asyncio.run installs a SIGINT handler that cancels
the main task and returns rather than raising, so an interrupt is only
noticed at the next await.  Interrupting a pack during mksquashfs
surfaced as a CalledProcessError from the dying child instead of a
KeyboardInterrupt, and with a base profile, where nothing is ever
awaited, pack carried on and published the profile before exiting.

Run the loop only around the call that needs it.
2026-07-27 17:01:33 +02:00
Markus Hilger aba564914f Limit imgutil manifest hashes to the profile source
capture and pack hash the whole profile directory, which by that point
holds rootimg.sfs, the kernel and the distribution initramfs.  rebase
only ever looks up entries that came from the profile source directory,
so the image blobs cost gigabytes of hashing for nothing.

Pass the source directory as the filter, as generate_stock_profiles
already does.  Older manifests keep working, since rebase reads their
entries with a default.
2026-07-27 17:01:18 +02:00
Jarrod Johnson 12ef3fc529 Merge pull request #245 from Obihoernchen/selinux
SELinux label diskless runtime files on EL
2026-07-16 20:10:43 -04:00
Markus Hilger cfc4490fe1 Use multi-threaded unsquashfs to extract untethered images
`unsquashfs` can use multiple CPU cores during image extraction, significantly reducing boot time.
For example the whole boot time from PXE to shell on a 8-core VM, from approximately 45 seconds to 20 seconds.

This PR adds `squashfs-tools` as a dependency. Since the package is smaller than 1 MB, the additional image size is justified by the performance improvement.

For backward compatibility, the existing `cp`-based extraction method is used when `unsquashfs` is unavailable, such as with images built before this change.

The extraction logic has also been moved into the common functions and is now shared between EL9, EL10, and Ubuntu.

Both untethered `squashfs` images and `confluent_multisquash` images are supported.

Images must be rebuilt to include `unsquashfs` and benefit from the faster extraction path.
2026-07-16 21:24:58 +02:00
Markus Hilger dd120dc5de Allow el10 capture in imgutil 2026-07-16 19:59:43 +02:00
Markus Hilger e1a066bf49 Use dhcpcd for EL10 capture prerequisites
EL10 diskless networking uses dhcpcd and no longer dhclient and ipcalc.
Keep the existing dhclient and ipcalc requirements for older EL capture targets.
2026-07-16 19:58:53 +02:00
Markus Hilger c3c4805f9d SELinux label diskless runtime files on EL
Centralize the SELinux chcon helper and use it for downloaded
systemd units, onboot hooks, and apiclient files across EL7 through EL10.
Include chcon in captured EL initramfs images.

Without this fix the onboot services failed to start on SELinux enabled
captured image.
2026-07-16 19:52:52 +02:00
Jarrod Johnson 81cf17360e arm64 boot assets pick up 2026-07-13 09:59:15 -04:00
Jarrod Johnson 12c35f2b96 Merge pull request #230 from Obihoernchen/crossarch
Add cross-architecture image build support to imgutil
2026-07-09 14:43:02 -04:00
Jarrod Johnson 0bbc75d53e Copy sshd-session helper if present 2026-07-09 14:24:34 -04:00
Markus Hilger 5945e8f22d Fix imgutil crash without arg 2026-07-09 19:11:09 +02:00
Markus Hilger 7633bac055 Add cross-architecture image build support to imgutil
Allow building EL and Ubuntu diskless images for a foreign architecture (e.g.
aarch64 on an x86_64 host) by leveraging qemu-user-static. The target
architecture is detected automatically from a -s source tree (for EL),
or may be requested explicitly with the new --arch option.

When the target differs from the host, dnf/debootstrap is invoked with
--forcearch/--arch and the presence of an enabled binfmt_misc handler
with the F (fix-binary) flag is verified up front, so emulation keeps working
inside the installroot chroot and a missing setup yields an actionable
error instead of a confusing exec failure mid-build.

The image architecture is recorded in confluentimg.buildinfo so that
pack selects the initramfs addons for the image architecture rather
than the build host, and exec of a foreign-arch root performs the same
binfmt check.
2026-07-09 19:11:09 +02:00
Markus Hilger dba2af71c7 Match Apache-2.0 license name with SPDX expressions
For EPEL the official SPDX license expressions have to be used.
Check:

- https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/
- https://spdx.org/licenses/
- https://docs.fedoraproject.org/en-US/legal/allowed-licenses/
2026-07-07 21:08:43 +02:00
Jarrod Johnson 41851082bc Mask architecture specific libraries in initramfs hook 2026-06-10 08:45:54 -04:00
Jarrod Johnson b3ef8bfc1e Add ubuntu 26.04 diskless 2026-06-10 08:14:20 -04:00
Jarrod Johnson 887e804894 Merge pull request #99 from VersatusHPC/imgutil-build-errors
fix(imgutil): propagate image build failures
2026-06-10 07:25:55 -04:00
Vinícius Ferrão 0757f9b48f fix(imgutil): propagate image build failures
Copy Debian apt sources and keyrings into the target before apt runs. Run apt with DEBIAN_FRONTEND=noninteractive.

Return constrained child status to callers, and make pack fail clearly when no kernel was installed.
2026-06-10 01:25:58 -03:00
Jarrod Johnson 3a09861ef6 Set name/email for debian builds 2026-06-05 14:27:05 -04:00
Jarrod Johnson 36b4de0859 Merge pull request #213 from VersatusHPC/xen-drivers
Include xen-front drivers in initramfs
2026-05-23 14:20:17 -04:00
Vinícius Ferrão e0f309a165 Include xen-front drivers in confluent-curated initramfs 2026-05-23 01:53:23 -03:00
Jarrod Johnson 1699175460 Have buildscripts fix their own directories 2026-05-22 10:30:29 -04:00
Jarrod Johnson 3d5663f9a7 Recognize some arm64 paths for imgutil 2026-05-20 12:39:09 -04:00
Jarrod Johnson bc0177388c Use %onlyarch in ubuntu diskless build 2026-05-19 09:53:35 -04:00
Jarrod Johnson ae2b86b51f Add mok manager to boot media for imgutil images 2026-05-14 16:55:33 -04:00
Jarrod Johnson 490a04f276 Include aarch64 names for key libraries in ubuntu diskless 2026-05-01 14:24:53 -04:00
Jarrod Johnson d03e689660 Fix imgutil async call 2026-04-30 10:26:54 -04:00
Jarrod Johnson 260443c1d6 Add Ubuntu 26.04 2026-04-24 08:35:27 -04:00