Run the rendered %post --nochroot blocks of each kickstart template
whose %pre writes /tmp/pre-install.log the way anaconda runs them: in
the installer, with its own /tmp and the installed system at
/mnt/sysimage. Each run must append the log to a new or an existing
xcat.log. The riscv64 profile test now keeps the installer's /tmp out
of the installed root too. Both fail on the old templates, whose chroot
%post reads a /tmp that does not hold the log.
Run the new test in the profile artifact job.
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.
Render the rhels9 and rhels10 kickstarts with no partitionfile, a custom
partitionfile and a custom partition script, each with xcatdebugmode 0,
1 and 2, and run %pre in a sandbox. The custom input holds credentials
in the =, separated, quoted, escaped and split option forms, a boot
loader password and a root password. The pre-install log must show the
generated partition scheme, or a notice for custom input, with neither a
credential nor a traced decoded byte of the custom input, and anaconda
must still get the custom partition definitions.
Run the new test in the profile artifact job.
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.
The riscv64 profile test runs every rendered %post block as if it ran in
the installed system. Anaconda runs a --nochroot block in the installer,
with the installed system at /mnt/sysimage, so give such a block that
view.
The stateless xcatroot of dracut_047, run in a chroot with NetworkManager
leases of the dhclient and internal clients in the initrd, must copy
both into the root under their own names. CI now runs the xcatroot test
as root.
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.
imgutils_staged_boot_files.t covers the publication of boot files. The
remaining checks of the unit test openeuler_genimage_bootfiles.t cover
disable_vendor_repositories, so the file now has that name.
The native EL cases checked that genimage keeps copying the kernel into
place before dracut runs, which the next change removes.
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.
The test runs both detect_dhcpd scripts with a fake tcpdump, and its
capture cases need private mount and network namespaces. It now lives in
xCAT-test/native with the other namespace tests, and the pull-request
workflow runs it in its own step. The capture cases keep their own unshare
call, because they add a default route on the loopback interface.
The unit test ran the Debian init helpers in the host shell, with fake
ucf, update-rc.d, systemctl and mv first in the host PATH. It now runs them
with sandbox_run in xCAT-test/native, with the compatibility root apart from
the /etc of the sandbox, and the Debian package lifecycle step runs it.
The unit test sourced scriptlib in the host Bash, with a fake nmcli first
in the host PATH. It now runs the helper with sandbox_run in
xCAT-test/native, and the pull-request workflow runs it in its own step.
State that on Subiquity installs the partition definition file or script
provides a curtin storage section that replaces the default layout, that
a layout without a match is restricted to the disk a disk entry selects,
that a failed layout or disk entry stops the install, that the first disk
of a disk file is used, and that a disk script runs in the live installer
under dash. Name the file that the disk file and the disk script write as
/tmp/xcat.install_disk, which both Ubuntu installers read, instead of
/tmp/install_disk.
A layout without a match that follows a disk file gets a match on the
disk the file selects, resolved when it is a link, and a use_gap layout
that follows a disk file stops the install. A layout with its own match
and a layout without a disk entry are kept as written.