-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sysusers only for sysusers #328926
Sysusers only for sysusers #328926
Conversation
systemd-sysusers cannot create normal users (i.e. with a UID > 1000). Thus we stop trying an explitily only use systemd-sysusers when there are no normal users on the system (e.g. appliances).
On Linux we cannot feasbibly generate users statically because we need to take care to not change or re-use UIDs over the lifetime of a machine (i.e. over multiple generations). This means we need the context of the running machine. Thus, stop creating users statically and instead generate them at runtime irrespective of mutableUsers. When /etc is immutable, the password files (e.g. /etc/passwd etc.) are created in a separate directory (/var/lib/nixos/etc). /etc will be pre-populated with symlinks to this separate directory. Immutable users are now implemented by bind-mounting the password files read-only onto themselves and only briefly re-mounting them writable to re-execute sysusers. The biggest limitation of this design is that you now need to manually unmount this bind mount to change passwords because sysusers cannot change passwords for you. This shouldn't be too much of an issue because system users should only rarely need to change their passwords.
Regardless of mutable or immutable users, systemd-sysupdate never updates existing user records and thus will for example never change passwords for you. It only support initial passwords and now actively asserts agains other paswords.
How will the root user be handled in the homed case? |
The root user will always be handled by sysusers |
@ofborg test systemd-sysusers-immutable systemd-sysusers-mutable activation-etc-overlay-immutable activation-etc-overlay-mutable |
Hi there, I am afraid this patch has some problems within.
First of all, the above assertion is pretty cruel to devs, I had no idea which user is blocking my build so adding "${_username}" as a prefix mite be kind to all of us. Another problem is I build a kexec image with nixos-images by the modules noninteractive and kexec-installer. The former uses perlless and the latter insert users.user.nixos. I do not know any means to remove the nixos user from the installer hence the following uglyness.
I think there must be an agreement btw the installer in nixos and the perlless otherwise the above error message mite bite us on the long run. best, |
Makes sense. Could you make a pull request? |
I also added your patch to nixos-images: nix-community/nixos-images#261 |
d43e323 fixes #325052
2710a49 fixes #318365
2ca0453 fixes #307159
The most important change is that sysusers now will only create system users. You cannot use this when you have normal users! I plan to add a perlless mode to add normal users via systemd-homed in the future.
Also, sysusers is now always executed at runtime even when /etc is immutable and when
mutableUsers = false
.closes #328727
Description of changes
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.