On riscv64, an installed openEuler node reserves no dump memory, so
kdump.service fails and the node boots degraded.
The openEuler kickstart %post adds the kdump.service drop-in that
stateless images get. It runs before post.rhels8, which ends the %post
script with exit 0. A node whose command line carries crashkernel= or
fadump= still starts kdump.
openEuler diskless images enable kdump.service, which @core brings in. A
stateless command line reserves dump memory only through linuximage.dump
or addkcmdline, so on every other node kdump.service fails and the node
boots degraded.
genimage adds a kdump.service drop-in with triggering conditions on
crashkernel and fadump, so the service is skipped when the command line
has neither. POWER firmware-assisted dumps, which xCAT configures with
fadump= and no crashkernel=, still start. An image without kdump.service
is unchanged.
Shared image utilities must not require the Debian source directory.
Keep the profile helper beside imgutils and materialize the Debian copy
when building RPM and DEB packages. Source-only Debian copies must follow
symlinks; installed Debian directories stay self-contained.
Twelve conflicts, all from xcat-core/#7970 landing.
Eleven are the one sed line in the netboot postinstall profiles, where #7970 and
this branch replaced the same line with different patterns. Master's wins: it
anchors on optional leading blanks and preserves a trailing comment, which this
branch's `s/^SELINUX=.*$/SELINUX=disabled/` would have eaten. This branch's own
postinstall_selinux_config.bats asserts "the comment that names permissive keeps
its text", so the better pattern is the one its test already wanted -- 6 of 6
pass on master's version. What master's pattern does not catch is a value
outside enforcing|permissive, which nothing here tests and no stock config
ships.
The twelfth is .github/workflows/xcat_test.yml: master added a step to the
existing job and this branch adds a whole selinux_policy_test job after it.
Resolved as the union, with master's step where it put it; the file still parses
and names three jobs.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Share the readable-file search between Debian genimage and imgutils.
Keep version fallbacks and path normalization with each caller so
Debian retains its existing search order and returned paths.
Match the complete enforcing or permissive setting. Preserve comments and
whitespace, and do not change unrelated lines or create a missing policy
file.
genimage gives the stateless dracut initial ramdisk of an Ubuntu image
the same UFTP receiver as an EL image, under the same conditions.
xcatroot receives the first copy of the image over UFTP when nodeset
asks for it, and checks it like an HTTP download.
The kernel does not pass an argument with a dot, such as xcat.uftp=,
to init as a variable. The Ubuntu xcatroot reads these arguments with
the dracut getarg function, in a subshell, so its other variables keep
their sources.
genimage gives the stateless initial ramdisk of a SLES or openSUSE Leap
image with dracut 033 or later the same UFTP receiver as an EL image. It
adds the helper and uftpd when the image has the UFTP 5 receiver of
xcat-dep for its architecture, checks the built ramdisk, and marks it
for nodeset. xcatroot receives the first copy of the image over UFTP
when nodeset asks for it, and checks it like an HTTP download.
genimage adds the UFTP fetch helper and uftpd to the stateless initial
ramdisk of an EL image that has the UFTP 5 receiver of xcat-dep for its
architecture. It checks that the built ramdisk holds the receiver files.
It writes a marker with the digest of the published ramdisk, which
nodeset compares before it asks for UFTP. Without a usable receiver,
genimage removes the helper and the marker.
When nodeset passes xcat.uftp=, xcatroot receives the first copy of the
image over UFTP. The helper asks the listener for the archive that the
checksum file names, as fetched before the request. xcatroot checks the
received file against the checksum file like an HTTP download. A
mismatch or a failed transfer is followed by the HTTP download loop.
UFTP is used only together with rootimgchecksum=yes.
Booting nodes need a server that sends a published root image once to
every node that asks for it in a short window.
xcat-uftp-listener accepts HTTP/1.0 GET requests that name an image
path and its digest. It serves only an archive that packimage published
under the configured image roots, for a digest that the checksum file
lists. It keeps the archive open from the first request, so a later
packimage does not change the bytes of a queued batch. It collects the
requests for the same inode, digest and port for batch_delay seconds,
then runs one closed-group uftp session for the batch. Connections,
queued jobs, senders and receivers per job are limited.
The sender gets an argument vector built only from the configuration,
and signs the encrypted session with a persistent server key. It drops a
receiver that misses nearly every block of a section, so one node
without multicast cannot hold the session open. A sender that is not the
UFTP 5 build of xcat-dep is refused.
block_size allows larger packets on jumbo frame networks, up to the
8800-byte limit of uftp.
xCAT::UFTP holds the decisions of the listener: request checks, batches,
limits, timeouts and the runtime check. The script holds the sockets,
the key commands and the sender processes.
The packages install the service but do not enable it. Package removal
stops and disables it.
compute.rhels10.aarch64.postinstall arrived after the other netboot
postinstall scripts were anchored, and it carries the old pattern:
s/SELINUX=enforcing\|permissive/SELINUX=disabled/. The alternation binds
to the whole pattern, so the right branch is the bare word permissive.
On a permissive image the substitution writes SELINUX=SELINUX=disabled,
which no SELinux reads, and it rewrites the comment line that names
permissive. On a disabled image it still rewrites that comment.
Anchor the pattern to the SELINUX= line, as the other scripts do.
postinstall_selinux_config.bats fails three of its six checks against
this script before the change.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The substitution had two unanchored alternatives, SELINUX=enforcing and the bare word
permissive. An image whose /etc/selinux/config reads SELINUX=permissive therefore gets
SELINUX=SELINUX=disabled, which the policy loader rejects, so the image boots with
SELinux enabled. The bare alternative also matches the comment that lists the three
values, so every image gets a rewritten comment line.
The substitution is now anchored on the whole assignment, the form xcatconfig already
uses. Thirteen scripts carry it, and eleven more postinstall paths are symlinks into
those files.
The postinstall scripts source no shared library, so each copy is edited in place.
Symlinks are how this tree already shares a postinstall between distributions.
The xcat_inventory fixture test1.postinstall is changed as well. cases.environment
names it as the postinstall attribute of an osimage, so genimage runs it on a real
diskless image.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
netboot_supported() answered 1 for rhels8 and later and for every
openEuler, so mknetboot wrote no selinux= argument and a stateless node
was asked to run SELinux enforcing. It does not boot.
A stateless root is a cpio archive unpacked into tmpfs, and cpio carries
no SELinux label, so the root starts unlabelled. Three boots of an
AlmaLinux 10.1 image on an enforcing node measured both ways out of
that, on cluster xcat163:
- With the stock dracut selinux module, which this branch added to the
module list, the policy loads at pre-pivot 50 over the unlabelled
initramfs. 61 Permission denied lines follow, setfiles returns 126 and
the node loops. That module ships with check() returning 255, so no
image enables it by accident.
- Without it, and with the relabel hook corrected, setfiles labels the
root: /usr/lib/systemd/systemd reads init_exec_t. systemd then loads
the policy after switch_root, cannot relabel /dev or /run, and stops
with "Failed to allocate manager object. Freezing execution".
The hook could not have worked as written either. It read the mode with
sed piped into tail, and the initramfs has neither tail nor chroot:
chroot arrived with the selinux module. The console reported "tail:
command not found" twice and relabelled nothing.
So netboot_supported() answers 0, mknetboot writes selinux=0 for every
stateless node and nodeset says why. The code that only serves a
stateless node with SELinux on is removed with it: the relabel hook and
its two installers, the selinux dracut module, write_image_config, and
the squashfs label machinery that stored labels nothing reads. The
netboot postinstalls and the stateless xcatroot write SELINUX=disabled
again, so the image says what the kernel command line does.
What stays is what was measured working: a diskful node provisioned
enforcing with zero xCAT denials, the kickstart templates, the policy
package, and the service node mount options.
Tests: selinux_netboot_kcmdline.t fails 34 of its 69 checks on the
parent commit. selinux_cn_diskless_disabled_by_design in cases1
provisions a stateless node asked for enforcing and requires selinux=0
on its command line and getenforce Disabled. selinux_image_config.t and
selinux_squashfs_labels.t go with the subs they tested.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Every compute and service node was provisioned with SELinux disabled.
mknetboot added selinux=0, the kickstart templates said selinux
--disable, and the genimage postinstall and the dracut hooks wrote
SELINUX=disabled into the image. noderes.selinux and site.selinux had no
consumer on the node side.
The mode that xCAT::SELinux->node_modes resolves now reaches the node:
- Kernel command line: mknetboot appends kcmdline_selinux(): selinux=0
for disabled, enforcing=0 for permissive, nothing for enforcing. An
image built without the relabel hook (EL7 and older), and a squashfs
image without labels, boot with selinux=0 and nodeset says why.
Test: selinux_netboot_kcmdline.t.
- Kickstart: #SELINUXMODE# and #SELINUXRELABEL# in xCAT::Template. The
rh el8/9/10, riscv64 and openEuler templates use them; the %post ends
with restorecon -RF over the paths the xCAT scripts write. mkinstall
warns when a template cannot express the mode of the node.
Test: selinux_kickstart_template.t.
- genimage: the el8-10 postinstalls no longer write SELINUX=disabled, and
the stateless xcatroot no longer writes /etc/sysconfig/selinux. genimage
sets SELINUX=enforcing in the image, adds dracut 98selinux, and installs
a pre-pivot hook that runs setfiles with the image file_contexts unless
selinux=0 is set. Tests: selinux_image_config.t, selinux_relabel_hook.bats.
- packimage -m squashfs stores the labels of the image policy through
mksquashfs pseudo xattr definitions (squashfs-tools 4.6 or later), and
writes rootimg.sfs.selinux beside the image. Test:
selinux_squashfs_labels.t.
- Service nodes mount /install and /tftpboot from the management node with
context=public_content_t and tftpdir_t when SELinux is on.
Test: selinux_sn_mount_options.t.
- makedns no longer warns about SELinux. xcatprobe xcatmn checks the xcat
module and the labels of installdir and tftpdir instead of failing on
enforcing. Test: probe_utils_selinux_policy.t.
The selinux/cases1 xcattest cases provision a diskful, a stateless and a
squashfs node enforcing, and a stateless node with site.selinux=disabled.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Use relative aliases for identical shipped profiles. Keep their public names,
resolved contents and executable modes. Custom copies remain independent.
mount_chroot bind-mounts the host /run into the image root before the
run directory exists there. On the first build of a new image, mount
fails with "mount point does not exist". genimage does not check the
result, so the packages install without the host /run.
Create the directory first, as mount_chroot already does for /proc,
/sys and /dev. The mount also uses the subroutine argument instead of
the global image path. Both have the same value at every call site.
Nodes could not know whether an image turned the root image checksum on.
An initial ramdisk built before the check booted the image unchecked,
and nothing reported it. An archive packed before the check had no
checksum for a new initial ramdisk to find.
When the image or the site turns the checksum on, nodeset adds
rootimgchecksum=yes to the kernel command line of the node. This applies
to stateless and statelite ramdisk nodes. genimage writes
<initrd>.rootimgcheck next to an initial ramdisk that can check. The
marker holds the SHA-256 checksum of the initial ramdisk, so a replaced
ramdisk does not match it. imgexport and imgimport carry the marker with
the ramdisk.
When the checksum is on, nodeset warns once for each image whose initial
ramdisk has no matching marker. Its nodes may boot the image unchecked.
nodeset judges the initial ramdisk in TFTP after it copies the boot
files, because nodes boot that copy, also with --noupdateinitrd. A copy
that fails is now an error for the node, instead of a boot entry for the
previous boot files.
genimage and nodeset write a checksum for each archive of the image
directory that has none, also when the check is off. Nodes with older
boot entries still check. genimage does it before it copies a new
initial ramdisk to TFTP, and nodeset before it copies the boot files of
a node. Both hold the publication lock while they write. When they
cannot write the checksum, they keep the boot files that nodes use now
and report how to recover. With the check off, nodeset reports it as a
warning instead, and still sets up the node. nodeset marks the boot
files of an image as copied only after this step succeeds. When the
first node of an image fails it, the next node copies them.
The change covers the Red Hat, SUSE and Ubuntu nodeset plugins, which
share one helper in xCAT::SvrUtils.
xcatroot extracted whatever curl or wget downloaded, so a damaged
download became the root file system of the node.
After the download, xcatroot fetches the .sha256 file next to the image
and compares it with sha256sum. It also fetches that file before each
download. A download passes when it matches a line of either file, so a
download that began before packimage replaced the image still passes.
The check can fail for any reason, such as a missing checksum file or a
missing sha256sum. xcatroot then removes the download, logs the reason,
waits, and downloads the image again. A file that an earlier attempt
left is checked like a new download. xcatroot checks only when the
kernel argument rootimgchecksum=yes asks for it, and logs when it does
not check. An older xCAT server never passes the argument, so a new
initial ramdisk boots from it unchecked, as before.
The change covers the stateless modules of dracut 033, 047 and 105 for
the Red Hat family, dracut 033 for SUSE, and the Ubuntu module. These
modules also download statelite ramdisk images. Their initial ramdisks
now include sha256sum.
Add the linuximage gpgcheck attribute. When it is set to 1 or yes,
genimage passes --gpgcheck to the shared RPM image builder, which
exports the builder's trusted RPM keys exactly as it does for openEuler
and writes gpgcheck=1 with that gpgkey for the pkgdir, kerneldir and
otherpkgdir repositories. Unset keeps the existing unverified
configuration, openEuler stays always verified, and builders without
the option reject the attribute instead of ignoring it.
Collect the otherpkgs repositories in imgutils so that an otherpkgdir
holding only URLs no longer adds a file:/// repository that fails to
download metadata on EL.
Signed-off-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
xCAT builds and runs on aarch64, but two pieces were missing for an EL10
aarch64 management node:
- No compute.rhels10.aarch64.{pkglist,exlist,postinstall}, so genimage
fell back to the generic EL8/9-shaped compute.pkglist (dhclient,
busybox-anaconda), which does not resolve on EL10 aarch64. Add the rh
files (same content as the other EL10 architectures) with alma/rocky
aliases, following the x86_64/ppc64le layout.
- xCAT.spec had Requires blocks for x86, ppc and riscv64 but none for
aarch64, so an aarch64 install pulled no ipmitool-xcat. Add the block,
mirroring riscv64: ipmitool-xcat plus ipxe-xcat (an aarch64 management
node can serve x86 nodes); the x86-only PXE stack stays excluded.
Tests: extend el10_netboot_dhcp_client.t to the aarch64 lists and add
aarch64_packaging.t for the spec block and the netboot file layout.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Timothy Middelkoop <tmiddelkoop@internet2.edu>
Unknown x86 clients and netboot=ipxe nodes boot the upstream iPXE
loader of the ipxe-xcat package, which the xCAT packages did not
install.
The specs require ipxe-xcat where they require xnba-undi: on x86 and
ppc for xCAT, and on x86 for xCATsn. xCAT on riscv64 and xCATsn on ppc
and riscv64 require ipxe-xcat alone, because a POWER or riscv64 server
can serve x86 nodes. The xcat and xcatsn debs depend on ipxe-xcat on
every architecture for the same reason. go-xcat installs and removes
ipxe-xcat with the other packages.
xnba-undi stays a dependency, because netboot=xnba nodes still boot
xNBA.
A sourced go-xcat returns before the main program, which defined
riscv64_install_list, so a test that sources the script could not call
the filter. The function is now defined above the main program. A run of
the script does the same as before.
reg_linux_diskfull_installation_flat never finishes on openEuler. The install completes, the
postscripts run, and then the node reboots into the installer again and repeats, so the case waited
an hour and the node stayed at status=installing.
post.xcat.ng ends with updateflag.awk, the call its own comment calls the one that must always run
to prevent infinite installation loops. It passed $MASTER, a hostname. The anaconda %post chroot on
openEuler has no /etc/resolv.conf and no management node entry in /etc/hosts, so gawk cannot open
the socket. From the node's own /var/log/xcat/xcat.log:
awk: /xcatpost/updateflag.awk:15: warning: remote host and port information
(xcat58-mn, 3002) invalid: Name or service not known
updateflag.awk: Retrying flag update
It retries ten times, gives up, and the status is never sent. Nothing reports it: the retry message
goes to logger, and a %post chroot runs no rsyslog.
The same script already uses $MASTER_IP for all 36 of its other callbacks, and the kickstart sets it
to the same host: MASTER_IP=192.168.58.1, MASTER=xcat58-mn. All six updateflag calls now use the
address, so none of them depends on a resolver the node does not have.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
After `apt-get remove`, dpkg reports a package as "deinstall ok
config-files". uninstall_xcat_completely() selected packages with
installed_packages(), which accepts only "install ok installed". So
`go-xcat completely uninstall` after `go-xcat uninstall` did not purge
the xCAT packages, and their configuration files stayed on the node.
uninstall_xcat_completely() now uses purgeable_packages(). On Debian it
also accepts packages whose state ends in "ok config-files". On rpm
systems it is installed_packages(). uninstall_xcat() keeps the
installed-only filter.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
go-xcat runs internal_setup and the main program at file scope. A test
that sources the script to read its package lists or call its functions
starts the installer, so the tests extracted function bodies with awk and
evaluated them instead.
When go-xcat is sourced, it now skips internal_setup and returns before
the main program. A direct run and a run from a pipe do not change.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
Master fixed debuild-xcat-genesis-base and added a bats test for it. The
branch deleted that script as unused. The merge keeps the script and
moves it to xCAT-genesis-base with the other Genesis base files.
Master also stages verify-genesis-payload for the spec %install check.
stage_genesis_base_sources() now stages it too, and
genesis_base_sources_staged.t expects it in the tarball.
The workflow, builds.rst and xcat_probe_package_payload.t take the
master version.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>