* [PATCH 1/5] base_image: fix missing guestfs_distro_source_and_dest_file in yaml output
2025-09-15 20:05 [PATCH 0/5] Add ARM64 libguestfs Support Daniel Gomez
@ 2025-09-15 20:05 ` Daniel Gomez
2025-09-15 20:05 ` [PATCH 2/5] base_image: fix BASE_IMAGE variable in rolling release warning Daniel Gomez
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-09-15 20:05 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
The GUESTFS_DISTRO_SOURCE_AND_DEST_FILE kconfig variable was missing
the "output yaml" directive, causing it to be defined in .config but
not exported to extra_vars.yaml that Ansible actually consumes.
This resulted in the variable being undefined in Ansible templates:
jinja2.exceptions.UndefinedError: 'target_dir' is undefined
TypeError: expected str, bytes or os.PathLike object, not AnsibleUndefined
The issue only manifested on some machines due to different Ansible
execution contexts - the variable was in .config but missing from
extra_vars.yaml where templates expect it.
Fixed by adding "output yaml" to GUESTFS_DISTRO_SOURCE_AND_DEST_FILE
kconfig definition, ensuring proper variable export to Ansible.
Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
kconfigs/Kconfig.guestfs | 1 +
playbooks/roles/base_image/templates/virt-builder.j2 | 1 +
2 files changed, 2 insertions(+)
diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs
index a703ffe5..d1e922a6 100644
--- a/kconfigs/Kconfig.guestfs
+++ b/kconfigs/Kconfig.guestfs
@@ -60,6 +60,7 @@ config GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST
config GUESTFS_DISTRO_SOURCE_AND_DEST_FILE
string
depends on GUESTFS_COPY_SOURCES_FROM_HOST_TO_GUEST
+ output yaml
default "/etc/apt/sources.list" if GUESTFS_DEBIAN
endif
diff --git a/playbooks/roles/base_image/templates/virt-builder.j2 b/playbooks/roles/base_image/templates/virt-builder.j2
index 138d06ee..6805679a 100644
--- a/playbooks/roles/base_image/templates/virt-builder.j2
+++ b/playbooks/roles/base_image/templates/virt-builder.j2
@@ -7,6 +7,7 @@ copy-in {{ kdevops_custom_yum_repofile }}:/etc/yum.repos.d
{% endif %}
{% if guestfs_copy_sources_from_host_to_guest %}
+{% set target_dir = guestfs_distro_source_and_dest_file | dirname %}
mkdir {{ target_dir }}
copy-in {{ guestfs_distro_source_and_dest_file }}:{{ target_dir }}
{% endif %}
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/5] base_image: fix BASE_IMAGE variable in rolling release warning
2025-09-15 20:05 [PATCH 0/5] Add ARM64 libguestfs Support Daniel Gomez
2025-09-15 20:05 ` [PATCH 1/5] base_image: fix missing guestfs_distro_source_and_dest_file in yaml output Daniel Gomez
@ 2025-09-15 20:05 ` Daniel Gomez
2025-09-15 20:05 ` [PATCH 3/5] libvirt_user: fix enable-user tasks to include correct user enablement Daniel Gomez
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-09-15 20:05 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
Change ${BASE_IMAGE} shell variable syntax to {{ base_image_pathname }}
Ansible variable syntax in the rolling distribution release warning
message. This ensures the actual base image path is displayed to
users instead of literal shell variable text.
The warning now shows the correct path for users to remove when
upgrading rolling distribution images.
Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
playbooks/roles/base_image/tasks/custom-image.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/playbooks/roles/base_image/tasks/custom-image.yml b/playbooks/roles/base_image/tasks/custom-image.yml
index 0f20d176..204e3099 100644
--- a/playbooks/roles/base_image/tasks/custom-image.yml
+++ b/playbooks/roles/base_image/tasks/custom-image.yml
@@ -270,7 +270,7 @@
Running guests always use their own copy. To rebuild your custom
base image from the custom image, also remove the base image:
- rm -f ${BASE_IMAGE}
+ rm -f {{ base_image_pathname }}
This can always be done safely without affecting running guests.
------------------------------------------------------------------
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/5] libvirt_user: fix enable-user tasks to include correct user enablement
2025-09-15 20:05 [PATCH 0/5] Add ARM64 libguestfs Support Daniel Gomez
2025-09-15 20:05 ` [PATCH 1/5] base_image: fix missing guestfs_distro_source_and_dest_file in yaml output Daniel Gomez
2025-09-15 20:05 ` [PATCH 2/5] base_image: fix BASE_IMAGE variable in rolling release warning Daniel Gomez
@ 2025-09-15 20:05 ` Daniel Gomez
2025-09-15 20:05 ` [PATCH 4/5] guestfs: add ARM64 support with cross-architecture image customization Daniel Gomez
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-09-15 20:05 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
The enable-user/main.yml was incorrectly including install-deps tasks
instead of the actual user enablement tasks. This caused the user
verification and group membership tasks to never execute.
Fixed to include the proper enable-user/* tasks for each distribution
instead of install-deps/* tasks.
Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
playbooks/roles/libvirt_user/tasks/enable-user/main.yml | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/playbooks/roles/libvirt_user/tasks/enable-user/main.yml b/playbooks/roles/libvirt_user/tasks/enable-user/main.yml
index 04f8e31f..ded8d188 100644
--- a/playbooks/roles/libvirt_user/tasks/enable-user/main.yml
+++ b/playbooks/roles/libvirt_user/tasks/enable-user/main.yml
@@ -1,20 +1,20 @@
---
-- name: Debian-specific set up
- ansible.builtin.include_tasks: install-deps/debian/main.yml
+- name: Debian user enablement
+ ansible.builtin.include_tasks: enable-user/debian/main.yml
when: ansible_os_family == 'Debian'
-- name: SuSE-specific set up
- ansible.builtin.include_tasks: install-deps/suse/main.yml
+- name: SuSE user enablement
+ ansible.builtin.include_tasks: enable-user/suse/main.yml
when: ansible_os_family == 'Suse'
-- name: Red Hat-specific set up
- ansible.builtin.include_tasks: install-deps/redhat/main.yml
+- name: Red Hat user enablement
+ ansible.builtin.include_tasks: enable-user/redhat/main.yml
when:
- ansible_os_family == 'RedHat'
- ansible_facts['distribution'] != "Fedora"
-- name: Fedora-specific set up
- ansible.builtin.include_tasks: install-deps/fedora/main.yml
+- name: Fedora user enablement
+ ansible.builtin.include_tasks: enable-user/fedora/main.yml
when:
- ansible_os_family == 'RedHat'
- ansible_facts['distribution'] == "Fedora"
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/5] guestfs: add ARM64 support with cross-architecture image customization
2025-09-15 20:05 [PATCH 0/5] Add ARM64 libguestfs Support Daniel Gomez
` (2 preceding siblings ...)
2025-09-15 20:05 ` [PATCH 3/5] libvirt_user: fix enable-user tasks to include correct user enablement Daniel Gomez
@ 2025-09-15 20:05 ` Daniel Gomez
2025-09-15 20:05 ` [PATCH 5/5] bootlinux: fix GRUB kernel selection variable scoping Daniel Gomez
2025-09-16 22:39 ` [PATCH 0/5] Add ARM64 libguestfs Support Luis Chamberlain
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-09-15 20:05 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
Add ARM64 libguestfs support with architecture detection. Supports
both same-architecture (full customization) and cross-architecture
(firstboot-only) scenarios for flexible dev environments.
* Add ARM64 configuration and target detection
* Implement conditional virt-customize logic based on host/guest
architecture
* Same arch: Full kdevops user setup via --commands-from-file
* Cross arch: Limited firstboot commands due to binary compatibility
* Update libvirt templates and node generation for ARM64
Enables x86_64<->ARM64 development workflows while maintaining full
functionality for native ARM64->ARM64 and x86_64->x86_64 scenarios.
Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
kconfigs/Kconfig.guestfs | 18 ++++++---
kconfigs/Kconfig.libvirt | 14 ++++++-
kconfigs/arch/Kconfig | 3 ++
playbooks/roles/base_image/tasks/custom-image.yml | 44 +++++++++++++++++++++-
playbooks/roles/gen_nodes/tasks/main.yml | 2 +-
.../roles/gen_nodes/templates/guestfs_virt.j2.xml | 4 +-
scripts/gen-nodes.Makefile | 4 ++
7 files changed, 76 insertions(+), 13 deletions(-)
diff --git a/kconfigs/Kconfig.guestfs b/kconfigs/Kconfig.guestfs
index d1e922a6..52506a3b 100644
--- a/kconfigs/Kconfig.guestfs
+++ b/kconfigs/Kconfig.guestfs
@@ -30,9 +30,12 @@ config GUESTFS_CUSTOM_RAW_IMAGE_URL
depends on GUESTFS_HAS_CUSTOM_RAW_IMAGE_URL
string
output yaml
- default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-generic-amd64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_GENERIC_AMD64
- default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-genericcloud-amd64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_GENERIC_CLOUD_AMD64
- default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-nocloud-amd64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_NOCLOUD_AMD64
+ default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-generic-amd64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_GENERIC_AMD64 && TARGET_ARCH_X86_64
+ default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-generic-arm64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_GENERIC_AMD64 && TARGET_ARCH_ARM64
+ default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-genericcloud-amd64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_GENERIC_CLOUD_AMD64 && TARGET_ARCH_X86_64
+ default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-genericcloud-arm64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_GENERIC_CLOUD_AMD64 && TARGET_ARCH_ARM64
+ default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-nocloud-amd64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_NOCLOUD_AMD64 && TARGET_ARCH_X86_64
+ default "https://cloud.debian.org/images/cloud/trixie/daily/latest/debian-13-nocloud-arm64-daily.raw" if GUESTFS_DEBIAN_TRIXIE_NOCLOUD_AMD64 && TARGET_ARCH_ARM64
config GUESTFS_HAS_CUSTOM_RAW_IMAGE_SHA512SUMS
bool
@@ -177,9 +180,12 @@ config GUESTFS_DEBIAN_HOST_GUEST_MATCH
config GUESTFS_DEBIAN_IMAGE_NAME
string
- default "debian-13-generic-amd64-daily" if GUESTFS_DEBIAN_TRIXIE_GENERIC_AMD64
- default "debian-13-genericcloud-amd64-daily" if GUESTFS_DEBIAN_TRIXIE_GENERIC_CLOUD_AMD64
- default "debian-13-nocloud-amd64-daily" if GUESTFS_DEBIAN_TRIXIE_NOCLOUD_AMD64
+ default "debian-13-generic-amd64-daily" if GUESTFS_DEBIAN_TRIXIE_GENERIC_AMD64 && TARGET_ARCH_X86_64
+ default "debian-13-generic-arm64-daily" if GUESTFS_DEBIAN_TRIXIE_GENERIC_AMD64 && TARGET_ARCH_ARM64
+ default "debian-13-genericcloud-amd64-daily" if GUESTFS_DEBIAN_TRIXIE_GENERIC_CLOUD_AMD64 && TARGET_ARCH_X86_64
+ default "debian-13-genericcloud-arm64-daily" if GUESTFS_DEBIAN_TRIXIE_GENERIC_CLOUD_AMD64 && TARGET_ARCH_ARM64
+ default "debian-13-nocloud-amd64-daily" if GUESTFS_DEBIAN_TRIXIE_NOCLOUD_AMD64 && TARGET_ARCH_X86_64
+ default "debian-13-nocloud-arm64-daily" if GUESTFS_DEBIAN_TRIXIE_NOCLOUD_AMD64 && TARGET_ARCH_ARM64
default "debian-12" if GUESTFS_DEBIAN_BUSTER
config GUESTFS_DEBIAN_BOX_SHORT
diff --git a/kconfigs/Kconfig.libvirt b/kconfigs/Kconfig.libvirt
index 961276cc..25cb703f 100644
--- a/kconfigs/Kconfig.libvirt
+++ b/kconfigs/Kconfig.libvirt
@@ -287,8 +287,12 @@ endif # QEMU_BUILD
config QEMU_BIN_PATH_LIBVIRT
string "QEMU binary path to use"
- default "/usr/local/bin/qemu-system-x86_64" if QEMU_USE_DEVELOPMENT_VERSION
- default "/usr/bin/qemu-system-x86_64" if !QEMU_USE_DEVELOPMENT_VERSION
+ default "/usr/local/bin/qemu-system-x86_64" if QEMU_USE_DEVELOPMENT_VERSION && TARGET_ARCH_X86_64
+ default "/usr/local/bin/qemu-system-aarch64" if QEMU_USE_DEVELOPMENT_VERSION && TARGET_ARCH_ARM64
+ default "/usr/local/bin/qemu-system-ppc64le" if QEMU_USE_DEVELOPMENT_VERSION && TARGET_ARCH_PPC64LE
+ default "/usr/bin/qemu-system-x86_64" if !QEMU_USE_DEVELOPMENT_VERSION && TARGET_ARCH_X86_64
+ default "/usr/bin/qemu-system-aarch64" if !QEMU_USE_DEVELOPMENT_VERSION && TARGET_ARCH_ARM64
+ default "/usr/bin/qemu-system-ppc64le" if !QEMU_USE_DEVELOPMENT_VERSION && TARGET_ARCH_PPC64LE
config QEMU_INSTALL_DIR_LIBVIRT
string "Path to install QEMU"
@@ -536,6 +540,12 @@ config LIBVIRT_MACHINE_TYPE_VIRT
endchoice
+config LIBVIRT_MACHINE_TYPE_STRING
+ string
+ output yaml
+ default "q35" if LIBVIRT_MACHINE_TYPE_Q35
+ default "virt" if LIBVIRT_MACHINE_TYPE_VIRT
+
config LIBVIRT_HOST_PASSTHROUGH
bool "Use CPU host-passthrough"
default y
diff --git a/kconfigs/arch/Kconfig b/kconfigs/arch/Kconfig
index 4c0beaf7..cd049f7c 100644
--- a/kconfigs/arch/Kconfig
+++ b/kconfigs/arch/Kconfig
@@ -11,6 +11,7 @@ choice
config TARGET_ARCH_X86_64
bool "x86_64"
+ output yaml
help
Enabling this will enable all features / workflows which depend on
the x86_64 architecture.
@@ -18,6 +19,7 @@ config TARGET_ARCH_X86_64
config TARGET_ARCH_ARM64
bool "arm64"
select HAVE_ARCH_64K_PAGES
+ output yaml
help
Enabling this will enable all features / workflows which depend on
the arm64 architecture.
@@ -25,6 +27,7 @@ config TARGET_ARCH_ARM64
config TARGET_ARCH_PPC64LE
bool "ppc64le"
select HAVE_ARCH_64K_PAGES
+ output yaml
help
Enabling this will enable all features / workflows which depend on
the ppc64le architecture.
diff --git a/playbooks/roles/base_image/tasks/custom-image.yml b/playbooks/roles/base_image/tasks/custom-image.yml
index 204e3099..bcf35933 100644
--- a/playbooks/roles/base_image/tasks/custom-image.yml
+++ b/playbooks/roles/base_image/tasks/custom-image.yml
@@ -172,7 +172,7 @@
when:
- not sentinel_stat.stat.exists
- - name: Customize the downloaded image with kdevops user and settings
+ - name: Customize the downloaded image with kdevops user and settings (same architecture)
become: true
become_method: ansible.builtin.sudo
ansible.builtin.command:
@@ -185,12 +185,33 @@
when:
- libvirt_uri_system|bool
- not sentinel_stat.stat.exists
+ - not (target_arch_arm64|default(false) and ansible_facts['architecture'] != 'aarch64')
+ - not (target_arch_x86_64|default(false) and ansible_facts['architecture'] == 'aarch64')
+
+ - name: Customize the downloaded image with kdevops user and settings (cross-architecture using firstboot only)
+ become: true
+ become_method: ansible.builtin.sudo
+ ansible.builtin.command:
+ argv:
+ - "virt-customize"
+ - "-a"
+ - "{{ custom_image }}"
+ - "--firstboot-command"
+ - "systemctl stop ssh && systemctl start ssh"
+ - "--firstboot-command"
+ - "apt update && apt upgrade --yes || yum update -y || true"
+ when:
+ - libvirt_uri_system|bool
+ - not sentinel_stat.stat.exists
+ - >-
+ (target_arch_arm64|default(false) and ansible_facts['architecture'] != 'aarch64') or
+ (target_arch_x86_64|default(false) and ansible_facts['architecture'] == 'aarch64')
vars:
ansible_callback_diy_runner_on_ok_msg: |
$ {{ ansible_callback_diy.result.output.cmd | join(' ') }}
{{ ansible_callback_diy.result.output.stdout | default('') }}
- - name: Customize the downloaded image with kdevops user and settings (non-root)
+ - name: Customize the downloaded image with kdevops user and settings (non-root, same architecture)
ansible.builtin.command:
argv:
- "virt-customize"
@@ -201,6 +222,25 @@
when:
- not libvirt_uri_system|bool
- not sentinel_stat.stat.exists
+ - not (target_arch_arm64|default(false) and ansible_facts['architecture'] != 'aarch64')
+ - not (target_arch_x86_64|default(false) and ansible_facts['architecture'] == 'aarch64')
+
+ - name: Customize the downloaded image with kdevops user and settings (non-root, cross-architecture)
+ ansible.builtin.command:
+ argv:
+ - "virt-customize"
+ - "-a"
+ - "{{ custom_image }}"
+ - "--firstboot-command"
+ - "systemctl stop ssh && systemctl start ssh"
+ - "--firstboot-command"
+ - "apt update && apt upgrade --yes || yum update -y || true"
+ when:
+ - not libvirt_uri_system|bool
+ - not sentinel_stat.stat.exists
+ - >-
+ (target_arch_arm64|default(false) and ansible_facts['architecture'] != 'aarch64') or
+ (target_arch_x86_64|default(false) and ansible_facts['architecture'] == 'aarch64')
vars:
ansible_callback_diy_runner_on_ok_msg: |
$ {{ ansible_callback_diy.result.output.cmd | join(' ') }}
diff --git a/playbooks/roles/gen_nodes/tasks/main.yml b/playbooks/roles/gen_nodes/tasks/main.yml
index 60e7f694..c3397a7d 100644
--- a/playbooks/roles/gen_nodes/tasks/main.yml
+++ b/playbooks/roles/gen_nodes/tasks/main.yml
@@ -993,7 +993,7 @@
hostname: "{{ item.name }}"
guestidx: "{{ idx }}"
ansible.builtin.template:
- src: "guestfs_{{ libvirt_machine_type }}.j2.xml"
+ src: "guestfs_{{ libvirt_machine_type_string }}.j2.xml"
dest: "{{ topdir_path }}/guestfs/{{ hostname }}/{{ hostname }}.xml"
force: true
mode: "0644"
diff --git a/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml b/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml
index 29818ea8..e57e6fc7 100644
--- a/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml
+++ b/playbooks/roles/gen_nodes/templates/guestfs_virt.j2.xml
@@ -4,12 +4,12 @@
<currentMemory unit='MiB'>{{ libvirt_mem_mb }}</currentMemory>
<vcpu placement='static'>{{ libvirt_vcpus_count }}</vcpu>
<os firmware='efi'>
- <type arch='aarch64' machine='virt-8.1'>hvm</type>
+ <type arch='aarch64' machine='virt'>hvm</type>
<firmware>
<feature enabled='no' name='enrolled-keys'/>
<feature enabled='no' name='secure-boot'/>
</firmware>
- <loader readonly='yes' type='pflash' format='qcow2'>/usr/share/edk2/aarch64/QEMU_EFI-silent-pflash.qcow2</loader>
+ <loader readonly='yes' type='pflash'>/usr/share/AAVMF/AAVMF_CODE.fd</loader>
<boot dev='hd'/>
</os>
<features>
diff --git a/scripts/gen-nodes.Makefile b/scripts/gen-nodes.Makefile
index 0be012d1..8ca11d60 100644
--- a/scripts/gen-nodes.Makefile
+++ b/scripts/gen-nodes.Makefile
@@ -13,6 +13,10 @@ ifeq (y,$(CONFIG_QEMU_BUILD))
GEN_NODES_EXTRA_ARGS += qemu_bin_path='$(subst ",,$(CONFIG_QEMU_INSTALL_DIR_LIBVIRT))/qemu-system-x86_64'
endif
+ ifeq (y,$(CONFIG_TARGET_ARCH_ARM64))
+ GEN_NODES_EXTRA_ARGS += qemu_bin_path='$(subst ",,$(CONFIG_QEMU_INSTALL_DIR_LIBVIRT))/qemu-system-aarch64'
+ endif
+
ifeq (y,$(CONFIG_TARGET_ARCH_PPC64LE))
GEN_NODES_EXTRA_ARGS += qemu_bin_path='$(subst ",,$(CONFIG_QEMU_INSTALL_DIR_LIBVIRT))/qemu-system-ppc64'
endif
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/5] bootlinux: fix GRUB kernel selection variable scoping
2025-09-15 20:05 [PATCH 0/5] Add ARM64 libguestfs Support Daniel Gomez
` (3 preceding siblings ...)
2025-09-15 20:05 ` [PATCH 4/5] guestfs: add ARM64 support with cross-architecture image customization Daniel Gomez
@ 2025-09-15 20:05 ` Daniel Gomez
2025-09-16 22:39 ` [PATCH 0/5] Add ARM64 libguestfs Support Luis Chamberlain
5 siblings, 0 replies; 7+ messages in thread
From: Daniel Gomez @ 2025-09-15 20:05 UTC (permalink / raw)
To: Luis Chamberlain; +Cc: kdevops, Daniel Gomez
From: Daniel Gomez <da.gomez@samsung.com>
The GRUB detection tasks were running outside the conditional blocks where
kernel_release_file variables are available, causing the tasks to be skipped
due to undefined variables.
Move GRUB detection logic inside the source tree block where kernel_release_file
is properly set and accessible. This ensures the correct kernel is selected as
the GRUB default boot entry during 'make linux' execution.
Generated-by: Claude AI
Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
---
.../roles/bootlinux/tasks/update-grub/install.yml | 154 +++++++++------------
1 file changed, 63 insertions(+), 91 deletions(-)
diff --git a/playbooks/roles/bootlinux/tasks/update-grub/install.yml b/playbooks/roles/bootlinux/tasks/update-grub/install.yml
index 9540480d..dc280031 100644
--- a/playbooks/roles/bootlinux/tasks/update-grub/install.yml
+++ b/playbooks/roles/bootlinux/tasks/update-grub/install.yml
@@ -123,6 +123,69 @@
when:
- kernel_release_file.stat.exists
+ # GRUB detection logic - must be inside the block where kernel_release_file is available
+ - name: Construct the command line to determine the default boot entry (source tree)
+ tags:
+ - saved
+ ansible.builtin.set_fact:
+ determine_default_kernel_id: >-
+ awk -F\' '/menuentry / {print $2}' /boot/grub/grub.cfg |
+ awk '{print NR-1" ... "$0}' |
+ grep {{ kernelrelease }} |
+ head -1 |
+ awk '{print $1}'
+ when:
+ - kernel_release_file.stat.exists
+ - kernelrelease is defined
+ - kernelrelease != "unknown"
+ - ansible_facts['os_family']|lower == 'debian'
+
+ - name: Determine the target kernel's GRUB boot entry number (source tree)
+ tags:
+ - saved
+ become: true
+ become_flags: "su - -c"
+ become_method: ansible.builtin.sudo
+ ansible.builtin.shell:
+ cmd: "{{ determine_default_kernel_id }}"
+ register: grub_boot_number_cmd
+ changed_when: false
+ when:
+ - kernel_release_file.stat.exists
+ - kernelrelease is defined
+ - kernelrelease != "unknown"
+ - determine_default_kernel_id is defined
+
+ - name: Set the target kernel to be booted by default (source tree)
+ become: true
+ become_flags: "su - -c"
+ become_method: sudo
+ ansible.builtin.command:
+ cmd: "/usr/sbin/grub-set-default \"{{ grub_boot_number_cmd.stdout_lines.0 }}\""
+ tags: ["saved"]
+ when:
+ - grub_boot_number_cmd is defined
+ - grub_boot_number_cmd.rc is defined
+ - grub_boot_number_cmd.rc == 0
+ - grub_boot_number_cmd.stdout is defined
+ - grub_boot_number_cmd.stdout != ""
+
+ - name: Itemize kernel and GRUB entry selected (source tree)
+ ansible.builtin.debug:
+ msg: >-
+ {{ target_kernel }} determined to be {{ grub_boot_number_cmd.stdout_lines.0 }}
+ on the GRUB2 flat menu.
+ Ran: grub-set-default {{ grub_boot_number_cmd.stdout_lines.0 }}
+ vars:
+ target_kernel: "{{ target_linux_ref | replace('v', '') }}"
+ tags: ["saved"]
+ when:
+ - grub_boot_number_cmd is defined
+ - grub_boot_number_cmd.rc is defined
+ - grub_boot_number_cmd.rc == 0
+ - grub_boot_number_cmd.stdout is defined
+ - grub_boot_number_cmd.stdout != ""
+
- name: Set default kernelrelease if not determined
ansible.builtin.set_fact:
kernelrelease: "unknown"
@@ -149,94 +212,3 @@
when:
- kernel_release_file.stat.exists
-- name: Construct the command line to determine the default boot entry
- tags:
- - saved
- ansible.builtin.set_fact:
- determine_default_kernel_id: >-
- awk -F\' '/menuentry / {print $2}'
- /boot/grub/grub.cfg | awk '{print NR-1" ... "$0}' |
- grep {{ kernelrelease }} | head -1 | awk '{print $1}'
- when:
- - kernel_release_file is defined
- - kernel_release_file.stat is defined
- - kernel_release_file.stat.exists
- - kernelrelease is defined
- - kernelrelease != "unknown"
- - ansible_os_family != "RedHat" or ansible_distribution_major_version | int < 8
-
-- name: Construct the command line to determine default boot entry for RHEL >= 8
- tags:
- - saved
- ansible.builtin.set_fact:
- determine_default_kernel_id: >-
- for f in $(ls -1 /boot/loader/entries/*.conf); do
- cat $f;
- done | grep title | awk '{ gsub("title ", "", $0); print }' | grep '{{ kernelrelease }}';
- when:
- - kernel_release_file is defined
- - kernel_release_file.stat is defined
- - kernel_release_file.stat.exists
- - kernelrelease is defined
- - kernelrelease != "unknown"
- - ansible_os_family == "RedHat"
- - ansible_distribution_major_version | int >= 8
-
-# If this fails then grub-set-default won't be run, and the assumption here
-# is either you do the work to enhance the heuristic or live happy with the
-# assumption that grub2's default of picking the latest kernel is the best
-# option.
-- name: Determine the target kernel's GRUB boot entry number
- # noqa: command-instead-of-shell
- tags:
- - saved
- become: true
- become_flags: "su - -c"
- become_method: ansible.builtin.sudo
- ansible.builtin.shell:
- cmd: "{{ determine_default_kernel_id }}"
- register: grub_boot_number_cmd
- changed_when: false
- when:
- - kernel_release_file is defined
- - kernel_release_file.stat is defined
- - kernel_release_file.stat.exists
-
-- name: Obtain command to set default kernel to boot
- ansible.builtin.set_fact:
- grub_set_default_boot_kernel: grub-set-default
- when: ansible_facts['os_family']|lower != 'redhat' or ansible_facts['distribution_major_version'] | int < 8
-
-- name: Obtain command to set default kernel to boot for RHEL >= 8
- ansible.builtin.set_fact:
- grub_set_default_boot_kernel: grub2-set-default
- when: ansible_facts['os_family']|lower == 'redhat' and ansible_facts['distribution_major_version'] | int >= 8
-
-- name: Set the target kernel to be booted by default moving forward if the above command worked
- become: true
- become_flags: "su - -c"
- become_method: sudo
- ansible.builtin.command: "{{ grub_set_default_boot_kernel }} \"{{ target_boot_entry }}\""
- vars:
- target_boot_entry: "{{ grub_boot_number_cmd.stdout_lines.0 if (grub_boot_number_cmd is defined and grub_boot_number_cmd.stdout_lines is defined) else '' }}"
- tags: ["saved"]
- when:
- - grub_boot_number_cmd is defined
- - grub_boot_number_cmd.rc is defined
- - grub_boot_number_cmd.rc == 0
- - grub_boot_number_cmd.stdout is defined
- - grub_boot_number_cmd.stdout != ""
-
-- name: Itemize kernel and GRUB entry we just selected
- ansible.builtin.debug:
- msg: "{{ target_kernel }} determined to be {{ target_boot_entry }} on the GRUB2 flat menu. Ran: grub-set-default {{ target_boot_entry }}"
- vars:
- target_kernel: "{{ target_linux_ref | replace('v', '') }}"
- target_boot_entry: "{{ grub_boot_number_cmd.stdout_lines.0 }}"
- tags: ["saved"]
- when:
- - grub_boot_number_cmd is defined
- - grub_boot_number_cmd.rc is defined
- - grub_boot_number_cmd.rc == 0
- - grub_boot_number_cmd.stdout is defined
- - grub_boot_number_cmd.stdout != ""
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 0/5] Add ARM64 libguestfs Support
2025-09-15 20:05 [PATCH 0/5] Add ARM64 libguestfs Support Daniel Gomez
` (4 preceding siblings ...)
2025-09-15 20:05 ` [PATCH 5/5] bootlinux: fix GRUB kernel selection variable scoping Daniel Gomez
@ 2025-09-16 22:39 ` Luis Chamberlain
5 siblings, 0 replies; 7+ messages in thread
From: Luis Chamberlain @ 2025-09-16 22:39 UTC (permalink / raw)
To: Daniel Gomez; +Cc: kdevops, Daniel Gomez
On Mon, Sep 15, 2025 at 10:05:37PM +0200, Daniel Gomez wrote:
> This patch series adds/fixes ARM64 support for kdevops libguestfs
> workflows with cross-architecture handling and includes critical bug
> fixes discovered during integration testing.
>
> Changes:
> * ARM64 Support: Add ARM64 target detection with cross-architecture
> image customization (full setup for same-arch,
> firstboot-only for cross-arch due to binary compatibility)
> * GRUB Fix: Resolve variable scoping issue causing kernel selection
> tasks to be skipped
> * libvirt User Fix: Fix incorrect task inclusion in user enablement
> workflow
> * Base Image Fix: Correct Ansible variable syntax in rolling release
> warnings
>
> Testing: Successfully validated on ARM64 Debian 13 systems.
>
> Signed-off-by: Daniel Gomez <da.gomez@samsung.com>
Applied and pushed, thanks!
Luis
^ permalink raw reply [flat|nested] 7+ messages in thread