Skip to content

NixOS doesn't detect UID/GID collisions #112647

@matthiasbeyer

Description

@matthiasbeyer

Describe the bug

NixOS rolls a dice on system service user IDs.
This caused a very weird bug on my nextcloud deployment: #112640

The issue was, in short, that the nextcloud user got an UID (1001) which I assigned to a new user later on.
This resulted, after a reboot, that the phpfpm-nextcloud.service was started as user (bob) and nothing worked.
The fix felt like digging in mud, coming from the clean and shiny world of NixOS.

But, maybe not so shiny: I blame nixos here.

To Reproduce
Steps to reproduce the behavior:

  1. run nextcloud, or redis,... or any other service that gets a random UID
  2. add a new user with said UID, because you don't know and don't expect the UID to already be assigned - because, to be honest: Who in the world would think that a system service gets UID 1001 or 1002?
  3. Profit!

Expected behavior

User IDs MUST be hardcoded by the administrator / author of configuration.nix


I know that there are predefined UIDs, but for some services there are not (and redis even got removed!). Apparently, this would have prevented the issue.
Also, a hard fail when I first tried to add the new user would have prevented that from happening.


The title of this issue might be a bit misleading. Feel free to suggest something better.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: bugSomething is broken2.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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions