Skip to content
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

syncthing: create default group if not overridden #65566

Merged
merged 1 commit into from Aug 1, 2019

Conversation

rasendubi
Copy link
Member

Motivation for this change

The following configuration generates a systemd unit that doesn't start.

{
  services.syncthing = {
    enable = true;
    user = "my-user";
  };
}

It fails with

systemd[1]: Started Syncthing service.
systemd[6745]: syncthing.service: Failed to determine group credentials: No such process
systemd[6745]: syncthing.service: Failed at step GROUP spawning /nix/store/n1ydz3i08nqp1ajc50ycy1zribmphqc9-syncthing-1.1.4-bin/bin/syncthing: No such process
systemd[1]: syncthing.service: Main process exited, code=exited, status=216/GROUP
systemd[1]: syncthing.service: Failed with result 'exit-code'.

This is due to the fact that syncthing group (default) is not created if the user is overridden.

Add a separate check for setting up the default group, so that user/group are created independently.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

This became an issue after #65078
/cc @peterhoeg @aanderse

The following configuration generates a systemd unit that doesn't
start.
```nix
{
  services.syncthing = {
    enable = true;
    user = "my-user";
  };
}
```

It fails with
```
systemd[1]: Started Syncthing service.
systemd[6745]: syncthing.service: Failed to determine group credentials: No such process
systemd[6745]: syncthing.service: Failed at step GROUP spawning /nix/store/n1ydz3i08nqp1ajc50ycy1zribmphqc9-syncthing-1.1.4-bin/bin/syncthing: No such process
systemd[1]: syncthing.service: Main process exited, code=exited, status=216/GROUP
systemd[1]: syncthing.service: Failed with result 'exit-code'.
```

This is due to the fact that `syncthing` group (default) is not
created if the user is overridden.

Add a separate check for setting up the default group, so that
user/group are created independently.
@aanderse
Copy link
Member

aanderse commented Jul 30, 2019

@rasendubi I must have misread your code earlier... please disregard my previous comment, which I have removed.

Copy link
Member

@aanderse aanderse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

Looking to @peterhoeg for final approval and merging.

@aanderse aanderse requested a review from peterhoeg August 1, 2019 11:25
@globin globin merged commit 443b0f6 into NixOS:master Aug 1, 2019
@peterhoeg
Copy link
Member

Sorry about being late to the game, but is this really a supported workflow? The current syncthing module (and most other modules) are actually system-level modules where the user variable is used to set the system-level user that something runs as, which is not a regular interactive user.

@aanderse
Copy link
Member

@peterhoeg yeah I get what you're saying and I think that's a high level conversation that needs to happen so we can establish written guidelines and stop using regular desktop users with system level modules... but this PR fixed an existing logic bug so it made sense to me that it was merged.

Is that a reasonable answer?

@peterhoeg
Copy link
Member

peterhoeg commented Aug 13, 2019 via email

@rasendubi
Copy link
Member Author

rasendubi commented Aug 14, 2019 via email

@peterhoeg
Copy link
Member

peterhoeg commented Aug 14, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants