From 137f4245ecc7da847a0ca95ebd10612b1e41a531 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 28 Jul 2026 06:27:15 +0000 Subject: [PATCH] [FIX] script todo: wait for cloud-init before install (Arch pacman lock) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Arch install failed at once: "error: failed to synchronize all databases (unable to lock database)" then "reflector: command not found". Cause: cloud-init was still running its own pacman (installing qemu-guest-agent/openssh) and held /var/lib/pacman/db.lck when our bootstrap started, so every pacman call failed and reflector never got installed. Fix: the remote install now waits for cloud-init to finish first ("cloud-init status --wait", 15 min timeout) before touching any package manager — this releases the apt/dnf/pacman lock cloud-init holds during its package stage (helps all distros). For Arch, also drop a stale db.lck when no pacman is actually running. Verified live: cloud-init done, no lock, reflector + refresh + curl/git/make all succeed. Co-Authored-By: Claude Opus 4.8 (1M context) --- script/todo/todo.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/script/todo/todo.py b/script/todo/todo.py index 81fcafc..d746a28 100755 --- a/script/todo/todo.py +++ b/script/todo/todo.py @@ -1673,6 +1673,13 @@ class TODO: puis clone + make install_os + make install_odoo_18).""" return ( "set -e; " + # Attendre la FIN de cloud-init : pendant sa phase « paquets » il + # tient le verrou apt/dnf/pacman -> sinon « unable to lock + # database » (Arch) / « Could not get lock » (apt). timeout pour ne + # pas bloquer indéfiniment si cloud-init traîne. + "command -v cloud-init >/dev/null 2>&1 && " + "sudo timeout 900 cloud-init status --wait >/dev/null 2>&1 " + "|| true; " # Outils d'amorçage (absents des images cloud minimales) : curl, # git, make. Chaque branche RAFRAÎCHIT d'abord les dépôts pour que # la VM soit la plus rapide possible (miroirs à jour / les plus @@ -1693,6 +1700,10 @@ class TODO: "sudo dnf install -y --refresh $PKGS || " "{ sudo dnf clean all; sudo dnf install -y --refresh $PKGS; }; " "elif command -v pacman >/dev/null 2>&1; then " + # Verrou pacman périmé (cloud-init interrompu) : le retirer SEULEMENT + # si aucun pacman ne tourne, sinon on attend qu'il se libère. + "pgrep -x pacman >/dev/null 2>&1 " + "|| sudo rm -f /var/lib/pacman/db.lck; " # Arch : reflector sélectionne les miroirs HTTPS les plus rapides, # puis rafraîchit la base et installe. "sudo pacman -Sy --needed --noconfirm reflector || true; "