Skip to content

Commit d239ac6

Browse files
committed
nixos-anywhere: fix trying to run sudo after kexec
This is unnecessary because we switch to using `root` after we kexec and `nixos-images` provides an installer without `sudo` so this actively causes installations to fail if a user wasn't already booted into a NixOS installer.
1 parent 14bc45b commit d239ac6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/nixos-anywhere.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,9 +581,6 @@ generateHardwareConfig() {
581581
mkdir -p "$(dirname "$hardwareConfigPath")"
582582
case "$hardwareConfigBackend" in
583583
nixos-facter)
584-
if [[ ${isInstaller} == "y" ]]; then
585-
maybeSudo=""
586-
fi
587584
if [[ ${hasNixOSFacter} == "n" ]]; then
588585
step "Generating facter.json using nixos-facter from nixpkgs"
589586
@@ -704,6 +701,9 @@ TMPDIR=/root/kexec setsid --wait ${maybeSudo} /root/kexec/kexec/run --kexec-extr
704701
# After kexec we explicitly set the user to root@
705702
sshConnection="root@${sshHost}"
706703
704+
# TODO: remove this after we reimport facts post-kexec and set this as a fact
705+
maybeSudo=""
706+
707707
# waiting for machine to become available again
708708
until runSsh -o ConnectTimeout=10 -- exit 0; do sleep 5; done
709709
}

0 commit comments

Comments
 (0)