Posts about ciq (old posts, page 1)

Warewulf 101 | CIQ Webinar

Rose Stein and I talked about the latest Warewulf release, how to get involved in the Warewulf community, and what to expect in v4.5.5, and I demonstrated lifting image size limits with the new two-stage boot.

Benchmarking Containerized MPI with Apptainer on Dell PowerEdge and Cornelis Omni-Path

This article was also published via the CIQ blog on 6 September 2023.

In a previous article, I demonstrated how Warewulf makes it simple to deploy an HPC cluster. Now, I don’t know about you; but, once I have a cluster, I immediately start looking for something to run on it. But I’m a systems guy—not a domain scientist—so that usually means I start benchmarking.

Recently at CIQ, we’ve been advocating for attention and development around containerization of MPI using Apptainer. In particular, we’ve been championing the use of PMI to support completely portable MPI containerization, where the containerized application shares no MPI dependency with the host system. It’s our hope that, by making containerized MPI more portable and more broadly applicable, we’ll see even broader adoption of containerization in HPC.

But this increased adoption brings stronger questions about performance: do containerized MPI applications perform as well as the same applications running directly in the host environment?

So what are we doing here?

My focus here is on MPI performance, not necessarily CPU or memory performance. With that in mind, I selected the OSU Micro-Benchmarks suite for my test cases. In particular, I used osu_bw, osu_bibw, and osu_alltoall.

As I started to run benchmarks and follow my curiosity, the number of test cases grew: originally, this was just supposed to be a simple demonstration at the end of the previous article! But to keep even this separate writeup to a reasonable scope, I focused on these questions:

  • Does performance differ between the host Rocky Linux 8 environment and a container?

  • Does performance change if a Rocky Linux 9 container runs on a Rocky Linux 8 host?

  • Does performance differ between Apptainer containers with “user namespaces” compared to Apptainer running with its original SUID starter?

  • Does behavior change when running tasks across nodes vs. all on a single node?

Benchmark environment

To review: we’ve got a cluster of four compute nodes in a Dell PowerEdge C6525 multi-node server. Each node is equipped with 2x AMD EPYC 7702 CPUs, 256GiB system memory, and a 100Gb Cornelis Omni-Path HFI. All four nodes are connected to a single Cornelis Omni-Path switch.

To maintain consistency between the host and container environments, I used Spack v0.20.1 to build nine different versions of OSU Micro-Benchmarks, with variants for MPI (MPICH, MVAPICH, and Open MPI) and operating environment (the compute node’s Rocky Linux 8.8 environment, a Rocky Linux 8.8 SIF, and a Rocky Linux 9.2 SIF). I used Spack’s built-in “containerize” functionality to build the SIFs. The Spack “specs” for each build, and the Spack environment YAML files used for spack containerize, are included as attachments.

All tests were run on the same host kernel, 4.18.0-477.15.1.el8_8.x86_64, and all container tests used Apptainer version 1.2.2-1.el8.

All tests were run with the same Slurm arguments, including an explicit --nodelist argument to ensure that all tests were run on the same nodes. These complete commands are included in an attachment.

All three MPI implementations were built using libfabric which, in turn, was built with support for OPX, the latest and recommended libfabric provider for use with Cornelis Omni-Path. We were able to verify that OPX was being properly detected and activated using logging capabilities of libfabric common to all of our builds, and these records are attached as well.

Does performance differ between the host and a container?

Our first question is the simplest: does containerization with Apptainer reduce the MPI performance of an application? From our experience here, we can say that it does not. In fact, we saw somewhat improved latencies for osu_alltoall in containerized environments, and any bandwidth performance differences were within general run-to-run variance. In fact, some of our highest performance differences were observed simply from rebooting compute nodes and re-running the same test.

Raw results for these and other tests are included as attached CSV files at the end of the article.

Does performance change for a Rocky Linux 9 container?

Containerization isn’t just about running an application in an identical operating environment to the compute node host: it enables the flexibility to run different versions of an operating system, or even entirely different operating systems, within the container. So what if we run a different version of Rocky Linux–9.2, in our tests here–compared to the Rocky Linux 8.8 that is running on the compute node?

The question isn’t entirely unfounded: Cornelis Omni-Path support, for example, is built on a mixture of kernel and user-space components. For our tests, we’re using the support for OPA included in the Rocky Linux kernel, and each version of Rocky Linux includes user-space libraries and applications designed to work with its matching kernel components. The nature of containerization, however, implies that we’re using the kernel components from the host, regardless of what user-space code is running in the container. So what happens if we run an MPI built for a Rocky Linux 9.2 environment on a Rocky Linux 8.8 kernel?

While we obviously can’t speak for all kernel and user-space pairings, our results indicate that even this difference isn’t something to worry about. Most results were within run-to-run variance, with yet another apparent improvement in osu_alltoall latency. (This improvement probably shouldn’t carry too much weight, however, given the limitations of our testing methodology; but we’ll talk more about that in the conclusion.)

Does performance differ for Apptainer SUID and user namespace modes?

If you’ve been following Apptainer development, one of its more recent improvements is the transition, by default, from its original SUID-based runtime to the adoption of more modern Linux kernel support for user namespaces. For example, we need to be root to set up a container and, when building a container, to install packages within it. In the past, this has been accomplished with the use of starter-suid and fakeroot. Now, by default this is accomplished using Linux user namespaces.

But the questions remains: does Apptainer’s use of user namespaces impact performance?

We ran this test by physically uninstalling the apptainer-suid package. Similar to our previous results, we found that performance was effectively identical, once again with the most significant (but still only slight) variations observed in the latency of osu_alltoall.

figure1.jpg

Does behavior change for multi-node vs. single-node?

Up to now, all of our tests have been run with one MPI task per node; but we also wanted to check if behavior would change when multiple tasks were run on each node. However, there have been multiple reports of MPI breaking in Apptainer with user namespaces, particularly when using UCX. We wanted to check if the same behavior was observed with these libfabric builds of MPI without UCX.

For this particular test case, we focused specifically on osu_alltoall, as it supports running an arbitrary number of tasks. Rather than running one tasks per node across four nodes, we ran four tasks on one node, with two tasks per socket.

It is interesting to observe that MPICH and Open MPI latency degrades more in this scenario than MVAPICH. We also observed (though this is not represented in the charts) that the increase in latency is broadly similar between host and container environments. But more to the point of the test is the fact that MVAPICH breaks with 8MiB and larger messages. Our current understanding is that MVAPICH optimizes intra-node communication for different message sizes, and the method it uses for messages 8MiB and larger is blocked by different MPI tasks running in different user namespaces.

