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

systemd: added groups kvm, render #45083

Merged
merged 1 commit into from Aug 25, 2018
Merged

systemd: added groups kvm, render #45083

merged 1 commit into from Aug 25, 2018

Conversation

typetetris
Copy link
Contributor

@typetetris typetetris commented Aug 15, 2018

they need to exist according to the README of systemd

Motivation for this change

Fix #45071

Things done

Added groups render and kvm

  • 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)
    nixos/tests/misc.nix
    nixos/tests/systemd.nix
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-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)
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Aug 16, 2018

I assume /dev/kvm will be then owned by the kvm group. Is it still possible after this change to use kvm without root?

@typetetris
Copy link
Contributor Author

@Mic92: On my system /dev/kvm is read- and writable for all with permissions crw-rw-rw- so it probably doesn't matter, which group owns /dev/kvm.

Otherwise I would be glad to install my nixos from a release-18.03 with this commit cherry picked. I just don't know, how to do it. Is the only way to provide a custom channel? (url with nixexprs.tgz and binary-cache-url files?)

@Mic92
Copy link
Member

Mic92 commented Aug 16, 2018

You can set the NIX_PATH environment variable to your nixpkgs fork: NIX_PATH=nixpkgs=/path/to/git/checkout
then just checkout the 18.03 release branch and cherry-pick your changes.

@typetetris
Copy link
Contributor Author

I did export NIX_PATH=nixpkgs=/path/to/git/checkout as root and did run nixos-rebuild switch but I got the following error:

error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I), at /home/typetetris/repos/nixpkgs/nixos/default.nix:1:60
(use '--show-trace' to show detailed location information)

@typetetris
Copy link
Contributor Author

nixos-rebuild switch -I nixpkgs=/path/to/nixpkgs -I nixos-config=/etc/nixos/configuration.nix did work, but it isn't finished yet. (Bad internetconnection here.)

@dezgeg
Copy link
Contributor

dezgeg commented Aug 16, 2018

NixOS comes with a udev rule to set 0666 for /dev/kvm:

KERNEL=="kvm",                  MODE="0666"

so the group of the device node isn't relevant.

@dezgeg
Copy link
Contributor

dezgeg commented Aug 16, 2018

BTW they do have a sysusers.d file which could be used to check which users are necessary: https://github.com/systemd/systemd/blob/e97b7b5a9c6d76964e3b9d8947ab6ccb30104e0e/sysusers.d/basic.conf.in

@typetetris
Copy link
Contributor Author

Hmm, it build a new system derivation, but in /etc/groups the groups render or kvm aren't present. Does the misc module only apply for a fresh reinstall?

@typetetris
Copy link
Contributor Author

@dezgeg Why not just trust the README?

@typetetris
Copy link
Contributor Author

@dezgeg render and kvm groups are mentioned in the file you specify.

@typetetris
Copy link
Contributor Author

Ah, I need to alter nixos/modules/config/users-groups.nix too.

they need to exist according to the README of systemd
@typetetris
Copy link
Contributor Author

After a rebuild and a reboot:

$ ls -l /dev/kvm
crw-rw-rw- 1 root kvm 10, 232 Aug 17 05:29 /dev/kvm

That should be ok?

@typetetris
Copy link
Contributor Author

journalctl | grep kvm shows the error message 'Specified group 'kvm' unknown' is gone.

@dezgeg
Copy link
Contributor

dezgeg commented Aug 17, 2018

Because the sysusers.d file is machine-parseable thus could be used in a nixos test for instance. (I mean, ideally we'd just use the file directly to avoid this kind of problems, but it probably sounds kind of hard to fit into our passwd/shadow generator).

@typetetris
Copy link
Contributor Author

I could try to write a test case for nixos/tests/systemd.nix but that will probably take a while. Should this pull request be stalled, until such a test arrives?

@danbst
Copy link
Contributor

danbst commented Aug 17, 2018

I don't think there is need for test right now. Issue isn't show-stopper.

@dezgeg
Copy link
Contributor

dezgeg commented Aug 17, 2018

Yeah I agree, there's no real pressure for writing the test. Just something handy to have when we update systemd the next time, but that's likely not going to happen in months.

@typetetris
Copy link
Contributor Author

Is there something I still need to do, to get this merged? If it is unwanted change, please tell me, so I can close the pull request.

@dezgeg dezgeg merged commit 7f8b1dd into NixOS:master Aug 25, 2018
@dezgeg
Copy link
Contributor

dezgeg commented Aug 25, 2018

Sorry this fell through the cracks. Applied now.

@typetetris typetetris deleted the 45071 branch August 26, 2018 15:04
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

6 participants