[FIX] install: revue 13 VM — apt lock, wkhtmltopdf trixie, SELinux, poetry

Corrections issues de la revue complète des 13 VM (6 en échec réel) :

- APT lock (debian-12) : au 1er boot, cloud-init/apt-daily tient le verrou
  et « apt-get install » échouait aussitôt. Ajout de
  « -o DPkg::Lock::Timeout=600 » (update + install) -> attend le verrou.

- wkhtmltopdf Debian 13 « trixie » (debian-13) : on prenait le build
  « bullseye » (dépend de libssl1.1, absent de trixie) -> gdebi échouait.
  Désormais bookworm pour bookworm/trixie/+. ET l'échec gdebi est NON
  bloquant (avertissement au lieu d'exit 1 : wkhtmltopdf est optionnel,
  sinon tout install_os avortait et Odoo n'était jamais installé).

- SELinux 203/EXEC (fedora-41/43/44) : un service système ne peut pas
  exécuter run.sh/venv sous /home (contexte user_home_t). Ajout
  conditionnel de « SELinuxContext=unconfined_u:unconfined_r:unconfined_t:s0 »
  au service (uniquement si getenforce != Disabled).

- poetry status 1 (ubuntu-2604) : « -q » masquait la cause. À l'échec, on
  rejoue « poetry install -v » pour capturer l'erreur dans le log.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mathieu Benoit 2026-07-30 01:52:55 -04:00
parent 7904c72d71
commit 64c0bbc698
3 changed files with 37 additions and 9 deletions

View file

@ -36,10 +36,14 @@ elif [[ "${OS}" == "Linuxmint" ]]; then
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
fi
elif [[ "${OS}" == "Debian" ]]; then
if [ "bookworm" == "${DEBIAN_VERSION}" ]; then
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
else
if [ "bullseye" == "${DEBIAN_VERSION}" ]; then
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bullseye_amd64.deb
else
# bookworm (12), trixie (13) et au-delà : wkhtmltopdf ne publie pas de
# build au-delà de « bookworm » -> on prend bookworm (le plus récent).
# Le build « bullseye » (Debian 11) échouait à s'installer sur trixie
# (gdebi : dépendances incompatibles).
WKHTMLTOX_X64=https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb
fi
elif [[ "${OS}" == *"Ubuntu"* ]]; then
echo "Your version of Ubuntu is not supported, only support 18.04, 20.04 and 22.04"
@ -218,11 +222,15 @@ elif [ ${EL_INSTALL_WKHTMLTOPDF} = "True" ]; then
sudo gdebi --n $(basename ${_url})
retVal=$?
if [[ $retVal -ne 0 ]]; then
echo "gdebi install wkhtmltopdf installation error."
exit 1
# wkhtmltopdf est OPTIONNEL (rapports PDF). NON bloquant : sur Debian
# 13 (trixie) le .deb dépendait de libssl1.1 (absent) et « exit 1 »
# faisait échouer TOUT install_os -> Odoo jamais installé. On avertit
# et on continue (comme Arch qui poursuit sans wkhtmltopdf).
echo "wkhtmltopdf : installation échouée, ignoré (optionnel — pas de PDF)."
else
sudo ln -fs /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -fs /usr/local/bin/wkhtmltoimage /usr/bin
fi
sudo ln -fs /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -fs /usr/local/bin/wkhtmltoimage /usr/bin
fi
else
echo -e "\n---- Already installed wkhtml ----"

View file

@ -96,6 +96,11 @@ if [[ "${EL_PHASE}" != "setup" ]]; then
retVal=$?
if [[ $retVal -ne 0 ]]; then
echo "Poetry installation error with status ${retVal}"
# Par défaut « -q » masque la CAUSE (ex. échec de build d'une
# dépendance git/VCS). On rejoue en verbeux pour la capturer dans
# le log -> diagnostic possible sans EL_VERBOSE.
echo "---- Poetry: rejeu verbeux pour diagnostic ----"
poetry install --no-root -v 2>&1 || true
exit 1
fi
fi

View file

@ -3066,6 +3066,16 @@ class TODO:
return (
'SVC_USER=$(whoami); SVC_GROUP=$(id -gn); '
'SVC_DIR="$HOME/git/erplibre"; '
# SELinux (Fedora) INTERDIT à un service système d'exécuter des
# binaires sous /home (run.sh ET le python du venv) -> le service
# échoue en « status=203/EXEC ». On fait tourner l'ExecStart dans
# le domaine unconfined (autorisé à exécuter /home) UNIQUEMENT si
# SELinux est actif (ligne vide sinon, inoffensive).
'SELINUX_LINE=""; '
"if command -v getenforce >/dev/null 2>&1 && "
'[ "$(getenforce)" != "Disabled" ]; then '
'SELINUX_LINE="SELinuxContext=unconfined_u:unconfined_r:'
'unconfined_t:s0"; fi; '
"sudo tee /etc/systemd/system/erplibre.service >/dev/null <<UNIT\n"
"[Unit]\n"
"Description=ERPLibre\n"
@ -3081,6 +3091,7 @@ class TODO:
"ExecStart=$SVC_DIR/run.sh\n"
"WorkingDirectory=$SVC_DIR\n"
"StandardOutput=journal+console\n"
"$SELINUX_LINE\n"
"\n"
"[Install]\n"
"WantedBy=multi-user.target\n"
@ -3116,11 +3127,15 @@ class TODO:
# (Fedora) et pacman (Arch).
"PKGS='curl git make'; "
"if command -v apt-get >/dev/null 2>&1; then "
# DPkg::Lock::Timeout=600 : au 1er boot, cloud-init (install de
# qemu-guest-agent) et/ou apt-daily.service tiennent le verrou apt.
# Sans attente, « apt-get install » échouait aussitôt (« Could not
# get lock … held by process »). On ATTEND le verrou jusqu'à 10 min.
# update best-effort (|| true) puis install OBLIGATOIRE : sans le
# « || true », un « apt-get update » en échec (réseau) sautait
# l'install sans erreur (liste &&) -> git/make absents ensuite.
"sudo apt-get update -qq || true; "
"sudo apt-get install -y $PKGS; "
"sudo apt-get -o DPkg::Lock::Timeout=600 update -qq || true; "
"sudo apt-get -o DPkg::Lock::Timeout=600 install -y $PKGS; "
"elif command -v dnf >/dev/null 2>&1; then "
# makecache (dnf5 choisit les miroirs les plus rapides) puis
# install --refresh ; retry avec « clean all » car les images