Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2e92520e21ad
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a95182882fb1
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Mar 8, 2019

  1. nixos/nixos-install: tell the user what to do if setting a root passw…

    …ord failed
    
    If setting a root password using the `passwd` call in the
    `nixos-install` script fails, it should be explained how set it manually
    to ensure that nobody gets accidentally locked out of the system.
    Ma27 committed Mar 8, 2019

    Verified

    This commit was signed with the committer’s verified signature. The key has expired.
    Ma27 Maximilian Bosch
    Copy the full SHA
    eaf98c7 View commit details
  2. Merge pull request #56790 from Ma27/improve-error-handling-for-nixos-…

    …install
    
    nixos/nixos-install: tell the user what to do if setting a root password failed
    infinisil authored Mar 8, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a951828 View commit details
Showing with 12 additions and 1 deletion.
  1. +12 −1 nixos/modules/installer/tools/nixos-install.sh
13 changes: 12 additions & 1 deletion nixos/modules/installer/tools/nixos-install.sh
Original file line number Diff line number Diff line change
@@ -138,7 +138,18 @@ fi
# Ask the user to set a root password, but only if the passwd command
# exists (i.e. when mutable user accounts are enabled).
if [[ -z $noRootPasswd ]] && [ -t 0 ]; then
nixos-enter --root "$mountPoint" -c '[[ -e /nix/var/nix/profiles/system/sw/bin/passwd ]] && echo "setting root password..." && /nix/var/nix/profiles/system/sw/bin/passwd'
if nixos-enter --root "$mountPoint" -c 'test -e /nix/var/nix/profiles/system/sw/bin/passwd'; then
set +e
nixos-enter --root "$mountPoint" -c 'echo "setting root password..." && /nix/var/nix/profiles/system/sw/bin/passwd'
exit_code=$?
set -e

if [[ $exit_code != 0 ]]; then
echo "Setting a root password failed with the above printed error."
echo "You can set the root password manually by executing \`nixos-enter --root ${mountPoint@Q}\` and then running \`passwd\` in the shell of the new system."
exit $exit_code
fi
fi
fi

echo "installation finished!"