From ee834113338351c5be8b378cb92df39a3aa6d685 Mon Sep 17 00:00:00 2001 From: N0VA Date: Thu, 5 Feb 2026 17:25:00 +0100 Subject: [PATCH] Fix password setting by using passwd --stdin and sync --- iridium_installer/backend/os_install.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/iridium_installer/backend/os_install.py b/iridium_installer/backend/os_install.py index f604bcf..f69915a 100644 --- a/iridium_installer/backend/os_install.py +++ b/iridium_installer/backend/os_install.py @@ -236,12 +236,15 @@ UUID={efi_uuid} /boot vfat defaults 0 2 # Create user and add to wheel group (sudoer) run_command(["chroot", mount_root, "useradd", "-m", "-G", "wheel", user_info["username"]]) - # Set password + # Ensure changes to /etc/passwd and /etc/shadow are flushed + run_command(["sync"]) + + # Set password using passwd --stdin try: logger.info("Setting user password...") p = subprocess.run( - ["chroot", mount_root, "chpasswd"], - input=f"{user_info['username']}:{user_info['password']}\n", + ["chroot", mount_root, "passwd", "--stdin", user_info["username"]], + input=f"{user_info['password']}\n", text=True, check=True, stdout=subprocess.PIPE,