Install question

I had to rebuild my NixOS laptop with the latest build (21.11 minimal installer). I am running into an issue or I am not understanding completely. Everything installs completely and looks normal. The installer requests a password, section 2.3 part 5, and I supply a password. Reboot the system as specified.

My many attempts at logging into the system fails regardless of the password used. There is an interesting effect where I try to log in as root, NixOS accepts the password, blanks the screen as if logging in then drops me back to the logon screen. My configuration.nix does specify my account (sandor). One of my experiments, I created my account and added a password before rebooting. It did not allow me to log in with the password.

What am I missing or not understanding?

Does your password use numbers? Remember to activate numlock since it’s off by default

i don’t really remember how installation process is defined, but it’s possible that you are talking about entering a root password during installation, and trying to login into your user, but user’s password isn’t set during install and it’s setup, you need to do it manually/set it in config

try to use nixos-enter from livecd and use passwd USERNAME there to set the password

1 Like

I tried the following accounts: root, nixos, and my account (sandor) using the password. The password was a single one word (e.g. back). No numbers, no special characters. The laptop keyboard is smaller size and has no number pad.

My configuration.nix does specify my account. In one attempts, I provided a password for root and a password for my account (sandor). Neither password worked.

The password you entered at the end of installation is the root password, when booting the newly installed system, you can go to a text terminal screen with ctrl-alt-F1 and login as root (with the password you set at end of installation)

There you do set the user (sandor) password with:

passwd sandor

Then you go back to Gui desktop with alt-F7

And login the system with sandor and the password you just set

1 Like

Not directly helpful to OP’s situation, but I’ve always felt that the installer’s password setup process to be needlessly confusing. It’s not 100% clear which passwords are being set for which users. Add to that the mutable users/immutable users debate. It’s kind of a minefield for first-timers…

EDIT: forgot about password files and all their intricacies as well! What permissions should the password file have again? Should the password hash be set in configuration.nix or should I use password files? Where should password files be placed? How do I generate password files? etc etc etc

The way you’re supposed to do it is to set the user password using passwd while still chrooted into it during installation. I think the docs point that out, too. You should never sign in as root after installation, and root login is often completely disabled (for NixOS, set --no-root-passwd on nixos-install to get that behavior).

Display managers may refuse to let you sign in as root, which might be the problem here, coupled with a misreading of the password settings?

If that is the problem and you forgot to set your password, @M12 's suggestion works, but you can also just go back into the installation medium and chroot into your system using nixos-enter (after mounting all your disks again). From there you have root access to the system and can set your user password using passwd.

In case you’re fishing for actual answers here, I think the answer to all of that is to use sops-nix.

If you’re not fishing for answers, we also have a wiki page nowadays which tries to explain the intricacies and where they come from. It isn’t easy, but kinda necessary. Convenient upstream support for something like sops-nix (i.e., not nixops) would be cool!

I’d love to have a place to put some nice curated tutorials to resolve these complex topics. Maybe I should start something called NixOS by example?

Thanks to everyone who responded. @M12, you are dead on.

I did spend time reading about Linux and played with the text terminal screens. Then promptly forgotten it. For those who need to understand the why’s:

I re-installed the minimal image onto my laptop using my original configuration.nix. My configuration specified the plasma desktop. Following the install directions for NixOS, I did not understand why I could not log into root. I had forgotten root cannot be logged into directly with the GUI at this point. If I commented out the lines in the configuration.nix file for plasma prior to installation, this would never been an issue.

If someone could mention this in the installation documentation, it would be helpful to us newbies. The documentation assumes a certain level of Linux knowledge that not everyone has.