We’ve been investigating this issue upstream for some time now, including a pull request. Check back here soon for a whole article going into detail on why it’s breaking, how you might be able to work around it today, and how we’re hoping to fix it upstream!

Conclusion

While we did our best to be consistent and transparent in our methodology, these aren’t quite what we’d consider formal results. For example, we noticed significant performance variation from run-to-run, particularly after rebooting nodes that had been used for previous jobs and then sat idle. Improvements to our methodology might include reboots between each test and averaging the results from multiple runs. (We ran each test three times and used the third result.) All that said, we think that even this relatively anecdotal experience confirms what we and the Apptainer community have been saying for years: Apptainer containerization is suitable for use with HPC applications, including performance-sensitive MPI applications.

If you’re interested in learning more about the performance you can expect from your MPI applications in Apptainer, there are a number of studies:

We’re hopeful that these results can let HPC administrators and users alike proceed with confidence that they aren’t sacrificing performance when they take advantage of the operational and flexibility benefits of using Apptainer in their environment.

Deploying a Dell PowerEdge and Cornelis Omni-Path Cluster with Warewulf

This article was also published via the CIQ blog on 28 August 2023.

CIQ develops and supports open source software for HPC that simplifies your life as a cluster administrator. I recently had the opportunity to deploy and test this software in a Dell PowerEdge cluster with Cornelis Omni-Path networking, with equipment provided in generous partnership by Dell and Cornelis. Both PowerEdge and Omni-Path are frequently deployed in the HPC space due to their performance, reliability, and cost-effectiveness, so they provide a good platform to showcase how Warewulf makes it easy to deploy a cohesive HPC cluster at any scale.

figure1.jpg

Setting up the control node

The control node is a Dell PowerEdge R6525 equipped with 2x AMD EPYC 73F3 CPUs, 512GiB system memory, and a 100Gb Cornelis Omni-Path HFI. In this cluster, it runs the Warewulf server, fabric manager, and Slurm controller, starting from a Rocky Linux 8.6 base.

Installing Warewulf

Installing Warewulf v4 on the control node is a simple three-step process:

  • Install the Warewulf package.

  • Update the Warewulf configuration file.

  • Direct Warewulf to configure the system.

# dnf install https://github.com/hpcng/warewulf/releases/download/v4.4.1/warewulf-4.4.1-1.git_d6f6fed.el8.x86_64.rpm
# vi /etc/warewulf/warewulf.conf
# wwctl configure -a

Most of the work in that process goes into the configuration file; but, even then, there’s not much that is required. For reference, here’s the entirety of our warewulf.conf:

WW_INTERNAL: 43
ipaddr: 10.10.10.30
netmask: 255.255.255.0
network: 10.10.10.0
warewulf:
  port: 9873
  secure: false
  update interval: 60
  autobuild overlays: true
  host overlay: true
  syslog: false
dhcp:
  enabled: true
  template: default
  range start: 10.10.10.200
  range end: 10.10.10.209
  systemd name: dhcpd
tftp:
  enabled: true
  systemd name: tftp
nfs:
  enabled: true
  export paths:
path: /home
    export options: rw,sync
    mount options: defaults
    mount: true
path: /opt
    export options: ro,sync,no_root_squash
    mount options: defaults
    mount: true

The first step is to define ipaddr, netmask, and network. These three parameters configure the network for the control node itself and define the network and network interface that Warewulf uses to provision the cluster nodes.

Also important is dhcp range start and range end. These define the addresses that Warewulf uses during PXE provisioning. (Of particular note: these are not the addresses used by cluster nodes after they have been provisioned: nodes only use addresses from this range when they are downloading their node image.)

The Warewulf configuration file enables dhcp, tftp, and nfs by default, and we use these default settings in this test cluster. These services are then automatically configured by Warewulf using wwctl configure -a.

The fabric manager

The control and cluster nodes are connected via a single externally-managed 24-port Omni-Path 100 switch, and the control node serves as the fabric manager for the OPA network.

The OPA fabric manager software is available as a standard part of Rocky Linux.

# dnf install opa-fm
# systemctl enable –now opafm
# systemctl status opafm opa-basic-tools
# opainfo
hfi1_0:1                           PortGID:0xfe80000000000000:001175010178e59f
   PortState:     Active
   LinkSpeed      Act: 25Gb         En: 25Gb
   LinkWidth      Act: 4            En: 4
   LinkWidthDnGrd ActTx: 4  Rx: 4   En: 3,4
   LCRC           Act: 14-bit       En: 14-bit,16-bit,48-bit       Mgmt: True
   LID: 0x00000001-0x00000001       SM LID: 0x00000001 SL: 0
         QSFP Copper,       3m  Hitachi Metals    P/N IQSFP26C-30       Rev 02
   Xmit Data:               2658 MB Pkts:             15940870
   Recv Data:              11217 MB Pkts:             15170908
   Link Quality: 5 (Excellent)

Configuring Slurm

The control node is also running a Slurm controller from packages provided by OpenHPC.

# dnf install http://repos.openhpc.community/OpenHPC/2/CentOS_8/x86_64/ohpc-release-2-1.el8.x86_64.rpm
# dnf install slurm-slurmctld-ohpc
# cp /etc/slurm/slurm.conf{.example,}
# vi /etc/slurm/slurm.conf
# systemctl enable --now slurmctld munge
# scontrol ping
Slurmctld(primary) at admin1.dell-ciq.lan is UP

Configuring Slurm is somewhat out-of-scope for this article, but let’s go over some of the most pertinent directives for this deployment:

NodeName=c[5-8] Sockets=2 CoresPerSocket=64 ThreadsPerCore=1
PartitionName=opa Nodes=c[5-8] MaxTime=24:00:00 State=UP Oversubscribe=EXCLUSIVE
SlurmctldParameters=enable_configless

We’ve defined our four nodes, c[5-8] in Slurm, along with their basic CPU information. These four nodes are added to an opa partition that we can support jobs to. Finally, slurmctld itself is configured to enable “configless” mode, which allows compute nodes to get slurm.conf from the controller when they first connect, without having to distribute the config file to all nodes manually.

Compute nodes

The four compute nodes are a Dell PowerEdge C6525 multi-node server. Each node is equipped with 2x AMD EPYC 7702 CPUs, 256GiB system memory, and a 100Gb Cornelis Omni-Path HFI.

Adding compute nodes to Warewulf

Adding compute nodes to Warewulf is relatively straightforward. Our four nodes are named c[5-8], and each has an IP address for its default interface, its IPMI interface, and its OPA interface. Settings that are the same across all nodes, such as netmask, gateway, and IPMI credentials, are added to the default node profile.

