NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.39k stars 13.61k forks source link

nixos/etc: system.etc.overlay.enable make system unable to login after reboot #337226

Open avnik opened 3 weeks ago

avnik commented 3 weeks ago

Describe the bug

system.etc.overlay.enable make system unable to login after reboot

Steps To Reproduce

Steps to reproduce the behavior:

  1. Turn on overlays
    system.etc.overlay = {
    enable = true;
    mutable = true;
    };
  2. switch, reboot
  3. try to login

Expected behavior

I expect, that I able to log in

Additional context

I have users.mutableUsers = true if this matters.

Notify maintainers

@nikstur

Metadata

My build based on top of 771c5644e82f5cfba6673771f7dab77c5c46995f from master branch


Add a :+1: reaction to issues you find important.

nikstur commented 2 weeks ago

This is expected and somewhat intended. There is no mechanism to transfer state from the old /etc mechansim to the overlay. You can somewhat cricumvent this by setting your user password via initialHashedPassword or hashedPassword but this still won't necessarily transfer all possible state you have on /etc.

I currently do not plan to build such a mechanism either.

avnik commented 2 weeks ago

@nikstur thanks for explanation. May be you denote it in docs/comments, that state not fully transferred?

Also -- would it enough to move passwd+shadow from current /etc to /.rw-etc/upper?

nikstur commented 2 weeks ago

would it enough to move passwd+shadow from current /etc to /.rw-etc/upper?

You can try that but it's hard to predict (even for me when I moved to the overlay etc) what state you have lying around that you need to transfer.

It's generally not a bad idea though to set you users passwords via hashedPassword.

avnik commented 2 weeks ago

@nikstur Anyway, worth to mention this in docs

nyabinary commented 1 week ago

Duplicate of #319524 ?