Nixos-rebuild test --flake ".#workstation erased user credentials

While implementing a modded version of I used the test command above. The switch went through without errors but after a reboot I can’t log in with my normal user credentials or as root. Rollback don’t help either. I’m guessing the line

users.mutableUsers = false;

in the configuration removed some or all user data despite the test command.

Any ideas if this could be the reason and how to proceed from here?
Would it be possible to chroot to the system and manually create the probably destroyed user credentials?

You should be able to boot into live-USB, nixos-install after mounting everything, set new root password, reboot, log in as root from TTY, use passwd $user to set all users passwords anew, if you didn’t provide initialPasswords for them.

1 Like

You could also use nixos-enter and circumvent the root password setting and rebooting.

I doubt that’ll work, as user data is already destroyed. This includes the root password.

And I’m not sure if you can already use passwd if the user hasn’t been created yet. But nixos won’t create the user without switching or installing, but you can’t switch in a nixos-entered system.

Thank you for the tips. I got the issue fixed but this seems like a bug to me so I posted a github issue with recovery instructions.

Here’s a link to it in case you’re interested: