post.rhels8 turns on every NIC that has link during the installation.
The USB NIC of a BMC host interface always has link, so the installed
node starts DHCP on it at boot, gets no lease, and
NetworkManager-wait-online fails.
post.rhels8 now skips NICs bound to a USB class driver: cdc_ether,
cdc_ncm, cdc_eem or rndis_host, which Linux binds to the USB gadget of a
BMC. USB Ethernet adapters with their own driver, the other NICs with
link, and NICs without a sysfs entry come up as before.
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.
geninitrd ran genimage --onlyinitrd for netboot and statelite images and
ignored its exit status. When genimage failed, geninitrd still exited
with 0. The errors that the genimage client writes to stderr did not
reach the user.
geninitrd now passes the genimage output to the client with stderr
included. When genimage ends with a status other than 0, geninitrd
reports an error and exits with the genimage exit code, or with 1 when
genimage could not run.
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 takes a comma-separated list of layout, d: disk
and c: configuration entries, any of them prefixed with s: for a script.
The Ubuntu layout step chose between decoding a layout file and running a
layout script by the s: prefix of the last entry in the whole list, so a
layout file followed by an s:d: disk script was run as a script, and a
layout script followed by a d: disk file was copied into the layout as
text. The parser also kept a script flag set by an earlier entry of the
same kind after a later entry replaced it.
Give each kind the prefix of the entry that is used, the last one of that
kind, and decode the Ubuntu layout by it.
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.
openEuler publishes RVA20 and RVA23 builds of each riscv64 release. Both
carry the same .treeinfo identity, so copycds copies the second one into
the directory of the first, and the result is a repository with packages
of two builds.
copycds now compares the .discinfo description, RVA23 or empty, with the
copy already in the target directory, and refuses a different build. Media
of the same build, and every other architecture, copy as before.
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.
genimage and packimage admit openEuler images only for x86_64 and
ppc64le. For the riscv64 osimage that copycds creates, genimage stops with
"Unsupported openEuler release or architecture" and packimage with
"Unsupported openEuler image release or architecture".
Admit riscv64 in both commands.
copycds looks for EFI/BOOT/grubriscv64.efi on riscv64 media. openEuler
media carry the same image as EFI/BOOT/grubriscv64.EFI, so copycds
publishes no grub2.riscv64. A management node with only openEuler media
then has no riscv64 network boot loader.
Match the image name case-insensitively, as UEFI does.
openEuler publishes 24.03 LTS installation media for riscv64, but the
openEuler media check admits only x86_64 and ppc64le. copycds stops with
"Unsupported openEuler architecture in .treeinfo".
Admit riscv64 as well. aarch64 stays refused.
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.
A #CRYPT# template entry rendered as an empty string when the passwd
table had no row for its key. An EL kickstart then held a bare
"rootpw --iscrypted", and anaconda stopped with "A single argument is
expected for the rootpw command". nodeset reported no error.
nodeset now reports the missing passwd row and writes no boot
configuration for the node, as it does for a missing #TABLE# field.
#CRYPTORLOCKED# still renders a locked password.
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.