From 8c559a74f2d17ad0fdb8d32cf1393e9705966e8f Mon Sep 17 00:00:00 2001 From: Andrea Mazzotti Date: Fri, 28 Jun 2024 15:00:52 +0200 Subject: [PATCH] Fix rootfs layout (#76) * Use yaml elemental layout Signed-off-by: Andrea Mazzotti * Fix uninitialized /usr/libexec Signed-off-by: Andrea Mazzotti --------- Signed-off-by: Andrea Mazzotti --- Dockerfile.kubeadm.os | 3 + Dockerfile.os | 3 + .../files/system/oem/01_elemental-rootfs.yaml | 60 +++++++++++-------- 3 files changed, 41 insertions(+), 25 deletions(-) diff --git a/Dockerfile.kubeadm.os b/Dockerfile.kubeadm.os index 659d54fc..d8401cd7 100644 --- a/Dockerfile.kubeadm.os +++ b/Dockerfile.kubeadm.os @@ -143,6 +143,9 @@ RUN zypper clean --all && \ >/var/log/lastlog && \ rm -rf /boot/vmlinux* +# Required by k3s/rke2 +RUN mkdir -p /usr/libexec && touch /usr/libexec/.keep + # Generate initrd with required elemental services # Features currently excluded: [cloud-config-defaults] RUN elemental init --debug --force boot-assessment,cloud-config-essentials,dracut-config,elemental-rootfs,elemental-setup,elemental-sysroot,grub-config,grub-default-bootargs diff --git a/Dockerfile.os b/Dockerfile.os index 0a045084..701cf7bd 100644 --- a/Dockerfile.os +++ b/Dockerfile.os @@ -124,6 +124,9 @@ RUN zypper clean --all && \ # Enable /tmp to be on tmpfs RUN cp /usr/share/systemd/tmp.mount /etc/systemd/system +# Required by k3s/rke2 +RUN mkdir -p /usr/libexec && touch /usr/libexec/.keep + # Generate initrd with required elemental services # Features currently excluded: [cloud-config-defaults] RUN elemental init --debug --force boot-assessment,cloud-config-essentials,dracut-config,elemental-rootfs,elemental-setup,elemental-sysroot,grub-config,grub-default-bootargs diff --git a/framework/files/system/oem/01_elemental-rootfs.yaml b/framework/files/system/oem/01_elemental-rootfs.yaml index a0c2ddff..b7a7d26d 100644 --- a/framework/files/system/oem/01_elemental-rootfs.yaml +++ b/framework/files/system/oem/01_elemental-rootfs.yaml @@ -15,30 +15,40 @@ stages: rootfs: - if: '[ ! -f "/run/elemental/recovery_mode" ]' name: "Layout configuration" - environment_file: /run/elemental/mount-layout.env - environment: - OVERLAY: "tmpfs:25%" - RW_PATHS: "/var /etc /srv" - PERSISTENT_STATE_PATHS: >- - /etc/systemd - /etc/kubernetes - /etc/rancher - /etc/ssh - /etc/iscsi - /etc/cni - /etc/conntrackd - /etc/containerd - /home - /opt - /root - /usr/libexec - /usr/local - /var/log - /var/lib - PERSISTENT_STATE_BIND: "true" + files: + - path: /run/elemental/config.d/layout.yaml + content: | + mount: + write-fstab: true + ephemeral: + type: tmpfs + size: 25% + paths: ['/etc', '/var', '/srv'] + persistent: + mode: bind + paths: + - /etc/systemd + - /etc/kubernetes + - /etc/rancher + - /etc/ssh + - /etc/iscsi + - /etc/cni + - /etc/conntrackd + - /etc/containerd + - /home + - /opt + - /root + - /usr/libexec + - /usr/local + - /var/log + - /var/lib - if: '[ -f "/run/elemental/recovery_mode" ]' - # omit the persistent partition on recovery mode name: "Layout configuration for recovery" - environment_file: /run/elemental/mount-layout.env - environment: - OVERLAY: "tmpfs:25%" + files: + - path: /run/elemental/config.d/layout.yaml + content: | + mount: + write-fstab: true + ephemeral: + type: tmpfs + size: 25%