Skip to content

Commit

Permalink
🐧 Enable boot assesment for UKI
Browse files Browse the repository at this point in the history
This adds the missing package on ubuntu and enables boot assesment
services for UKI

Signed-off-by: Itxaka <itxaka@kairos.io>
  • Loading branch information
Itxaka committed Nov 22, 2024
1 parent ab7b23f commit b1e25dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions images/Dockerfile.kairos-rhel
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ RUN dnf install -y \
&& dnf clean all

FROM common AS systemd-boot
RUN systemctl enable systemd-bless-boot

FROM ${BOOTLOADER} AS all
RUN dnf install -y \
Expand Down
24 changes: 13 additions & 11 deletions images/Dockerfile.kairos-ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,26 @@ RUN rm -rf /tmp/nohang.deb

# This target is aimed at UKI images and avoids to install GRUB and any other unnecesary packages
# to the image because there are limitations on the total size
# systemd-boot is neccesary as it brings the /usr/lib/systemd/systemd-bless-boot for boot assesment
FROM common AS systemd-boot
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
iucode-tool \
kmod \
linux-base \
systemd-boot \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
# for UKI, install the linux-modules pkg if no modules are found
RUN [ -z "$(ls -A /lib/modules/)" ] && apt-get update && apt-get install -y --no-install-recommends \
"$(apt-cache search linux-modules | grep -oP 'linux-modules-\d+.\d+.\d+-\d+-generic' | sort -V | tail -1)" \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/* || true
# for UKI, install the linux-image pkg if no kernel is found
RUN [ -z "$(ls -A /boot/vmlinuz*)" ] && apt-get update && apt-get install -y --no-install-recommends \
"$(apt-cache search linux-image | grep -oP 'linux-image-\d+.\d+.\d+-\d+-generic' | sort -V | tail -1)" \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/* || true
# Enable systemd-bless-boot for boot assesment
RUN systemctl enable systemd-bless-boot


# This target is aimed at non-UKI images where size is not a concern
FROM common AS grub
Expand All @@ -141,17 +146,14 @@ RUN apt-get update \

FROM systemd-boot AS systemd-boot-amd64
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
shared-mime-info \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get install -y --no-install-recommends shared-mime-info \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN [ -z "$(ls -A /lib/firmware/amd/)" ] && apt-get update && apt-get install -y --no-install-recommends \
&& apt-get install -y --no-install-recommends \
amd64-microcode \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get install -y --no-install-recommends amd64-microcode \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/* || true
RUN [ -z "$(ls -A /lib/firmware/intel-ucode/)" ] && apt-get update && apt-get install -y --no-install-recommends \
&& apt-get install -y --no-install-recommends \
intel-microcode \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
&& apt-get install -y --no-install-recommends intel-microcode \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/* || true

FROM systemd-boot AS systemd-boot-arm64

Expand Down
1 change: 1 addition & 0 deletions images/Dockerfile.rhel
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ RUN dnf install -y \
&& dnf clean all

FROM common AS systemd-boot
RUN systemctl enable systemd-bless-boot

FROM ${BOOTLOADER} AS all
RUN dnf install -y \
Expand Down
5 changes: 5 additions & 0 deletions images/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ RUN rm -rf /tmp/nohang.deb

# This target is aimed at UKI images and avoids to install GRUB and any other unnecesary packages
# to the image because there are limitations on the total size
# systemd-boot is neccesary as it brings the /usr/lib/systemd/systemd-bless-boot for boot assesment
FROM common AS systemd-boot
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN apt-get update && apt-get install -y --no-install-recommends \
iucode-tool \
kmod \
linux-base \
systemd-boot \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/*
# for UKI, install the linux-modules pkg if no modules are found
RUN [ -z "$(ls -A /lib/modules/)" ] && apt-get update && apt-get install -y --no-install-recommends \
Expand All @@ -121,6 +123,9 @@ RUN [ -z "$(ls -A /lib/modules/)" ] && apt-get update && apt-get install -y --no
RUN [ -z "$(ls -A /boot/vmlinuz*)" ] && apt-get update && apt-get install -y --no-install-recommends \
"$(apt-cache search linux-image | grep -oP 'linux-image-\d+.\d+.\d+-\d+-generic' | sort -V | tail -1)" \
&& apt-get remove -y unattended-upgrades && apt-get clean && rm -rf /var/lib/apt/lists/* || true
# Enable systemd-bless-boot for boot assesment
RUN systemctl enable systemd-bless-boot


# This target is aimed at non-UKI images where size is not a concern
FROM common AS grub
Expand Down

0 comments on commit b1e25dc

Please sign in to comment.