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,