# wwctl node add c5 --discoverable=yes --ipaddr=10.10.10.41 --ipmiaddr=172.29.235.41
# wwctl node add c6 --discoverable=yes --ipaddr=10.10.10.42 --ipmiaddr=172.29.235.42
# wwctl node add c7 --discoverable=yes --ipaddr=10.10.10.43 --ipmiaddr=172.29.235.43
# wwctl node add c8 --discoverable=yes --ipaddr=10.10.10.44 --ipmiaddr=172.29.235.44

# wwctl node set c5 --netname=opa --ipaddr=10.10.12.41
# wwctl node set c6 --netname=opa --ipaddr=10.10.12.42
# wwctl node set c7 --netname=opa --ipaddr=10.10.12.43
# wwctl node set c8 --netname=opa --ipaddr=10.10.12.44

# wwctl profile set default \
> --netmask=255.255.255.0 --gateway=10.10.10.30 \
> --ipmiuser=root --ipmipass=[redacted] \
> --ipminetmask=255.255.255.0 --ipmiinterface=lanplus

# wwctl profile set default --netname=opa --type=InfiniBand \
> --netdev=ib0 --onboot=true --netmask=255.255.255.0

Defining compute node images

One of the best features of Warewulf v4 is its support for OCI container images. This makes it near trivial to build and maintain compute node images for Warewulf clusters.

The compute node image in this environment is built on a community Warewulf Rocky Linux 8 image, and adds support for OpenHPC, Slurm, Apptainer, and OPA.

FROM ghcr.io/hpcng/warewulf-rockylinux:8.6

RUN dnf -y install \
      dnf-plugins-core \
      epel-release \
      http://repos.openhpc.community/OpenHPC/2/CentOS_8/$(uname -m)/ohpc-release-2-1.el8.$(uname -m).rpm \
    && dnf config-manager --set-enabled powertools \
    && dnf -y install \
         apptainer \
         ohpc-base-compute \
         ohpc-slurm-client \
         slurm-libpmi-ohpc \
         lmod-ohpc \
         chrony \
         opa-basic-tools \
         libpsm2 \
    && systemctl enable munge \
    && systemctl enable slurmd \
    && mkdir -p /var/spool/slurm \
    && dnf -y clean all

We could build and push this container to a registry to then import into Warewulf; but Warewulf can also import a saved OCI archive, which Podman can generate directly. Once the container is imported into Warewulf, we can set it as the container for the default node profile.

# podman build --tag compute-slurm-opa:latest compute-slurm-opa/
# podman save compute-slurm-opa:latest -o compute-slurm-opa.tar
# wwctl container import $(readlink -f compute-slurm-opa.tar) compute-slurm-opa
# wwctl profile set default --container=compute-slurm-opa

Overlays

We use a couple of overlays to customize the configuration of the cluster nodes. First, our slurm overlay captures distributes the munge key (used by Slurm for authentication within the cluster) and the defines the configuration server for slurmd.

# wwctl overlay create slurm
# wwctl overlay mkdir slurm /etc
# wwctl overlay mkdir slurm /etc/munge
# wwctl overlay mkdir slurm /etc/sysconfig
# wwctl overlay edit slurm /etc/sysconfig/slurmd
# wwctl overlay show slurm /etc/sysconfig/slurmd
SLURMD_OPTIONS="--conf-server admin1.dell-ciq.lan:6817"
# wwctl overlay import slurm /etc/munge/munge.key
# wwctl overlay list -a slurm
OVERLAY NAME                   FILES/DIRS
slurm                          /etc/
slurm                          /etc/munge/
slurm                          /etc/munge/munge.key
slurm                          /etc/sysconfig/
slurm                          /etc/sysconfig/slurmd

It’s important for cluster nodes to have synchronized time. Our chrony overlay configures compute nodes to synchronize time with the control node.

# wwctl overlay create chrony
# wwctl overlay import --parents chrony /etc/chrony.conf
# wwctl overlay edit chrony /etc/chrony.conf
# wwctl overlay show chrony /etc/chrony.conf | tail -n1
server admin1.dell-ciq.lan iburst

We add our newly-defined overlays to the default profile and rebuild overlays for the nodes.

# wwctl profile set default --wwinit wwinit,slurm,chrony
# wwctl overlay build

Booting the nodes

Since we configured IPMI when we added the nodes, we can use Warewulf’s IPMI support to power on our nodes remotely. Powering them on one-at-a-time ensures that node discovery correctly assigns the intended name to each discovered node.

# wwctl power on c5
# wwctl power on c6
# wwctl power on c7
# wwctl power on c8

Running a test application

In the end, we’re left with a working Slurm cluster, complete with the ability to run arbitrary containers directly from the internet with Apptainer!

$ srun --partition=opa apptainer run docker://alpine:latest sh -c 'echo $(hostname): Hello, world!'
INFO:    Using cached SIF image
c5: Hello, world!

Alternatively, OpenHPC packages can be installed on the control node and, since /opt is shared via NFS from the control node to cluster nodes, these packages are available at runtime through the lmod system.

$ srun --partition=opa sh -c 'module avail'

-------------------------- /opt/ohpc/pub/modulefiles ---------------------------
   cmake/3.24.2    hwloc/2.7.0         os            prun/2.2
   gnu9/9.4.0      libfabric/1.13.0    pmix/4.2.1    ucx/1.11.2

If the avail list is too long consider trying:

"module --default avail" or "ml -d av" to just list the default modules.
"module overview" or "ml ov" to display the number of modules for each name.

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching
any of the "keys".

Next steps

This article was originally meant to include a broad comparison of different MPI applications; but in the process of putting that together, I found a lot more interesting information than I wanted to just have here at the end. Be sure to read my next article, "Benchmarking Containerized MPI with Apptainer on Dell PowerEdge and Cornelis Omni-Path."

Using SMB with Mellanox OFED on Rocky Linux 8.4+

This article was also published via the CIQ blog on 15 June 2023.

Nvidia documents as a known issue the inability to mount CIFS and SMB shares when using their Mellanox OFED on Enterprise Linux (including Rocky Linux) 8.4 and beyond.

Description: OFED installation caused CIFS to break in RHEL8.4 and RHEL8.5. A dummy module was added so that CIFS will be disabled after OFED installation in RHEL8.4 and RHEL8.5. Workaround: N/A
Keywords: Installation, RHEL8.4, RHEL8.5, CIFS.
Discovered in Release: 5.4-0.5.1.1

