Skip to content

Commit

Permalink
Add install-zfs-dkms-module example
Browse files Browse the repository at this point in the history
- [x] Add install-zfs-dkms-module example Containerfile and readme
- [x] Add install-zfs-dkms-module example to main readme
- [x] Add install-zfs-dkms-module github workflow file
- [x] Test build install-zfs-dkms-module example
  • Loading branch information
thwiest-celonis committed Sep 3, 2023
1 parent 7442c84 commit ef51469
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/install-zfs-dkms-module.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Build image: install-zfs-dkms-module"

env:
IMAGE_NAME: "install-zfs-dkms-module"

on:
pull_request:
branches:
- main
paths:
- install-zfs-dkms-module/*
- .github/workflows/install-zfs-dkms-module.yml
push:
branches:
- main
paths:
- install-zfs-dkms-module/*
- .github/workflows/install-zfs-dkms-module.yml

jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Build container image
uses: redhat-actions/buildah-build@v2
with:
context: ${{ env.IMAGE_NAME }}
containerfiles: ${{ env.IMAGE_NAME }}/Containerfile
image: ${{ env.IMAGE_NAME }}
layers: false
oci: true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ functionality.
- [butane](butane/): Demos using https://github.com/coreos/butane
- [initramfs-module](initramfs-module/): Demos generating a initramfs with specific modules added and omitted.
- [inject-go-binary](inject-go-binary/): Demos adding building and injecting a Go binary + systemd unit
- [install-zfs-dkms-module](install-zfs-dkms-module/): Install ZFS DKMS Kernel Module
- [podman-next](podman-next): Use COPR to install the podman-next package
- [rsyslog](rsyslog/): Install and configure rsyslog to forward to a remote host
- [replace-kernel](replace-kernel): Replace the kernel using packages from Koji
Expand Down
23 changes: 23 additions & 0 deletions install-zfs-dkms-module/Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Install ZFS DKMS Kernel Module
FROM quay.io/fedora/fedora-coreos:stable

# Install ZFS repository
RUN rpm-ostree install \
https://zfsonlinux.org/fedora/zfs-release-2-3$(rpm --eval "%{dist}").noarch.rpm && \
ostree container commit

# Install dkms dependencies
RUN rpm-ostree install kernel-devel kernel-devel-matched kernel-headers kernel-srpm-macros && \
ostree container commit

# TODO: Remove the following line once these bugs are fixed:
# - https://github.com/coreos/rpm-ostree/issues/4201
# - https://github.com/coreos/rpm-ostree/issues/1614
RUN test -f /usr/bin/ld || ln -s /usr/bin/ld.bfd /usr/bin/ld

# Install zfs package and tell dkms to install the kernel module now
RUN rpm-ostree install zfs && \
dkms autoinstall -k $(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}') && \
rm -vrf /var && \
test -h /usr/bin/ld && rm -v /usr/bin/ld && \
ostree container commit
7 changes: 7 additions & 0 deletions install-zfs-dkms-module/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Install ZFS DKMS Kernel Module

This example installs the [ZFS](https://openzfs.org/) [DKMS](https://en.wikipedia.org/wiki/Dynamic_Kernel_Module_Support) kernel module.

This is useful because typically DKMS modules are built during system startup after a kernel has been updated. This doesn't work in `ostree` based distributions because DKMS attempts to install kernel modules into `/usr`, which on `ostree` based distributions is mounted read-only.

This example is not specific to ZFS and should be able to be applied to other DKMS modules.

0 comments on commit ef51469

Please sign in to comment.