From f65015a423643b0777318e147a69a0e173bbdd87 Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Fri, 6 Nov 2026 12:13:31 +0100 Subject: [PATCH 1/3] fix(edge-flash-wear): keep the pacman package cache empty edge-1's 6.6 GB eMMC root had 1.7 GB of cached packages and 197 MB free, so pulling the Alloy image failed with "no space left on device". A pacman hook now empties the cache after every transaction, and the role empties it on each run. Co-Authored-By: Claude Opus 5.5 --- .../files/edge-pacman-cache.hook | 13 +++++++++++++ ansible/roles/edge-flash-wear/tasks/main.yml | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook diff --git a/ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook b/ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook new file mode 100644 index 00000000..8a18e3ae --- /dev/null +++ b/ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook @@ -0,0 +1,13 @@ +# Managed by ansible (roles/edge-flash-wear). +# The root filesystem is a ~7 GB eMMC; downloaded packages are not kept. +[Trigger] +Operation = Install +Operation = Upgrade +Operation = Remove +Type = Package +Target = * + +[Action] +Description = Removing downloaded packages from the cache... +When = PostTransaction +Exec = /usr/bin/find /var/cache/pacman/pkg -mindepth 1 -delete diff --git a/ansible/roles/edge-flash-wear/tasks/main.yml b/ansible/roles/edge-flash-wear/tasks/main.yml index 96eed5d9..51d0d7ba 100644 --- a/ansible/roles/edge-flash-wear/tasks/main.yml +++ b/ansible/roles/edge-flash-wear/tasks/main.yml @@ -9,6 +9,24 @@ name: mmc-utils # eMMC lifetime/EOL introspection (mmc extcsd read) state: present +- name: Ensure the pacman hook directory exists + ansible.builtin.file: + path: /etc/pacman.d/hooks + state: directory + mode: "0755" + +- name: Empty the pacman package cache after every transaction + ansible.builtin.copy: + src: edge-pacman-cache.hook + dest: /etc/pacman.d/hooks/edge-pacman-cache.hook + mode: "0644" + +- name: Empty the pacman package cache + ansible.builtin.command: + argv: [find, /var/cache/pacman/pkg, -mindepth, "1", -delete, -print] + register: edge_pacman_cache_clean + changed_when: edge_pacman_cache_clean.stdout | length > 0 + - name: Ensure journald drop-in directory exists ansible.builtin.file: path: /etc/systemd/journald.conf.d -- 2.54.0 From bc50d58723f36ef2feaaf4cdc2e34e5aed126223 Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Fri, 6 Nov 2026 12:58:01 +0100 Subject: [PATCH 2/3] Revert "fix(edge-flash-wear): keep the pacman package cache empty" The package cache is a disk-space concern of the package upgrades, not flash wear; it moves to the os-update role. Co-Authored-By: Claude Opus 5.5 --- .../files/edge-pacman-cache.hook | 13 ------------- ansible/roles/edge-flash-wear/tasks/main.yml | 18 ------------------ 2 files changed, 31 deletions(-) delete mode 100644 ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook diff --git a/ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook b/ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook deleted file mode 100644 index 8a18e3ae..00000000 --- a/ansible/roles/edge-flash-wear/files/edge-pacman-cache.hook +++ /dev/null @@ -1,13 +0,0 @@ -# Managed by ansible (roles/edge-flash-wear). -# The root filesystem is a ~7 GB eMMC; downloaded packages are not kept. -[Trigger] -Operation = Install -Operation = Upgrade -Operation = Remove -Type = Package -Target = * - -[Action] -Description = Removing downloaded packages from the cache... -When = PostTransaction -Exec = /usr/bin/find /var/cache/pacman/pkg -mindepth 1 -delete diff --git a/ansible/roles/edge-flash-wear/tasks/main.yml b/ansible/roles/edge-flash-wear/tasks/main.yml index 51d0d7ba..96eed5d9 100644 --- a/ansible/roles/edge-flash-wear/tasks/main.yml +++ b/ansible/roles/edge-flash-wear/tasks/main.yml @@ -9,24 +9,6 @@ name: mmc-utils # eMMC lifetime/EOL introspection (mmc extcsd read) state: present -- name: Ensure the pacman hook directory exists - ansible.builtin.file: - path: /etc/pacman.d/hooks - state: directory - mode: "0755" - -- name: Empty the pacman package cache after every transaction - ansible.builtin.copy: - src: edge-pacman-cache.hook - dest: /etc/pacman.d/hooks/edge-pacman-cache.hook - mode: "0644" - -- name: Empty the pacman package cache - ansible.builtin.command: - argv: [find, /var/cache/pacman/pkg, -mindepth, "1", -delete, -print] - register: edge_pacman_cache_clean - changed_when: edge_pacman_cache_clean.stdout | length > 0 - - name: Ensure journald drop-in directory exists ansible.builtin.file: path: /etc/systemd/journald.conf.d -- 2.54.0 From 4b7960c18c3c298d6ecc6d482f911707a8310a9a Mon Sep 17 00:00:00 2001 From: Claude Bot Date: Fri, 6 Nov 2026 12:58:26 +0100 Subject: [PATCH 3/3] fix(os-update): keep the pacman package cache empty pacman keeps every package an upgrade downloads. On edge-1's 6.6 GB eMMC root that was 1.7 GB, leaving 197 MB free. The role now installs a pacman hook that empties the cache after every transaction, and empties it before the 1 GiB free-space check. Co-Authored-By: Claude Opus 5.5 --- .../roles/os-update/files/pacman-cache.hook | 14 ++++++++++ ansible/roles/os-update/tasks/main.yml | 28 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 ansible/roles/os-update/files/pacman-cache.hook diff --git a/ansible/roles/os-update/files/pacman-cache.hook b/ansible/roles/os-update/files/pacman-cache.hook new file mode 100644 index 00000000..1fa1597e --- /dev/null +++ b/ansible/roles/os-update/files/pacman-cache.hook @@ -0,0 +1,14 @@ +# Managed by ansible (roles/os-update). +# Downloaded packages are not kept; older versions come from the Arch Linux +# Archive. +[Trigger] +Operation = Install +Operation = Upgrade +Operation = Remove +Type = Package +Target = * + +[Action] +Description = Removing downloaded packages from the cache... +When = PostTransaction +Exec = /usr/bin/find /var/cache/pacman/pkg -mindepth 1 -delete diff --git a/ansible/roles/os-update/tasks/main.yml b/ansible/roles/os-update/tasks/main.yml index d7963f05..fc2f8506 100644 --- a/ansible/roles/os-update/tasks/main.yml +++ b/ansible/roles/os-update/tasks/main.yml @@ -25,6 +25,34 @@ check_mode: false when: os_update_docker.stat.exists +# pacman keeps every downloaded package; on the edge hosts' 7 GB eMMC root +# the cache grows to gigabytes. +- name: Ensure the pacman hook directory exists (Arch) + ansible.builtin.file: + path: /etc/pacman.d/hooks + state: directory + mode: "0755" + when: ansible_facts['os_family'] == 'Archlinux' + +- name: Empty the package cache after every transaction (Arch) + ansible.builtin.copy: + src: pacman-cache.hook + dest: /etc/pacman.d/hooks/pacman-cache.hook + mode: "0644" + when: ansible_facts['os_family'] == 'Archlinux' + +- name: Empty the package cache (Arch) + ansible.builtin.command: + argv: [find, /var/cache/pacman/pkg, -mindepth, "1", -delete, -print] + register: os_update_pacman_cache + changed_when: os_update_pacman_cache.stdout | length > 0 + when: ansible_facts['os_family'] == 'Archlinux' + +- name: Re-read mounts after the cache cleanup + ansible.builtin.setup: + gather_subset: [mounts] + when: os_update_pacman_cache is changed + - name: Assert at least 1 GiB free on / ansible.builtin.assert: that: >- -- 2.54.0