At first, this seems an arbitrary restriction; but Enterprise Linux 8.4 added support for SMB-Direct, accelerating SMB performance over RDMA. This introduced a dependency between the cifs kernel module (which handles mounting of CIFS and SMB shares) and the ib_core and rdma_cm kernel modules (which handle RDMA). The Mellanox OFED replaces both ib_core and rdma_cm with its own versions. However, the Mellanox versions break compatibility with the OS-provided modules and, as a result, are incompatible with the OS-provided cifs module.

We consider three potential ways to address this incompatibility:

  • Nvidia could ship an updated cifs module along with Mellanox OFED that links against their rdma_cm and ib_core modules. (For now, Mellanox has stated that "CIFS is not a part of the NVIDIA product portfolio.")

  • We could rebuild the cifs module against the Mellanox kernel modules. This is what Nvidia has suggested.

  • We could rebuild the cifs module without SMB-Direct support, avoiding the dependency conflict.

The third option, while perhaps less than desirable, is the most straightforward path to restoring CIFS / SMB functionality as it existed prior to Rocky Linux 8.4, removing the conflict with the Mellanox OFED.

To demonstrate this process, we developed an OCI Containerfile which incorporates a rebuilt cifs module without SMB-Direct support. The resultant container can be used as a Warewulf node image.


FROM ghcr.io/hpcng/warewulf-rockylinux:8.7

COPY MLNX_OFED_LINUX-5.9-0.5.6.0-rhel8.7-x86_64.tgz /var/tmp/
COPY rpmbuild/RPMS/x86_64/kernel-modules-4.18.0-425.19.2.el8_7.x86_64.rpm /var/tmp/

