Skip to content

useradd changes to /etc/sub[ug]id don't persist past next activation #64606

@jameysharp

Description

@jameysharp

Issue description

On a NixOS system with mutableUsers = true, the admin is supposed to be able to imperatively add users by running useradd.

The useradd command automatically allocates a UID and GID range for the new user if /etc/subuid or /etc/subgid exist, which they always do on NixOS.

However, all changes to these two files are overwritten on the next system reboot or nixos-rebuild, which to me seems counter to the intent of mutableUsers.

Steps to reproduce

useradd -m testuser
grep '^testuser:' /etc/sub[ug]id # should match
/run/current-system/activate
grep '^testuser:' /etc/sub[ug]id # nothing

Technical details

  • system: "x86_64-linux"
  • host os: Linux 5.1.14, NixOS, 19.09.git.6cc7e33 (Loris)
  • sandbox: yes
  • version: nix-env (Nix) 2.2.2

The channel info isn't meaningful because I built from a git checkout, not my normal channels, and I tested in a container that didn't have access to /nix/var anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancementAdd something new or improve an existing system.2.status: stalehttps://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md6.topic: nixosIssues or PRs affecting NixOS modules, or package usability issues specific to NixOS

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions