From a82425b10738c9119075c2347e258d5048530f1d Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Sun, 21 Sep 2025 17:17:08 +0200 Subject: Clean up bootmgr and fix systemd-boot regression issue Also update the syntax to use the new loop syntax instead of with_items --- roles/bootstrap/tasks/install-ubuntu.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'roles/bootstrap/tasks/install-ubuntu.yml') diff --git a/roles/bootstrap/tasks/install-ubuntu.yml b/roles/bootstrap/tasks/install-ubuntu.yml index 1b22c69..407da3c 100644 --- a/roles/bootstrap/tasks/install-ubuntu.yml +++ b/roles/bootstrap/tasks/install-ubuntu.yml @@ -30,7 +30,7 @@ dest: "{{ item.dest }}" mode: "0640" content: "{{ item.content }}" - with_items: + loop: - dest: "{{ mnt_root_path }}/etc/apt/preferences.d/ignored-package" content: "{{ bootstrap_apt_ignored_preferences }}" - dest: "{{ mnt_root_path }}/etc/apt/sources.list" @@ -40,11 +40,21 @@ ansible.builtin.command: cmd: "arch-chroot {{ mnt_root_path }} {{ item }}" changed_when: true - with_items: + loop: - "apt-get update" - "apt-get install -y {{ bootstrap_distro.packages | join(' ') }}" -- name: "Run bootclt" +- name: "Clean up old Linux Boot Manager entries" + ansible.builtin.shell: + cmd: | + for entry in $(efibootmgr | grep "Linux Boot Manager" | cut -d'*' -f1 | tr -d 'Boot'); do + efibootmgr -b $entry -B + done + changed_when: false + failed_when: false + +# NOTE: bootctl is not run in chroot to workaround https://github.com/systemd/systemd/issues/36174 +- name: "Run bootctl" ansible.builtin.command: - cmd: "arch-chroot {{ mnt_root_path }} bootctl install" + cmd: "bootctl install --esp-path={{ mnt_boot_path }}" changed_when: true -- cgit v1.2.3