RUN dnf -y install \
        libnl3 \
        numactl-libs \
        tcsh \
        elfutils-libelf-devel \
        gcc \
        gcc-gfortran \
        gdb-headless \
        kernel-rpm-macros \
        kernel-{core,devel,headers,modules,modules-extra}-4.18.0-425.19.2.el8_7.x86_64 \
        libtool \
        lsof \
        make \
        patch \
        perl \
        python36-devel \
        rpm-build \
        tk \
    && dnf -y reinstall /var/tmp/kernel-modules-4.18.0-425.19.2.el8_7.x86_64.rpm \
    && dnf -y remove $(dnf repoquery --installonly --latest-limit=-1 -q) \
    && tar -C /var/tmp -xf /var/tmp/MLNX_OFED_LINUX-5.9-0.5.6.0-rhel8.7-x86_64.tgz \
    && ( cd /var/tmp/MLNX_OFED_LINUX-5.9-0.5.6.0-rhel8.7-x86_64 \
       && ./mlnxofedinstall \
           --skip-repo \
           --kernel $(rpm -q kernel-core --qf '%{version}-%{release}.%{arch}\n' | tail -n 1) \
           --add-kernel-support) \
    && rm -rf /lib/modules/4.18.0-425.19.2.el8_7.x86_64/extra/mlnx-ofa_kernel/fs/cifs \
    && /usr/sbin/depmod 4.18.0-425.19.2.el8_7.x86_64 \
    && rm -rf /var/tmp/MLNX_OFED_LINUX* /var/tmp/*.rpm \
    && dnf clean all

COPY smb.conf /etc/samba/

RUN dnf -y install cifs-utils samba \
    && dnf clean all \
    && mkdir -p /srv/samba/shared \
    && chmod -R 0755 /srv/samba/shared \
    && chown -R nobody:nobody /srv/samba/shared \
    && systemctl enable smb

This Containerfile has three primary dependencies and concerns: the Mellanox OFED itself, a modified kernel-modules package, and (optionally) Samba for testing.

The Mellanox OFED

You can obtain a copy of the Mellanox OFED from the Nvidia website. You may need to modify this example Containerfile for the version of the OFED that you use; but for this example we used MLNX_OFED_LINUX-5.9-0.5.6.0-rhel8.7-x86_64.tgz.

Much of the Containerfile is concerned with installing the Mellanox OFED. This includes a list of packages that are dependencies of the installation process.

The Containerfile also removes the dummy mlnx-ofa_kernel/fs/cifs module. If this module is left in place it takes precedence over the OS cifs module.

Custom kernel modules

The main payload of the Containerfile is the addition of a custom cifs kernel module. To keep this as simple as possible, we rebuild the kernel package entirely, and then install the modified kernel-modules package.


dnf builddep
https://download.rockylinux.org/pub/rocky/8.7/BaseOS/source/tree/Packages/k/kernel-4.18.0-425.19.2.el8_7.src.rpm
rpm -i
https://download.rockylinux.org/pub/rocky/8.7/BaseOS/source/tree/Packages/k/kernel-4.18.0-425.19.2.el8_7.src.rpm
sed -i 's/^CONFIG_CIFS_SMB_DIRECT=.*/# CONFIG_CIFS_SMB_DIRECT is not set/'
~/rpmbuild/SOURCES/*.config
echo "%dist .el8_7" >>~/.rpmmacros
rpmbuild -ba rpmbuild/SPECS/kernel.spec

This procedure installs the dependencies for building the kernel, then installs the kernel source package. Installing a source package adds it to $HOME/rpmbuild in preparation for building. From there we update the packaged kernel config file to disable SMB-Direct, configure rpm-build to tag the new package as an el8_7 package (matching the upstream binary package of the same version) and build a new set of kernel packages.

The provided Containerfile copies the new kernel-modules package from the default build location, but you may need to update the Containerfile for the correct path on your system.

After installing the updated kernel-modules package, the Containerfile also manually runs depmod. This removes the now-missing dummy OFED cifs module from module dependency tree and ensures that the cifs module from the new kernel-modules package is included.

Testing it all with Samba

We included Samba (and cifs-utils) in the image to allow us to demonstrate the capability to mount an SMB share locally. To do this, we also included a minimal Samba configuration.


[global]
workgroup = WORKGROUP
server string = Samba Server %v
netbios name = rocky-8
security = user
map to guest = bad user
dns proxy = no

[Anonymous]
path = /srv/samba/shared
browsable =yes
writable = yes
guest ok = yes
read only = no

With this image booted on a compute node in a Warewulf cluster, we were able to mount the local Samba share, demonstrating that the functionality had been restored.


# mount -t cifs -o guest //localhost/Anonymous /mnt
# findmnt /mnt | cat -
TARGET SOURCE                FSTYPE OPTIONS
/mnt   //localhost/Anonymous cifs   rw,relatime,vers=3.1.1,sec=none,cache=strict,uid=0,noforceuid,gid=0,noforcegid,addr=0000:0000:0000:0000:0000:0000:0000:0001,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1

Conclusion

This new conflict between the Mellanox OFED and the upstream kernel highlights one of the potential risks of any out-of-tree kernel module: a lack of ABI compatibility. To avoid such incompatibilities we encourage Rocky Linux users to use native kernel modules whenever possible. However, if you need to use the Mellanox OFED, for hardware compatibility or performance reasons, this workaround should allow you to restore the ability to mount CIFS / SMB shares, albeit while missing out on the performance improvements available via SMB-Direct.

Managing Containerized Services with Apptainer and Systemd

This article was also published via the CIQ blog on 17 April 2023.

Apptainer is often compared to Docker as both a container runtime engine and container management environment. In general, each tool targets a different use case; but the two projects notably differ in their runtime strategy. In general, Docker is designed to host system services, and Apptainer is designed to containerize end-user applications (often in a batch-processing environment). Because of its service-oriented architecture, Docker containers are most commonly started in the background and run indefinitely. Apptainer has support for service containers, but Apptainer containers are most commonly started in the foreground for temporal, interactive use.

Apptainer’s architecture, however, is ultimately a more natural fit for the Linux ecosystem, as it comes with fewer embedded assumptions and is, ultimately, more flexible.

In the time since Docker’s architecture was first established, systemd has arisen as the de facto standard for service management in Linux. As such, we can easily use systemd to manage system services containerized with Apptainer. This technique should be compatible with most major Linux operating systems, including Rocky Linux, CentOS Stream, and Suse.

A minimal service container

First, here’s a an example definition file to use as a system service:

Bootstrap: docker
From: alpine:latest

%runscript
env; while true; do date; sleep 10; done

This is just a minimal Alpine Linux container that prints the current environment and then loops, printing the current date and time every 10 seconds. This suffices as an example system service that will run “forever” and that produces regular output, allowing us to confirm that the service is running properly.

I placed the example container at /usr/local/lib/apptainer/env-service.sif. (We’ll refer to that path later.)

$ apptainer build alpine-sleeper.sif alpine-sleeper.def
INFO:    Starting build...
Getting image source signatures
Copying blob f56be85fc22e skipped: already exists
Copying config 4798f93a2c done
Writing manifest to image destination
Storing signatures
2023/04/03 16:25:13  info unpack layer: sha256:
f56be85fc22e46face30e2c3de3f7fe7c15f8fd7c4e5add29d7f64b87abdaa09
INFO: Adding runscript
INFO: Creating SIF file...
INFO: Build complete: alpine-sleeper.sif

$ sudo mkdir -p /usr/local/lib/apptainer/
$ sudo mv alpine-sleeper.sif /usr/local/lib/apptainer/

systemd unit file

I then installed the following systemd unit file at /etc/systemd/system/apptainer@.service:

[Unit]
Description=Apptainer container: %I
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/apptainer run /usr/local/lib/apptainer/%i.sif
EnvironmentFile=-/etc/sysconfig/apptainer/%i.env
EnvironmentFile=-/etc/default/apptainer/%i.env

[Install]
WantedBy=multi-user.target

This unit file is a template that can start an Apptainer container from an image stored at /usr/local/lib/apptainer/.

The unit file will also optionally read environment configuration files from either /etc/sysconfig/apptainer/ or /etc/default/apptainer/.

The first time you put the unit file in place you’ll need to tell systemd to reload its configuration to make it available. (This is otherwise automatic on boot.)

systemctl daemon-reload

Configuring and starting the service

To demonstrate the configurability of the service environment, I placed an environment file at /etc/sysconfig/apptainer/alpine- sleeper.env.

TEST_VARIABLE=nar_value

You can now enable the service to run automatically at boot and/or start it immediately, as with any systemd service:

$ sudo systemctl start apptainer@alpine-sleeper
$ sudo systemctl status apptainer@alpine-sleeper
 apptainer@alpine-sleeper.service - Apptainer container: alpine/sleeper
   Loaded: loaded (/etc/systemd/system/apptainer@.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2023-04-04 11:46:31 MDT; 1s ago
 Main PID: 107209 (starter)
    Tasks: 9 (limit: 11364)
   Memory: 11.3M
   CGroup: /system.slice/system-apptainer.slice/apptainer@alpine-
sleeper.service
           107209 Apptainer runtime parent
           107224 /bin/sh /.singularity.d/runscript
           107249 sleep 10

Apr 04 11:46:31 rocky3 apptainer[107247]: LANG=en_US.UTF-8
Apr 04 11:46:31 rocky3 apptainer[107247]: PROMPT_COMMAND=PS1="
Apptainer> "; unset PROMPT_COMMAND
Apr 04 11:46:31 rocky3 apptainer[107247]: APPTAINER_BIND=
Apr 04 11:46:31 rocky3 apptainer[107247]: APPTAINER_CONTAINER=/usr/local
/lib/apptainer/alpine-sleeper.sif
Apr 04 11:46:31 rocky3 apptainer[107247]: SINGULARITY_BIND=
Apr 04 11:46:31 rocky3 apptainer[107247]: SINGULARITY_CONTAINER=/usr
/local/lib/apptainer/alpine-sleeper.sif
Apr 04 11:46:31 rocky3 apptainer[107247]: APPTAINER_NAME=alpine-sleeper.
sif
Apr 04 11:46:31 rocky3 apptainer[107247]: PWD=/
Apr 04 11:46:31 rocky3 apptainer[107247]: SINGULARITY_NAME=alpine-
sleeper.sif
Apr 04 11:46:31 rocky3 apptainer[107248]: Tue Apr  4 11:46:31 MDT 2023

The string to the right of the @ populates the %i and %I variables inside the unit file template, allowing you to manage any such container with the single unit file, each with a discrete set of input variables.

Further, the specified environment variables are passed through to the process inside the container.

$ journalctl -u apptainer@alpine-sleeper | grep TEST_VARIABLE
Apr 04 11:48:18 rocky3 apptainer[107375]: TEST_VARIABLE=nar_value

Monitoring the service

Recent logs for the service are available in the systemctl status output, and you can retrieve full logs using journalctl. e.g.,

journalctl -u apptainer@env-service.service

Because systemd typically runs each service in its own cgroup automatically, we even get cgroup-based process isolation for free with this technique. See the above systemctl status output, which reports the number of tasks, the total CPU time, and even the amount of memory consumed by the service and, by extension, the container.

Finally, process management works as you expect. I can stop the service, and the container stops as well.

$ pgrep -lif apptainer
107574 starter

$ sudo systemctl stop apptainer@alpine-sleeper
$ pgrep -lif apptainer || echo not running
not running

And if the process dies, the service reflects this.

$ sudo systemctl start apptainer@alpine-sleeper
$ sudo systemctl status apptainer@alpine-sleeper
 apptainer@alpine-sleeper.service - Apptainer container: alpine/sleeper
   Loaded: loaded (/etc/systemd/system/apptainer@.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2023-04-04 11:53:27 MDT; 10s ago
 Main PID: 107637 (starter)
    Tasks: 10 (limit: 11364)
   Memory: 11.8M
   CGroup: /system.slice/system-apptainer.slice/apptainer@alpine-
sleeper.service
           107637 Apptainer runtime parent
           107651 /bin/sh /.singularity.d/runscript
           107682 sleep 10

Apr 04 11:53:27 rocky3 apptainer[107674]: PROMPT_COMMAND=PS1="
Apptainer> "; unset PROMPT_COMMAND
Apr 04 11:53:27 rocky3 apptainer[107674]: APPTAINER_BIND=
Apr 04 11:53:27 rocky3 apptainer[107674]: APPTAINER_CONTAINER=/usr/local
/lib/apptainer/alpine-sleeper.sif
Apr 04 11:53:27 rocky3 apptainer[107674]: SINGULARITY_BIND=
Apr 04 11:53:27 rocky3 apptainer[107674]: SINGULARITY_CONTAINER=/usr
/local/lib/apptainer/alpine-sleeper.sif
Apr 04 11:53:27 rocky3 apptainer[107674]: APPTAINER_NAME=alpine-sleeper.
sif
Apr 04 11:53:27 rocky3 apptainer[107674]: PWD=/
Apr 04 11:53:27 rocky3 apptainer[107674]: SINGULARITY_NAME=alpine-
sleeper.sif
Apr 04 11:53:27 rocky3 apptainer[107675]: Tue Apr  4 11:53:27 MDT 2023
Apr 04 11:53:37 rocky3 apptainer[107681]: Tue Apr  4 11:53:37 MDT 2023

$ sudo kill 107651
$ sudo systemctl status apptainer@alpine-sleeper
 apptainer@alpine-sleeper.service - Apptainer container: alpine/sleeper
   Loaded: loaded (/etc/systemd/system/apptainer@.service; disabled;
vendor preset: disabled)
   Active: inactive (dead)

Apr 04 11:53:27 rocky3 apptainer[107674]: APPTAINER_CONTAINER=/usr/local
/lib/apptainer/alpine-sleeper.sif
Apr 04 11:53:27 rocky3 apptainer[107674]: SINGULARITY_BIND=
Apr 04 11:53:27 rocky3 apptainer[107674]: SINGULARITY_CONTAINER=/usr
/local/lib/apptainer/alpine-sleeper.sif
Apr 04 11:53:27 rocky3 apptainer[107674]: APPTAINER_NAME=alpine-sleeper.
sif
Apr 04 11:53:27 rocky3 apptainer[107674]: PWD=/
Apr 04 11:53:27 rocky3 apptainer[107674]: SINGULARITY_NAME=alpine-
sleeper.sif
Apr 04 11:53:27 rocky3 apptainer[107675]: Tue Apr  4 11:53:27 MDT 2023
Apr 04 11:53:37 rocky3 apptainer[107681]: Tue Apr  4 11:53:37 MDT 2023
Apr 04 11:53:47 rocky3 apptainer[107687]: Tue Apr  4 11:53:47 MDT 2023
Apr 04 11:53:48 rocky3 systemd[1]: apptainer@alpine-sleeper.service:
Succeeded.

You could even configure systemd to automatically restart the service, e.g., by specifying Restart=always.

Conclusion

Using systemd for Apptainer process management is different than Docker, but ultimately integrates with other traditional system services more seamlessly. Notably, Podman—a OCI-based Docker alternative included with Rocky Linux and many other Linux distributions—has first-class support for generating such systemd unit files as well.

You can read more about the configurability of systemd service unit files at https://www.freedesktop.org/software/systemd/man/systemd.service.html. Since this technique turns Apptainer containers into standard systemd services, you have access to all the service and process management capabilities of systemd, including declarative dependency management, process monitoring, and output capture.

Splitting Warewulf Images Between PXE and NFS

This article was also published via the CIQ blog on 6 December 2022.

Warewulf 4 introduced compatibility with the OCI container ecosystem, which greatly streamlines the process of defining, importing, and maintaining compute node images compared to other systems--even compared to Warewulf 3! But one aspect of compute node images remains unchanged: they can quickly grow in size.

Warewulf (and the technique of PXE-booting a node image more broadly) expects that a compute node image will remain relatively small. Larger sets of software, like you might provide via an Environment Modules stack or, perhaps, via Spack, are typically deployed via a central NFS share, which is then mounted at runtime by the booted compute node. Even OpenHPC, with software packaged as operating system containers, supports this paradigm, with packages installed on the head node, landing in /opt, and then being shared from the head node to compute nodes.

However, there are still benefits to maintaining this software as part of a compute node image; but such a large image can quickly grow to tens of gigabytes, making network booting difficult.

In this article I'll demonstrate how a full software stack can be managed together with a given compute node image, but the resultant payload can be split in-place between PXE-served netbooting and an NFS-mounted file system.

The root image

First, I start with the standard Rocky Linux 8 image as published by HPCng.

[root@wwctl1 ~]# wwctl container import docker://docker.io/warewulf/rocky:8 rocky-8-split

Installing some software

Using the OpenHPC project as a source, I install a set of typical scientific software. Most OpenHPC packages install software in /opt for distribution via NFS, which is what we're going to do: just a little bit differently than usual.

[root@wwctl1 ~]# wwctl container shell rocky-8-split
[rocky-8-split] Warewulf> dnf -y install 'dnf-command(config-manager)'
[rocky-8-split] Warewulf> dnf config-manager --set-enabled powertools
[rocky-8-split] Warewulf> dnf -y install epel-release http://repos.openhpc.community/OpenHPC/2/CentOS_8/x86_64/ohpc-release-2-1.el8.x86_64.rpm
[rocky-8-split] Warewulf> dnf -y install valgrind-ohpc {netcdf,pnetcdf,hypre,boost}-gnu9-mpich-ohpc

After installing the software our image is approaching 2GB. This isn't egregious (and the compressed image as sent over the network is even smaller), but gives us a point of comparison for what comes next.

[root@wwctl1 ~]# du -h /var/lib/warewulf/container/rocky-8-split.img{,.gz}
1.8G    /var/lib/warewulf/container/rocky-8-split.img
651M    /var/lib/warewulf/container/rocky-8-split.img.gz

Excluding the software from the final image

Warewulf consults /etc/warewulf/excludes within the image itself to define files that should not be included in the built image. For our example here, I exclude the full contents of /opt/, in anticipation that we'll be mounting it via NFS in stead.

[rocky-8-split] Warewulf> cat /etc/warewulf/excludes
/boot
/usr/share/GeoIP
/opt/*

Rebuilding the image with /opt/* excluded, the image is reduced in size, and further software installation would no longer increase the final size of the image delivered over PXE.

[root@wwctl1 ~]# du -h /var/lib/warewulf/container/rocky-8-split.img{,.gz}
1.1G    /var/lib/warewulf/container/rocky-8-split.img
483M    /var/lib/warewulf/container/rocky-8-split.img.gz

Exporting the software via NFS

With the software in /opt excluded from the image, we need to export it via NFS in stead. This is relatively easily done, though we must discover and hard-code paths to the container directory.

[root@wwctl1 ~]# readlink -f $(wwctl container show rocky-8-split)/opt
/var/lib/warewulf/chroots/rocky-8-split/rootfs/opt

Add an NFS export to /etc/warewulf/warewulf.conf, restart the Warewulf server, and configure NFS with wwctl. Note that I've specified mount: false for this export, as I want to control which nodes will mount it: presumably nodes that aren't using this image should not mount this image's software.

nfs:
  export paths:
  - path: /var/lib/warewulf/chroots/rocky-8-split/rootfs/opt
    export options: rw,sync,no_root_squash
    mount: false
[root@wwctl1 ~]# systemctl restart warewulfd
[root@wwctl1 ~]# wwctl configure nfs

Mounting the software on the compute node

We can mount this new NFS share just like any other, by listing it in fstab.

Warewulf typically configures fstab as part of the wwinit overlay. In order to mount this NFS share without setting mount: true for all nodes, I copy fstab.ww to a new overlay and add an additional entry.

[root@wwctl1 ~]# wwctl overlay list -a rocky-8-split
OVERLAY NAME                   FILES/DIRS
rocky-8-split                  /etc/
rocky-8-split                  /etc/fstab.ww

[root@wwctl1 ~]# wwctl overlay show rocky-8-split /etc/fstab.ww | tail -n1
{{ .Ipaddr }}:/var/lib/warewulf/chroots/rocky-8-split/rootfs/opt /opt nfs defaults 0 0

I can add the new overlay to our wwinit list, and the fstab in rocky-8-split will override the one in wwinit. (Note: --wwinit was specified as --system in Warewulf 4.3.0.)

[root@wwctl1 ~]# wwctl profile set --wwinit wwinit,rocky-8-split default
[root@wwctl1 ~]# wwctl profile set --container rocky-8-split default

From a compute node, we can see that /opt is mounted via NFS as expected.

[root@compute1 ~]# findmnt /opt
TARGET SOURCE                                                      FSTYPE OPTIONS
/opt   10.0.0.3:/var/lib/warewulf/chroots/rocky-8-split/rootfs/opt nfs4   rw,relatime,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.0.0.4,local_lock=none,addr=10.0.0.3

We can further confirm that /opt is empty on the local, PXE-deployed file system.

[root@compute1 ~]# mount -o bind / /mnt
[root@compute1 ~]# du -s /mnt/opt
0   /mnt/opt

Future work

As demonstrated here, we can already implement split PXE/NFS images using functionality already in Warewulf; but future Warewulf development may simplify this process further:

Container path variables in warewulf.conf

We could support referring to compute node images in warewulf.conf. For example, it would be nice to be able to replace

nfs:
  export paths:
  - path: /var/lib/warewulf/chroots/rocky-8-split/rootfs/opt
    export options: rw,sync,no_root_squash
    mount: false

with something like

nfs:
  export paths:
  - path: {{ containers['rocky-8-split'] }}/opt
    export options: rw,sync,no_root_squash
    mount: false

This way, our configuration would not have to hard-code the path to the container chroot.

Move NFS mount settings to nodes and profiles

Right now, NFS client settings are stored in warewulf.conf as mount options, mount, and implicitly via path; but if these settings were moved to nodes and profiles we could configure per-profile and per-node NFS client behavior without having to manually edit or override fstab.

Stateless provisioning of stateful nodes: examples with Warewulf 4

This article was also published via the CIQ blog on 30 November 2022.

When deploying Warewulf 4, we often encounter expectations that Warewulf should support stateful provisioning. Typically these expectations are born from experience with another system (such as Foreman, xCAT, or even Warewulf 3) that supported writing a provisioned operating system to the local disk of each compute node.

Warewulf 4 intentionally omits this kind of stateful provisioning from its feature set, following experiences from Warewulf 3: the code for stateful provisioning was complex, and required a disproportionate amount of maintenance compared to the number of sites using it.

For the most part, we think that arguments for stateful provisioning are better addressed within Warewulf 4's stateless provisioning process. I'd like to go over three such common use cases here, and show how each can be addressed to provision nodes with local state using Warewulf 4.

Local scratch

The first thing to understand is that stateless provisioning does not mean diskless nodes. For example, you may have a local disk that you want to provide as a scratch file system.

Warewulf compute nodes run a small wwclient agent that assists with the init process during boot and deploys the node's overlays during boot and runtime. wwclient reads its own initialization scripts from /warewulf/init.d/, so we can place startup scripts there to take actions during boot.

My test nodes here are KVM instances with a virtual disk at /dev/vda. This wwclient init script looks for a "local-scratch" file system and, if it does not exist, creates one on the local disk.

#!/bin/sh
#
# /warewulf/init.d/70-mkfs-local-scratch

PATH=/usr/sbin:/usr/bin

# KVM disks require a kernel module
modprobe virtio_blk

fs=$(findfs LABEL=local-scratch)
if [ $? -eq 0 ]
then
    echo "local-scratch filesystem already exists: ${fs}"
else
    target=/dev/vda
    echo "Creating local-scratch filesystem on ${target}"
    mkfs.ext4 -FL local-scratch "${target}"
fi

wwclient runs this script before it passes init on to systemd, so it is also processed before fstab. So we can mount the "local-scratch" file system just like any other disk in fstab.

LABEL=local-scratch /mnt/scratch ext4 defaults,X-mount.mkdir,nofail 0 0

The Warewulf 4 overlay system allows us to deploy customized files to nodes or groups of nodes (via profiles) at boot. For this example, I've placed my customized fstab and init script in a "local-scratch" overlay and included it as a system overlay, alongside the default wwinit overlay.

# wwctl overlay list -a local-scratch
OVERLAY NAME                   FILES/DIRS
local-scratch                  /etc/
local-scratch                  /etc/fstab.ww
local-scratch                  /warewulf/
local-scratch                  /warewulf/init.d/
Local-scratch                  /warewulf/init.d/70-mkfs-local-scratch

# wwctl profile set --system wwinit,local-scratch default
# wwctl overlay build

Because local-scratch is listed after wwinit in the "system" overlay list (see above), its fstab overrides the definition in the wwinit overlay. 70-mkfs-local-scratch is placed alongside other init scripts, and is processed in lexical order.

A node booting with this overlay will create (if it does not exist) a "local-scratch" file system and mount it at "/mnt/scratch", potentially for use by compute jobs.

Disk partitioning

But perhaps you want to do something more complex. Perhaps you have a single disk, but you want to allocate part of it for scratch (as above) and part of it as swap space. Perhaps contrary to popular opinion, we actively encourage the use of swap space in an image-netboot environment like Warewulf 4: a swap partition that is at least as big as the image to be booted allows Linux to write idle portions of the image to disk, freeing up system memory for compute jobs.

So let's expand on the above pattern to actually partition a disk, rather than just format it.

#!/bin/sh
#
# /warewulf/init.d/70-parted

PATH=/usr/sbin:/usr/bin

# KVM disks require a kernel module
modprobe virtio_blk

local_swap=$(findfs LABEL=local-swap)
local_scratch=$(findfs LABEL=local-scratch)

if [ -n "${local_swap}" -a -n "${local_scratch}" ]
then
    echo "Found local-swap: ${local_swap}"
    echo "Found local-scratch: ${local_scratch}"
else
    disk=/dev/vda
    local_swap="${disk}1"
    local_scratch="${disk}2"

    echo "Writing partition table to ${disk}"
    parted --script --align=optimal ${disk} -- \
        mklabel gpt \
        mkpart primary linux-swap 0 2GB \
        mkpart primary ext4 2GB -1

    echo "Creating local-swap on ${local_swap}"
    mkswap --label=local-swap "${local_swap}"

    echo "Creating local-scratch on ${local_scratch}"
    mkfs.ext4 -FL local-scratch "${local_scratch}"
fi

This new init script looks for the expected "local-scratch" and "local-swap" and, if either of them is not found, uses parted to partition the disk and creates them. As before, this is done before fstab is processed, so we can configure these with fstab the standard way.

LABEL=local-swap swap swap defaults,nofail 0 0
LABEL=local-scratch /mnt/scratch ext4 defaults,X-mount.mkdir,nofail 0 0

This configuration went into a new parted overlay, allowing us to configure some nodes for "local-scratch" only, and some nodes for this partitioned layout.

# wwctl overlay list -a parted
OVERLAY NAME                   FILES/DIRS
parted                         /etc/
parted                         /etc/fstab.ww
parted                         /warewulf/
parted                         /warewulf/init.d/
parted                         /warewulf/init.d/70-parted

# wwctl profile set --system wwinit,parted default
# wwctl overlay build

(Note: I installed parted in my system image to support this; but the same could also be done with sfdisk, which is included in the image by default.)

Persistent storage for logs

Another common use case we hear concerns the persistence of logs on the compute nodes. Particularly in a failure event, where a node must be rebooted, it can be useful to have retained logs on the compute host so that they can be investigated when the node is brought back up: in a default stateless deployment, these logs are lost on reboot.

We can extend from the previous two examples to deploy a "local-log" file system to retain these logs between reboots.

(Note: generally we advise not retaining logs on compute nodes: in stead, you should deploy something like Elasticsearch, Splunk, or even just a central rsyslog instance.)

#!/bin/sh
#
# /warewulf/init.d/70-parted

PATH=/usr/sbin:/usr/bin

# KVM disks require a kernel module
modprobe virtio_blk

local_swap=$(findfs LABEL=local-swap)
local_log=$(findfs LABEL=local-log)
local_scratch=$(findfs LABEL=local-scratch)

if [ -n "${local_swap}" -a -n "${local_log}" -a -n "${local_scratch}" ]
then
    echo "Found local-swap: ${local_swap}"
    echo "Found local-log: ${local_log}"
    echo "Found local-scratch: ${local_scratch}"
else
    disk=/dev/vda
    local_swap="${disk}1"
    local_log="${disk}2"
    local_scratch="${disk}3"

    echo "Writing partition table to ${disk}"
    parted --script --align=optimal ${disk} -- \
        mklabel gpt \
        mkpart primary linux-swap 0 2GB \
        mkpart primary ext4 2GB 4GB \
        mkpart primary ext4 4GB -1

    echo "Creating local-swap on ${local_swap}"
    mkswap --label=local-swap "${local_swap}"

    echo "Creating local-log on ${local_log}"
    mkfs.ext4 -FL local-log "${local_log}"

    echo "Populating local-log from image /var/log/"
    mkdir -p /mnt/log/ \
      && mount "${local_log}" /mnt/log \
      && rsync -a /var/log/ /mnt/log/ \
      && umount /mnt/log/ \
      && rmdir /mnt/log

    echo "Creating local-scratch on ${local_scratch}"
    mkfs.ext4 -FL local-scratch "${local_scratch}"
fi

For the most part, this follows the same pattern from the "parted" example above; but adds a step to initialize the new "local-log" file system from the directory structure in the image.

Finally, the new file system is added to fstab, after which logs will be persisted on the local disk.

LABEL=local-swap swap swap defaults,nofail 0 0
LABEL=local-scratch /mnt/scratch ext4 defaults,X-mount.mkdir,nofail 0 0
LABEL=local-log /var/log ext4 defaults,nofail 0 0

Some applications may write logs outside of /var/log; but, in these instances, it's probably easier to configure the application to write to /var/log than to try to capture all the places where logs might be written.

The future

There are a few more use cases that we sometimes hear brought up in the context of stateful node provisioning:

  • How can we use Ansible to configure compute nodes?

  • How can we configure custom kernels and kernel modules per node?

  • Isn't stateless provisioning slower than having the OS deployed on disk?

If you'd like to hear more about these or other potential corner-cases for stateless provisioning, get in touch! We'd love to hear from you, learn about the work you're doing, and address any of the challenges you're having.

Warewulf Deep Dive | CIQ Webinar

I'm really excited about Warewulf 4! I'm also really excited about OpenHPC, Apptainer, and containerizing HPC workloads, particularly MPI. Today I presented my most recent work in these areas in the CIQ webinar.

We're doing these webinars every week! I hope you'll join us Thursdays at 11:00 Pacific time, either via YouTube or LinkedIn.

Apptainer Signatures | CIQ Webinar

I had the pleasure of participating in my first CIQ webinar today! Check it out if you'd like to learn a bit about Apptainer's support for cryptographic signatures, using well-established PGP infrastructure and paradigms.

I hope you'll join us for our next session! We're live every Thursday at 11:00 Pacific time, streaming to YouTube and LinkedIn.