Compare commits

...

6 Commits

Author SHA1 Message Date
Jarno Rankinen b2c0378b6b UCore stable kernel & prebuilt ZFS packages + Sanoid
- Kernel RPMs from ghcr.io/ublue-os/coreos-stable-kernel image
- Matching ZFS RPMs from ghcr.io/ublue-os/akmods-zfs image
- Sanoid installed from gregw-extras-fedora-40 COPR
- Remove RPM firefox
2024-08-11 19:16:39 +03:00
Jarno Rankinen 9e3911e3dc Attempt #2 at using a newer ubuntu for build
- Try to fix invalid mount type "bind" for 'RUN --mount'
2024-08-11 18:54:44 +03:00
Jarno Rankinen 99db442590 Remove manual zfs scrub timer+service, provided by sanoid RPM 2024-08-11 18:54:41 +03:00
Jarno Rankinen d343e5fe39 Revert "Remove manual zfs timers, try ubuntu-latest"
This reverts commit 4ba9fe4fa2.
2024-08-11 18:49:46 +03:00
Jarno Rankinen 4ba9fe4fa2 Remove manual zfs timers, try ubuntu-latest
- RUN --mount=type=bind throws errors
2024-08-11 18:45:35 +03:00
Jarno Rankinen a0dbc64971 UCore stable kernel & prebuilt ZFS packages + Sanoid
- Kernel RPMs from ghcr.io/ublue-os/coreos-stable-kernel image
- Matching ZFS RPMs from ghcr.io/ublue-os/akmods-zfs image
- Sanoid installed from gregw-extras-fedora-40 COPR
- Add systemd timers for weekly ZFS scrubs
2024-08-11 18:37:21 +03:00
4 changed files with 49 additions and 48 deletions

View File

@ -21,7 +21,7 @@ env:
jobs: jobs:
build_push_aurora: build_push_aurora:
name: Build and publish SB image with ZFS name: Build and publish SB image with ZFS
runs-on: ubuntu-20.04 runs-on: ubuntu-24.04
permissions: permissions:
contents: read contents: read

View File

