From 34073379ceeb35e807f95d66208752e556063331 Mon Sep 17 00:00:00 2001 From: "Gilles H." <63115776+gillouche@users.noreply.github.com> Date: Tue, 20 Jan 2026 21:19:20 +0100 Subject: [PATCH] Fix regex archlinux boot.txt (cgroup) (#499) Update the regular expression to have a more specific match search term for cgroup flags Issue #495 Signed-off-by: Gilles Habran --- roles/raspberrypi/tasks/prereq/Archlinux.yml | 21 +++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/roles/raspberrypi/tasks/prereq/Archlinux.yml b/roles/raspberrypi/tasks/prereq/Archlinux.yml index 9529070..c47b480 100644 --- a/roles/raspberrypi/tasks/prereq/Archlinux.yml +++ b/roles/raspberrypi/tasks/prereq/Archlinux.yml @@ -12,10 +12,10 @@ raspberrypi_boot_file: "{{ (boot_files.results | selectattr('stat.exists') | map(attribute='item') | list | first) | default('') }}" # Arch ARM64 boots via /boot/boot.txt (UBoot), /boot/cmdline.txt only exists on legacy 32-bit systems -- name: Enable cgroup via boot commandline +- name: Enable cgroup via boot commandline (boot.txt) ansible.builtin.replace: path: "{{ raspberrypi_boot_file }}" - regexp: '^([\w](?!.*\b{{ cgroup_item }}\b).*)$' + regexp: '^(setenv bootargs(?!.*{{ cgroup_item }}).*)$' replace: '\1 {{ cgroup_item }}' with_items: - "cgroup_enable=cpuset" @@ -23,4 +23,19 @@ - "cgroup_enable=memory" loop_control: loop_var: cgroup_item - notify: "{{ (raspberrypi_boot_file == '/boot/boot.txt') | ternary('Regenerate bootloader image', 'Reboot Pi') }}" + when: raspberrypi_boot_file == '/boot/boot.txt' + notify: Regenerate bootloader image + +- name: Enable cgroup via boot commandline (cmdline.txt) + ansible.builtin.replace: + path: "{{ raspberrypi_boot_file }}" + regexp: '^(\S(?!.*{{ cgroup_item }}).*)$' + replace: '\1 {{ cgroup_item }}' + with_items: + - "cgroup_enable=cpuset" + - "cgroup_memory=1" + - "cgroup_enable=memory" + loop_control: + loop_var: cgroup_item + when: raspberrypi_boot_file == '/boot/cmdline.txt' + notify: Reboot Pi