Good evening all, having some issues related to NixOS, specifically on my Steam Deck this time. My current configuration is a 256GB NVMe SSD in a USBenclosure, booting over USB. I decided last night to copy the install from the external SSD to the internal SSD with e2image, and it looked like it booted right. I enabled some options in my config related to GitHub - Jovian-Experiments/Jovian-NixOS: Discussions: https://matrix.to/#/#Jovian-Experiments:matrix.org, and I mistakenly chose switch instead of boot when running nixos-rebuild. I didn’t think much of it, booted into an install image, reverted the changes, but now when I try running nixos-rebuild, I get the following error: sudo: PAM account management error: Authentication service cannot retrieve authentication info sudo: a password is required
What could possibly be causing this? I’m using nixos-enter to try and rebuild the config, but it fails at this message every single time, and I don’t know what could possibly be causing this.
For now, what I am trying to do is rerun nixos-install from the live environment with a fresh config, then copy my config, rebuild (hopefully), and potentially fix this.
Running into this trying to fix nixos asahi right now.
I ran in to the same. To work around opened /etc/pam.d/sudo
and pasted in:
#%PAM-1.0
auth sufficient pam_rootok.so
#auth required pam_unix.so
auth required pam_permit.so
#account required pam_unix.so
account required pam_permit.so
account required pam_warn.so
#session required pam_unix.so
session required pam_permit.so
password required pam_permit.so
which I found in this Arch post. Saved the file and sudo
started working again.
I just ran across this myself. The reason this was happening for me was because I had run sudo -i
at some point previously followed later by nixos-enter
before running nixos-rebuild
inside my rescue environment. This ultimately resulted in the error originally reported above which was happening because the environment variable SUDO_USER
was inherited from the parent shell before doing nixos-enter
and the nixos-rebuild
script looks for this environment variable and acts on it, which folks who run across this post, probably don’t really want to happen.
The easy solution is to run unset SUDO_USER
before running nixos-rebuild
, and it will most likely make the error go away, as it did for me.
In my case, this happens because sudo
and unix_chkpwd
does not have the setuid bit. IIUC this is normally setup by system activation, by copying those binaries to /run/wrappers/bin
then add setuid bits to them. After doing so manually, sudo
started to work.
Hope this helps.