From dc3fff2b566e81bed533efad448fa9618dd05177 Mon Sep 17 00:00:00 2001 From: Plom Heller Date: Mon, 7 Sep 2026 05:26:21 +0200 Subject: [PATCH] Retry passwd until successful rather than aborting script. --- setup_scripts/_lib.sh | 5 +++++ setup_scripts/install_debian.sh | 2 +- setup_scripts/start_root.sh | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/setup_scripts/_lib.sh b/setup_scripts/_lib.sh index 149f046..1dfa7e5 100644 --- a/setup_scripts/_lib.sh +++ b/setup_scripts/_lib.sh @@ -139,6 +139,11 @@ unmount_unrbind() { chroot_sh() { LANG=C.UTF-8 chroot "${PATH_MNT_ROOT}" /bin/sh -c "$@" } +retry_until_success() { + until "$@"; do + msg 'Command failed, retrying: %s …' "$*" + done +} create_lv() { local VG=$1 local LV=$2 diff --git a/setup_scripts/install_debian.sh b/setup_scripts/install_debian.sh index 6c9a05f..87938b3 100755 --- a/setup_scripts/install_debian.sh +++ b/setup_scripts/install_debian.sh @@ -147,7 +147,7 @@ efibootmgr \ # ask root login at latest possible moment, so that on fails: less left undone msg 'Setting up root login …' -chroot_sh "passwd" +retry_until_success chroot_sh "passwd" # clean up unmount_unrbind diff --git a/setup_scripts/start_root.sh b/setup_scripts/start_root.sh index 2e13e68..94e9ca3 100755 --- a/setup_scripts/start_root.sh +++ b/setup_scripts/start_root.sh @@ -46,7 +46,8 @@ udevadm control --reload-rules udevadm trigger --action=add --subsystem-match=backlight msg 'Setting up user: %s' "${USERNAME}" -adduser --comment "" "${USERNAME}" +adduser --disabled-password --comment "" "${USERNAME}" +retry_until_success passwd "${USERNAME}" usermod -a -G sudo,video "${USERNAME}" msg 'Synchronizing clock …' -- 2.30.2