On my Debian 12 system, /etc/nsswitch.conf (on the system) has
passwd: files systemd
group: files systemd
shadow: files systemd
gshadow: files systemd
Normally /etc/nsswitch.conf isn't included in the initramfs, but some dracut modules cause it to be pulled in, e.g. the nfs module.
nss-systemd by default returns a synthetic entry for root shadow:
# getent -s systemd shadow root
root:!*:::::::
which as we know causes opensshd to refuse logins as root.
Two things need to be true for this to happen:
- your initramfs has no /etc/shadow (or /etc/shadow has no entry for root)
- your initramfs gets a /etc/nsswitch.conf that has systemd as a source for the shadow database
...of which (2) became true for me after I set up NFS one random day, and then I spent a few hours trying to figure out why sshd was saying root was locked.
Just leaving this here in case someone else runs into this issue..
On my Debian 12 system, /etc/nsswitch.conf (on the system) has
Normally /etc/nsswitch.conf isn't included in the initramfs, but some dracut modules cause it to be pulled in, e.g. the nfs module.
nss-systemd by default returns a synthetic entry for root shadow:
which as we know causes opensshd to refuse logins as root.
Two things need to be true for this to happen:
...of which (2) became true for me after I set up NFS one random day, and then I spent a few hours trying to figure out why sshd was saying root was locked.
Just leaving this here in case someone else runs into this issue..