From 057f3a152d66f9683b567ad71e7038b2b83ff96a Mon Sep 17 00:00:00 2001 From: Daniel Gomez Date: Mon, 29 Sep 2025 21:04:12 +0200 Subject: [PATCH 1/2] devconfig: drop locales-all leftovers When locales-all support was added in commit 2514a694 ("guestfs: fix locale warnings in VM deployment"), it was added for all distros in the virt-builder.j2 template as well as Ansible tasks to ensure idempotency on previous base images. But we just need to ensure en_US.UTF-8 is available on the guests image, so keep just this config in both template and tasks but remove locales-all. While we are at it, also move the locale configuration after all deps are installed and to the distro agnostic task section. We do it anyways for all distros in virt-builder.j2, this ensures idempotency in all of them. Fixes: 6bb3bfb2 ("base_image: Skip "locales-all" package installation") Link: https://github.com/linux-kdevops/kdevops/actions/runs/18347971703/job/52259752236 [1] Link: https://lore.kernel.org/r/20250929-locales-all-removal-v1-1-4177411d3e44@samsung.com Signed-off-by: Daniel Gomez --- playbooks/roles/devconfig/tasks/main.yml | 50 ++++++++---------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml index 3499f7444..39d883b71 100644 --- a/playbooks/roles/devconfig/tasks/main.yml +++ b/playbooks/roles/devconfig/tasks/main.yml @@ -54,17 +54,25 @@ dest: /etc/hostname tags: hostname -- name: Ensure locales-all package is installed - become: true - become_flags: "su - -c" - become_method: sudo - ansible.builtin.package: - name: locales-all - state: present +# Distro specific + +# Check and fix APT mirrors for Debian testing before installing dependencies +- name: Check and fix APT mirrors for Debian testing + ansible.builtin.include_tasks: check-apt-mirrors.yml when: - - ansible_facts['os_family']|lower == 'debian' - tags: firstconfig + - devconfig_debian_testing is defined + - devconfig_debian_testing | bool + +- name: Install dependencies + ansible.builtin.include_tasks: install-deps/main.yml + tags: ["vars", "vars_simple"] +- name: Configure custom repositories and install packages + ansible.builtin.import_tasks: config-custom-repos-and-packages/main.yml + when: + - ansible_facts['os_family']|lower == 'redhat' + +# Distro agnostic stuff goes below - name: Configure en_US.UTF-8 locale files become: true become_flags: "su - -c" @@ -80,8 +88,6 @@ - { path: "/etc/default/locale", line: "LANG=en_US.UTF-8" } - { path: "/etc/default/locale", line: "LANGUAGE=en_US:en" } - { path: "/etc/locale.gen", line: "en_US.UTF-8 UTF-8" } - when: - - ansible_facts['os_family']|lower == 'debian' tags: firstconfig - name: Generate and update locales @@ -92,30 +98,8 @@ locale-gen en_US.UTF-8 update-locale LANG=en_US.UTF-8 changed_when: true - when: - - ansible_facts['os_family']|lower == 'debian' tags: firstconfig -# Distro specific - -# Check and fix APT mirrors for Debian testing before installing dependencies -- name: Check and fix APT mirrors for Debian testing - ansible.builtin.include_tasks: check-apt-mirrors.yml - when: - - devconfig_debian_testing is defined - - devconfig_debian_testing | bool - -- name: Install dependencies - ansible.builtin.include_tasks: install-deps/main.yml - tags: ["vars", "vars_simple"] - -- name: Configure custom repositories and install packages - ansible.builtin.import_tasks: config-custom-repos-and-packages/main.yml - when: - - ansible_facts['os_family']|lower == 'redhat' - -# Distro agnostic stuff goes below - - name: Check if /mirror directory exists on localhost delegate_to: localhost ansible.builtin.stat: From 385f58c082bf3a2b1a17289621292e63b77f05c6 Mon Sep 17 00:00:00 2001 From: Daniel Gomez Date: Mon, 29 Sep 2025 21:04:13 +0200 Subject: [PATCH 2/2] base_image: ensure base image permissions are set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Permissions should be set regardless of if we executed the copy task or not. Workflow: TASK: Show the custom virt-builder database [localhost] Custom virt-builder source: /etc/virt-builder/repos.d/ kdevops-custom-images-debian-13-generic-arm64-daily.conf Custom virt-builder index: /var/lib/libvirt/images/kdevops/guestfs/custom_images/ debian-13-generic-arm64-daily/index Custom virt-builder image: /var/lib/libvirt/images/kdevops/guestfs/custom_images/ debian-13-generic-arm64-daily/debian-13-generic-arm64-daily.raw TASK: Generating the index for debian-13-generic-arm64-daily [localhost] ⠀⠀✓ [localhost] TASK: Copy custom image to base image location (with automatic reflink optimization) [localhost] ⠀⠀⊘ [localhost] TASK: Set proper permissions on base image [localhost] ⠀⠀⊘ [localhost] TASK: Create the base OS image [localhost] ⠀⠀⊘ [localhost] ... Fixes error: TASK: Duplicate the root disk image for each target node [dgc-testing-block,dgc-testing-nvme] ⠀⠀FAILED: [dgc-testing-block] => non-zero return code STDERR: cp: cannot open '/var/lib/libvirt/images/kdevops/guestfs/custom_images/ debian-13-generic-arm64-daily/debian-13-generic-arm64-daily.raw' for reading: Permission denied [ERROR]: Task failed: Module failed: non-zero return code Origin: /home/dagomez.linux/src/kdevops/playbooks/roles/guestfs/tasks/bringup/ main.yml:53:7 51 delegate_to: localhost 52 53 - name: Duplicate the root disk image for each target node ^ column 7 Fixes: f9ef79cb ("base_image: optimize VM image copying with reflinks and fix same-file handling") Link: https://lore.kernel.org/r/20250929-locales-all-removal-v1-2-4177411d3e44@samsung.com Signed-off-by: Daniel Gomez --- playbooks/roles/base_image/tasks/custom-image.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/playbooks/roles/base_image/tasks/custom-image.yml b/playbooks/roles/base_image/tasks/custom-image.yml index bac834e83..121fa112e 100644 --- a/playbooks/roles/base_image/tasks/custom-image.yml +++ b/playbooks/roles/base_image/tasks/custom-image.yml @@ -355,4 +355,3 @@ mode: "u=rw,g=r,o=r" when: - custom_image_stat.stat.exists or custom_image_download is changed - - custom_image != base_image_pathname