From 0718b9b55f9d81dce7fad49c2d3a344a6cde8ef7 Mon Sep 17 00:00:00 2001 From: Champ-Goblem Date: Fri, 29 Apr 2022 17:15:29 +0100 Subject: [PATCH 1/2] rootfs: Fix chronyd.service failing on boot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In at least kata versions 2.3.3 and 2.4.0 it was noticed that the guest operating system's clock would drift out of sync slowly over time whilst the pod was running. This had previously been raised and fixed in the old reposity via [1]. In essence kvm_ptp and chrony were paired together in order to keep the system clock up to date with the host. In the recent versions of kata metioned above, the chronyd.service fails upon boot with status `266/NAMESPACE` which seems to be due to the fact that the `/var/lib/chrony` directory no longer exists. This change sets the `/var/lib/chrony` directory for the `ReadWritePaths` to be ignored when the directory does not exist, as per [2]. [1] https://github.com/kata-containers/runtime/issues/1279 [2] https://www.freedesktop.org/software/systemd /man/systemd.exec.html#ReadWritePaths= Fixes: #4167 Signed-off-by: Champ-Goblem Signed-off-by: Fabiano Fidêncio (cherry picked from commit 1b7fd19acb1e46f803b39e823070966785788758) --- tools/osbuilder/rootfs-builder/rootfs.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/osbuilder/rootfs-builder/rootfs.sh b/tools/osbuilder/rootfs-builder/rootfs.sh index 80633a0451..f7b315c2ed 100755 --- a/tools/osbuilder/rootfs-builder/rootfs.sh +++ b/tools/osbuilder/rootfs-builder/rootfs.sh @@ -532,8 +532,13 @@ EOT if [ -f "$chrony_systemd_service" ]; then # Remove user option, user could not exist in the rootfs + # Set the /var/lib/chrony for ReadWritePaths to be ignored if + # its nonexistent, this broke the service on boot previously + # due to the directory not being present "(code=exited, status=226/NAMESPACE)" sed -i -e 's/^\(ExecStart=.*\)-u [[:alnum:]]*/\1/g' \ - -e '/^\[Unit\]/a ConditionPathExists=\/dev\/ptp0' ${chrony_systemd_service} + -e '/^\[Unit\]/a ConditionPathExists=\/dev\/ptp0' \ + -e 's/^ReadWritePaths=\(.\+\) \/var\/lib\/chrony \(.\+\)$/ReadWritePaths=\1 -\/var\/lib\/chrony \2/m' \ + ${chrony_systemd_service} fi AGENT_DIR="${ROOTFS_DIR}/usr/bin" From f32a146637c14900862e0fba26d10108aaab5b73 Mon Sep 17 00:00:00 2001 From: "James O. D. Hunt" Date: Wed, 15 Jun 2022 10:00:56 +0100 Subject: [PATCH 2/2] snap: Fix debug cli option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `snap`/`snapcraft` seems to have changed recently. Since `snap` auto-updates all `snap` packages and since we use the `snapcraft` `snap` for building snaps, this is impacting all our CI jobs which now show: ``` Installing Snapcraft for Linux… snapcraft 7.0.4 from Canonical* installed Run snapcraft -d snap --destructive-mode Usage: snapcraft [options] command [args]... Try 'snapcraft pack -h' for help. Error: unrecognized arguments: -d Error: Process completed with exit code 1. ``` Move the debug option to make it a sub-command (long) option to resolve this issue. Fixes: #4457. Signed-off-by: James O. D. Hunt Signed-off-by: Fabiano Fidêncio (cherry picked from commit 90a7763ac68bd36b1afae9078f71e052dfb46b30) --- .github/workflows/snap-release.yaml | 2 +- .github/workflows/snap.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/snap-release.yaml b/.github/workflows/snap-release.yaml index bae353cad2..2fde90afc4 100644 --- a/.github/workflows/snap-release.yaml +++ b/.github/workflows/snap-release.yaml @@ -26,7 +26,7 @@ jobs: # Check semantic versioning format (x.y.z) and if the current tag is the latest tag if echo "${current_version}" | grep -q "^[[:digit:]]\+\.[[:digit:]]\+\.[[:digit:]]\+$" && echo -e "$latest_version\n$current_version" | sort -C -V; then # Current version is the latest version, build it - snapcraft -d snap --destructive-mode + snapcraft snap --debug --destructive-mode fi - name: Upload snap diff --git a/.github/workflows/snap.yaml b/.github/workflows/snap.yaml index ec968dc48f..9176d45d2a 100644 --- a/.github/workflows/snap.yaml +++ b/.github/workflows/snap.yaml @@ -24,4 +24,4 @@ jobs: - name: Build snap if: ${{ !contains(github.event.pull_request.labels.*.name, 'force-skip-ci') }} run: | - snapcraft -d snap --destructive-mode + snapcraft snap --debug --destructive-mode