balsoft/nixos-config

Locked out of my computer 🥶

zwhitchcox opened this issue · 4 comments

Hi, I was trying to test your nix config, and ended up locking myself out of my computer. I can get to the sway desktop screen, but cannot open the terminal. ctrl+alt+fN isn’t working either for some reason.

When I try to roll back to a previous generation, my account login doesn’t work, and the root password has been changed, and I can’t figure out to what.

I tried logging in as balsoft too with a blank password, but it would not log me in, I think because this has my old account, but I can’t log in to that, because the password was reset, and I can’t log in as root to change it.

I was wondering if you might know what the root password could be or if you had any other suggestions. If I need to reinstall the OS, it’s not a huge deal, and I won’t lose too much work, but I’d like to recover it if possible.

Thanks

There are no passwords for root or balsoft, the only way to log in is using yubikey for auth. Since you've never set that up, you can't log in. Also, since mutableUsers = false, your passwords have been reset. Probably the easiest way to fix this is to boot your previous configuration with init=/bin/sh instead of the regular init, then change the root password using passwd, reboot into your old config again and continue from there. Sorry for the inconvenience :)

Wow, thanks! I'm trying to change the password, and it's saying the passwd command is not found though. I also can't edit /etc/passwd, because there is no editor built in.

Any more suggestions?

image

These are the commands I have

image

Which are pretty limiting.

I am able to boot into a live image of nixos too, so maybe I should just change /etc/passwd from there?

Ok, never mind, got it by mounting the ssd through the live disk, finding the path to passwd, and running it in /bin/sh. Thanks for your help!

P.S. if you have a better way to do that please share if you don't mind

Wow, thanks! I'm trying to change the password, and it's saying the passwd command is not found though. I also can't edit /etc/passwd, because there is no editor built in.

Ah, right, you don't have anything in PATH when you just do that. I think if you do export PATH=${0%%/bash} it should become available.