@ -40,46 +40,29 @@ ARG SOURCE_TAG="40"
ARG FEDORA_VERSION=40 ARG FEDORA_VERSION=40
### 2. Build ZFS module ## Cache images for CoreOS kernel & ZFS kmod RPMs
## Adated from https://github.com/coreos/layering-examples/blob/main/build-zfs-module/Containerfile FROM ghcr.io/ublue-os/coreos-stable-kernel:${SOURCE_TAG} AS kernel-cache
FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${SOURCE_TAG} as kernel-query FROM ghcr.io/ublue-os/akmods-zfs:coreos-stable-${SOURCE_TAG} AS zfs-cache
RUN rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}' > /kernel-version.txt
# Using https://openzfs.github.io/openzfs-docs/Developer%20Resources/Custom%20Packages.html
FROM registry.fedoraproject.org/fedora:${FEDORA_VERSION} as builder
COPY --from=kernel-query /kernel-version.txt /kernel-version.txt
WORKDIR /etc/yum.repos.d
RUN curl -L -O https://src.fedoraproject.org/rpms/fedora-repos/raw/f${FEDORA_VERSION}/f/fedora-updates-archive.repo && \
sed -i 's/enabled=AUTO_VALUE/enabled=true/' fedora-updates-archive.repo
RUN dnf install -y jq dkms gcc make autoconf automake libtool rpm-build libtirpc-devel libblkid-devel \
libuuid-devel libudev-devel openssl-devel zlib-devel libaio-devel libattr-devel elfutils-libelf-devel \
kernel-$(cat /kernel-version.txt) kernel-modules-$(cat /kernel-version.txt) kernel-devel-$(cat /kernel-version.txt) \
python3 python3-devel python3-setuptools python3-cffi libffi-devel git ncompress libcurl-devel
WORKDIR /
# Uses project_id from: https://release-monitoring.org/project/11706/
RUN curl "https://release-monitoring.org/api/v2/versions/?project_id=11706" | jq --raw-output '.stable_versions[0]' >> /zfs_version.txt
RUN curl -L -O https://github.com/openzfs/zfs/releases/download/zfs-$(cat /zfs_version.txt)/zfs-$(cat /zfs_version.txt).tar.gz && \
tar xzf zfs-$(cat /zfs_version.txt).tar.gz && mv zfs-$(cat /zfs_version.txt) zfs
WORKDIR /zfs
RUN ./configure -with-linux=/usr/src/kernels/$(cat /kernel-version.txt)/ -with-linux-obj=/usr/src/kernels/$(cat /kernel-version.txt)/ \
&& make -j1 rpm-utils rpm-kmod
### 3. SOURCE IMAGE ### 2. SOURCE IMAGE
## this is a standard Containerfile FROM using the build ARGs above to select the right upstream image ## this is a standard Containerfile FROM using the build ARGs above to select the right upstream image
FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${SOURCE_TAG} FROM ghcr.io/ublue-os/${SOURCE_IMAGE}${SOURCE_SUFFIX}:${SOURCE_TAG}
### 4 Add ZFS RPMS and matching kernel RPMs ### 3. Add ZFS RPMS and matching kernel RPMs
#COPY --from=ghcr.io/0ranki/sb-zfs-kernel /rpms/ /tmp/rpms # COPY --from=kernel-cache /tmp/rpms/* /tmp/rpms/
COPY --from=builder /zfs/*.rpm /zfs/ # COPY --from=zfs-cache /rpms/kmods/zfs/*.rpm /tmp/rpms/
### 5. MODIFICATIONS ### 4. MODIFICATIONS
## make modifications desired in your image and install packages by modifying the build.sh script ## make modifications desired in your image and install packages by modifying the build.sh script
## the following RUN directive does all the things required to run "build.sh" as recommended. ## the following RUN directive does all the things required to run "build.sh" as recommended.
COPY build.sh /tmp/build.sh COPY build.sh /tmp/build.sh
RUN mkdir -p /var/lib/alternatives && \ RUN --mount=type=cache,dst=/var/cache/rpm-ostree \
--mount=type=bind,from=kernel-cache,src=/tmp/rpms,dst=/tmp/rpms/kernel \
--mount=type=bind,from=zfs-cache,src=/rpms/kmods/zfs,dst=/tmp/rpms/zfs \
mkdir -p /var/lib/alternatives && \
/tmp/build.sh && \ /tmp/build.sh && \
ostree container commit ostree container commit
## NOTES: ## NOTES:

View File

@ -7,15 +7,9 @@ This is a customized Universal Blue image with the OpenZFS kernel module install
See [upstream Universal Blue](https://github.com/ublue-os/main/) repo for more detailed instructions how See [upstream Universal Blue](https://github.com/ublue-os/main/) repo for more detailed instructions how
to rebase to this image. to rebase to this image.
The ZFS modules are built against the latest latest ublue-os:main image, Fedora 40 at the time of writing. Image uses CoreOS' `stable` kernel from [Universal Blue kernel-cache image](https://ghcr.io/ublue-os/coreos-stable-kernel) and
Building the modules is basically taken straight from [Fedora CoreOS](https://github.com/coreos/layering-examples/tree/main/build-zfs-module) matching ZFS kmod RPMs from [Universal Blue `akmods-zfs` image](https://ghcr.io/ublue-os/akmods-zfs) are installed.
example, except the base image used to detect the correct kernel version to build against is `ublue-os:main`.
## Known issues Other additions, subject to change:
The build fails consistently once a week. Most likely Fedora repos are already serving a newer kernel version, - RPM firefox removed
while the pulled ublue image is still on the older kernel version. Next day's build succeeds, so this only means - Sanoid installed from [gregw/extras COPR](https://copr.fedorainfracloud.org/coprs/gregw/extras)
a day without an updated image every week.
Dependencies for Jim Salter's excellent [Sanoid/Syncoid](https://github.com/jimsalterjrs/sanoid) might become
preinstalled at some stage, but for now I've decided to keep everything close to `ublue-os:main`. Suggestions,
issues and pull requests are welcome.

View File

@ -4,6 +4,16 @@ set -ouex pipefail
RELEASE="$(rpm -E %fedora)" RELEASE="$(rpm -E %fedora)"
## Package overrides
RMPKGS=(
firefox
firefox-langpacks
)
ADDPKGS=(
sanoid
)
### Install packages ### Install packages
# Packages can be installed from any enabled yum repo on the image. # Packages can be installed from any enabled yum repo on the image.
@ -11,8 +21,22 @@ RELEASE="$(rpm -E %fedora)"
# List of rpmfusion packages can be found here: # List of rpmfusion packages can be found here:
# https://mirrors.rpmfusion.org/mirrorlist?path=free/fedora/updates/39/x86_64/repoview/index.html&protocol=https&redirect=1 # https://mirrors.rpmfusion.org/mirrorlist?path=free/fedora/updates/39/x86_64/repoview/index.html&protocol=https&redirect=1
rpm-ostree install \ ## Add gregw/extras COPR
/zfs/*.$(rpm -qa kernel --queryformat '%{ARCH}').rpm && \ curl -so /etc/yum.repos.d/gregw-extras-fedora-40.repo https://copr.fedorainfracloud.org/coprs/gregw/extras/repo/fedora-40/gregw-extras-fedora-40.repo
RMSTRING=""
ADDSTRING=""
for pkg in ${ADDPKGS[@]}; do
ADDSTRING="${ADDSTRING} --install=${pkg}"
done
for pkg in ${RMPKGS[@]}; do
RMSTRING="${RMSTRING} --remove=${pkg}"
done
rpm-ostree override replace ${ADDSTRING} ${RMSTRING} /tmp/rpms/kernel/*.rpm /tmp/rpms/zfs/*.rpm
# Auto-load ZFS module # Auto-load ZFS module
depmod -a "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" && \ depmod -a "$(rpm -qa kernel --queryformat '%{VERSION}-%{RELEASE}.%{ARCH}')" && \
echo "zfs" > /etc/modules-load.d/zfs.conf && \ echo "zfs" > /etc/modules-load.d/zfs.conf && \