Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions archinstall/lib/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1922,16 +1922,17 @@ def _create_user(self, user: User) -> None:
if not handled_by_plugin:
info(f'Creating user {user.username}')

cmd = 'useradd -m'
cmd = ['arch-chroot', '-S', str(self.target), 'useradd', '-m']

if user.sudo:
cmd += ' -G wheel'
cmd += ['-G', 'wheel']

cmd += f' {user.username}'
cmd.append(user.username)

try:
self.arch_chroot(cmd)
except SysCallError as err:
run(cmd)
except CalledProcessError as err:
debug(f'Error creating user {user.username}: {err}')
raise SystemError(f'Could not create user inside installation: {err}')

for plugin in plugins.values():
Expand All @@ -1942,7 +1943,11 @@ def _create_user(self, user: User) -> None:
self.set_user_password(user)

for group in user.groups:
self.arch_chroot(f'gpasswd -a {user.username} {group}')
cmd = ['arch-chroot', '-S', str(self.target), 'gpasswd', '-a', user.username, group]
try:
run(cmd)
except CalledProcessError as err:
debug(f'Error adding {user.username} to group {group}: {err}')

if user.sudo:
self.enable_sudo(user)
Expand Down