The EL8 and later kickstart templates append /tmp/pre-install.log to
/var/log/xcat/xcat.log in the chroot %post. Anaconda runs that block in
the installed system, whose /tmp does not hold the installer's log, so
the %pre output, such as the install disk and the partition layout,
never reaches the node's xcat.log.
Copy the log in a %post --nochroot block before the main %post, from
the installer's /tmp to the installed system at /mnt/sysimage. The EL6
and EL7 templates use %include for this and are unchanged.
pre.rhels8 and pre.rhels10 print /tmp/partitionfile into the
pre-install log, so that the partition scheme can be inspected after
the installation. A custom partitionfile can hold credentials, such as
the --passphrase of an encrypted partition or a boot loader --password,
and the log then holds them in clear text. With site.xcatdebugmode 1 or
2, %pre also traces the decoding of a custom partitionfile or partition
script, and the trace spells out every decoded byte.
The pre-install log now shows the partition scheme only when xCAT
generated it, and says that a custom partition file is not logged. The
decoding of a custom partitionfile or partition script runs untraced.
/tmp/partitionfile, which anaconda reads, is unchanged.
xcatroot passes the DHCP lease of the initrd to the root image only from
/tmp/dhclient.*.lease, which the old dracut network scripts write. An
initrd that runs NetworkManager keeps its lease in /var/lib/NetworkManager.
The NetworkManager of the root takes over the same connection, finds no
lease and starts again with DHCPDISCOVER while the address stays on the
interface. A DHCP server that does not answer in time makes
NetworkManager-wait-online fail, and when the DHCP timeout expires
NetworkManager removes the address from the boot interface.
xcatroot now also copies the NetworkManager leases, so the root renews
the lease of the initrd with a DHCPREQUEST. Only the stateless xcatroot
of dracut_047 changes; statelite and the other dracut modules keep their
handoff.
imgutils.pm imports File::Copy with an empty list, so the module exports no
function and a bare move() is not defined. use_host_resolver calls move()
unqualified, so it dies with "Undefined subroutine &imgutils::move called" the
first time genimage reaches it, before it has moved either file aside.
Every other call site in the file already qualifies the name:
File::Copy::cp at line 139, File::Copy::copy at 208 and at 302, the last of
them two lines below the defect. The call is now qualified the same way.
xCAT-test/unit/imgutils_host_resolver.t and imgutils_reused_root.t both die at
load on the unfixed tree and pass with the fix, 34 tests.
Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
The Red Hat-family genimage took the image operation lock with
--onlyinitrd only for openEuler. Two geninitrd runs on another release,
or a geninitrd run during packimage, could publish and roll back boot
files over each other.
genimage now takes the lock with --onlyinitrd for every release, as it
already does for a full build.
publish_staged_boot_files looked for the backup of a file during the
rollback to decide whether to restore it or remove the published file.
When that lookup failed, it removed the published file, and the staging
cleanup then removed the backup.
publish_staged_boot_files now records each backup that it makes and
rolls back from that record. A file without an earlier copy is one for
which link reports ENOENT. Any other link error stops the publication.
On NFS, a rename can take effect and still report a failure after the
client retries the request. publish_staged_boot_files then put back
only the files that it published before, so the new file stayed next
to the older set, and the staging cleanup removed its backup.
When the staged copy of the file is gone after a failed rename,
publish_staged_boot_files now puts back that file too.
The Red Hat-family genimage staged and published the boot files only
for openEuler. For the other releases, it copied the kernel into the
image directory before it built the initial ramdisks, and it ignored a
failed kernel copy and a failed move of a ramdisk. When dracut failed,
the new kernel stayed next to the ramdisks of the earlier build. On
images without dracut, a failed cpio replaced the ramdisks with empty
archives.
genimage now builds the kernel and both ramdisks in a temporary
directory inside the image directory for every release, and publishes
them with publish_staged_boot_files after both ramdisks are built. It
stops when the kernel copy, dracut, the move of a ramdisk or any command
of the cpio pipeline fails. openEuler keeps its single stateless
ramdisk.
The Ubuntu and the Red Hat-family genimage each had their own code to
find and copy the kernel of the image and to pack a cpio initial
ramdisk. imgutils now has copy_kernel and pack_initrd for this, and the
Ubuntu genimage uses them.
copy_kernel also takes lib/modules/<release>/vmlinuz, which the Red
Hat-family genimage already takes.
genimage copied the kernel to the image directory before it built the
initial ramdisks. When dracut failed for either ramdisk, a new kernel
stayed next to the old ramdisks, and nodeset copied that set. The
legacy ramdisk ignored a failed cpio pipeline and published what the
compressor wrote.
genimage now builds the kernel and both ramdisks in a staging
directory in the image directory. It publishes them together with
publish_staged_boot_files after both ramdisks are built, and writes the
root image check and UFTP markers after that. A failure leaves the
previous kernel and ramdisks in place.
publish_boot_files publishes one kernel with one initial ramdisk, so a
genimage that builds the statelite and the stateless ramdisk cannot
use it. publish_staged_boot_files publishes the kernel and the ramdisks
of several modes from one staging directory. When a rename fails, it
puts back every file that it already replaced.
publish_boot_files keeps its interface for the openEuler build.
genimage ran debootstrap on every run. For Ubuntu 19.04 and later,
debootstrap extracts with tar -k, so a second run on an existing root
image failed at base-files and blamed the mirror.
genimage now skips debootstrap when an earlier run finished it and
updates the image with apt. The image holds the dummy resolv.conf and
the otherpkgs apt sources of that run. Before the first apt command,
genimage removes the apt sources that it writes again later and gives
the image the hosts and resolv.conf of the build host. A .bak file
that an interrupted run left is kept, so the image still gets its own
file back.
genimage stops with an error and leaves the root image unchanged in
three cases. The root image holds another Ubuntu release or
architecture, the debootstrap directory of an unfinished run, or the
bin/uname-binary backup of an interrupted run.
genimage took the last kernel of a sorted file list. When an image
held 6.8.0-99-generic and 6.8.0-100-generic, it published -99 and
built the initrds for it. The uname of the image build also reported
-99 to the package scripts, and it ignored an explicit kernelver.
genimage and that uname now compare kernel releases number by number,
so both choose -100. An explicit kernelver decides for both.
packimage, rmimage and the EL genimage take the image operation lock
of a root image, but the Ubuntu genimage did not. packimage or rmimage
could work on a root image while genimage installed packages in it,
and two genimage or geninitrd runs could change one root image at the
same time.
genimage now takes the lock before it changes the root image, for a
full build and for the --onlyinitrd run of geninitrd, and holds it
until it exits.
A Subiquity layout written with "layout:" and no "match" goes to the
largest disk. With a d: or s:d: entry in linuximage.partitionfile, that
disk need not be the one the entry selected, so the install could wipe a
disk the entry was meant to keep it off.
When a disk entry is configured, give such a layout a match on the
selected disk. Refuse a use_gap layout in that case, because some
Subiquity releases ignore match in use_gap mode and would install into
free space on another disk. A layout with its own match, a "config:"
layout and a layout without a disk entry are kept as written.
A disk script or layout script that failed, or a disk or layout entry that
held nothing usable, left the disk getinstdisk chose or the default layout
in place, and the install went on to wipe that disk. A layout whose
storage section is missing or empty is worse: Subiquity then puts LVM on
the largest disk. The entry exists to keep the install off some disks, so
these fallbacks can destroy the disk it protects. A valid layout that
started a YAML document also broke the install, because it was appended
to autoinstall.yaml as a second document.
When a disk or layout entry is configured, require it to succeed and to
write a disk name, or a storage section with a config or a layout, and
stop the pre-install script with an error otherwise. Subiquity then stops
before it partitions. Rewrite an accepted layout as a YAML fragment that
holds only the storage section. Without an entry, the detected disk and
the default layout are used as before.
linuximage.partitionfile had no effect on Ubuntu 20.04 and later installs.
The Subiquity pre-install script decodes each entry with base64decode,
which uses read -n, and Subiquity runs the script under dash, which has no
read -n. A layout file decoded to an empty storage config, which stops the
install, and a layout script or disk script decoded to nothing. The d: and
s:d: disk step also ran after the script had written the storage config,
so a disk file could not change the disk that getinstdisk chose, which
prefers a disk that already holds an operating system.
Decode with coreutils base64, which the live system ships, and run the
disk step before the storage config is written. The storage config uses
the first disk the disk file names, because the layout uses one disk, and
names it by its device node: Subiquity matches the path literally and
finds no disk for a /dev/disk/by-id link.
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.
list_xcat_packages reads the terminal width with tput cols. With an
unknown or unset TERM, tput prints "unknown terminal" or "No value for
$TERM" in the middle of the go-xcat output.
Check the terminal type with tput longname, with its output discarded,
before reading the width. tput cols keeps its stderr, because the tput
of ncurses 5 (EL7) reads the width through stderr. With stderr
discarded, it reports 80 columns on a wider terminal.
check_repo_version_apt looks for the "Candidate:" label of apt-cache
policy. A translated apt prints that label in the user's language. The
package table of go-xcat check, install and update then showed every
package as "(not found)" in the repositories.
Run apt-cache policy with LC_ALL="C" inside check_repo_version_apt, so
that every caller gets the untranslated labels. Drop the LC_ALL=C that
the install filter added.
The dracut_105 xcatroot scripts and the statelite xcat-prepivot.sh
copied dhclient leases and wrote an ifcfg file for the boot interface.
EL10 has no dhclient and no ifcfg plugin. The copy failed with "cannot
stat" on every boot, and the ifcfg write failed on a directory that the
image does not have. NetworkManager in the initrd already hands the boot
interface to the NetworkManager of the root image.
The scripts no longer copy leases or write ifcfg files.
NetworkManager in an EL10 diskless image made a DHCP profile for every
Ethernet port without one. A port with a link but no DHCP server kept
NetworkManager-wait-online from finishing, so the node booted degraded.
Diskful nodes are not affected, because anaconda writes a profile for
every port.
genimage now sets no-auto-default=* in the NetworkManager configuration
of EL10 images. The boot interface keeps the profile from the initial
ramdisk. The other interfaces get only the profiles that the image or
the xCAT network configuration gives them.
genimage wrote an ifcfg file for each interface that otherifce or
genimage -r names. EL10 reads no ifcfg files, and its images have no
network-scripts directory. Such an interface got DHCP only from the
profile that NetworkManager makes for any port without one.
genimage now writes a NetworkManager keyfile with DHCP for each of these
interfaces on EL10 and later. A rebuild replaces the keyfiles of the
earlier build. Older releases still get the same ifcfg files.
The EL10 riscv64 fix-up removed every UEFI boot entry for shimx64,
grubx64 or grubriscv64, on any disk. The default partition layout
installs to one disk and keeps the others, so an operating system on
another disk lost its boot entry.
The fix-up now removes only the entries on the ESP of the new install.
Anaconda removes the entries with its own label before it adds its own,
so an install that recreated the ESP leaves no old entry behind. When
lsblk reports no partition GUID for the ESP, the fix-up removes nothing
and still adds the new entry.
On apt, go-xcat handed its whole list to one apt-get install, so a package the
repositories lack aborted the install. ipxe-xcat is in the install list but
not in the latest apt repositories, and no riscv64 apt repository has
xcat-genesis-openembedded-riscv64.
Install the packages that have a candidate and warn about each one that has
none, as dnf --setopt=strict=0 already does on EL. A missing xcat metapackage
still stops the install, because it depends on every package a management
node needs. A failed apt-cache policy query also stops it, so a broken cache
is not taken for missing packages. The query runs in the C locale, because a
translated apt prints no "Candidate:" label.
apt 3, which Ubuntu 26.04 ships, has no apt-key, so go-xcat stopped with
"import xcat apt key failed" before it configured a repository. On Ubuntu
18.04 to 24.04, apt-key also fails when gnupg is not installed, and go-xcat
does not install it.
Decode the armored key with base64 and install it as the binary keyring
/etc/apt/trusted.gpg.d/xcat.gpg. Every apt release reads that file, while
apt 1.0 and 1.2 on Ubuntu 14.04 and 16.04 ignore an armored key there. The
key stays trusted for all repositories, as it was with apt-key. A complete
uninstall removes the key with the repository files.
As with apt-key, a download that holds no public key stops go-xcat and
leaves the installed key in place. go-xcat refuses a download whose armored
blocks do not all end with their END line, as a truncated download does. It
accepts the keyring only when it starts with a public key packet, the check
apt applies to a binary keyring.
The riscv64 default driver lists had no i40e or ice, so the initrd of a
diskless image could not bring up the network of a riscv64 server with an
Intel X710 or E810 adapter. Add both drivers to the EL and Ubuntu rows.
genimage pulls their module dependencies from modules.dep.
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>