Skip to content

Conversation

evelikov
Copy link

Add a trivial gamemode.conf file, which creates the gamemode group.

Add a trivial gamemode.conf file, which creates the gamemode group.

v2: git add gamemode.conf (d'oh)

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
@evelikov
Copy link
Author

@afayaz-feral any input?

@evelikov-work
Copy link
Contributor

@mdiluz are you still involved in gamemode, any comments?

@mdiluz
Copy link
Contributor

mdiluz commented Jan 30, 2022

I am, I'll chase up with some contacts at Feral. Might be worth explaining why this is needed though.

@afayaz-feral
Copy link
Contributor

I can see the merit in having a gamemode group, thanks for adding this.

@afayaz-feral afayaz-feral merged commit 898feb9 into FeralInteractive:master Feb 3, 2022
@evelikov-work
Copy link
Contributor

evelikov-work commented Feb 4, 2022

Thanks everyone. To elaborate on the reason why I think this is a good idea:

AFAICT gamemode manages sysfs entries, where most of the setters (cpu_gov, amdgpu dpm) require root permissions. Using root isn't particularly good, since it exposes much larger surface for misuse or abuse. To avoid that, we add a dedicated group, annotate respective entries and ultimately tighten the scope.

@evelikov evelikov deleted the sysusers branch March 5, 2022 10:12
@kira-bruneau
Copy link
Contributor

kira-bruneau commented Jul 23, 2022

On NixOS, system configuration is usually handled separately from packaging, and the package fails to build with this change: NixOS/nixpkgs#182511.

PermissionError: [Errno 13] Permission denied: '/nix/store/fi2ksazpsqkvspqf36ivlp5ghpxbfm9i-systemd-250.4/lib/sysusers.d'
FAILED: meson-install
/nix/store/1dbfsvzd4i8kdc3yb081gpfddlb80858-meson-0.61.2/bin/meson install --no-rebuild
ninja: build stopped: subcommand failed.
  1. Should a flag be added to meson_options.txt to make this optional?
  2. Don't the polkit policies already let you run cpugovctl & gpuclockctl as a non-root user? Where is this group used, and how does it differ than what can be specified for with-pam-group?

@evelikov
Copy link
Author

evelikov commented Jul 27, 2022

AFAICT the file must be installed in pkgconfig_systemd.get_pkgconfig_variable('sysusersdir') in order for systemd to pick it up.

I don't know much about the working of NixOS, but it does sound alarming to *NOT use the default config provided by upstream. Nevertheless - feel free to add a meson toggle to disable it. There's systemd-user-unit-dir in there already.

@kira-bruneau
Copy link
Contributor

kira-bruneau commented Jul 27, 2022

Nix in general supports shipping default configs provided from upstream, as long as the package installs to the $out directory specified in the build (eg. $out/share/systemd/user/gamemoded.service). Whether or not those files are actually used though depends on how the system modules are set up in NixOS.

The problem here is that pkgconfig_systemd.get_pkgconfig_variable('sysusersdir') returns a path that doesn't actually exist and isn't in $out (/nix/store/fi2ksazpsqkvspqf36ivlp5ghpxbfm9i-systemd-250.4/lib/sysusers.d, the parent lib directory does exist), and there's no way to configure this, which is why the build fails.

I think this is because the Nix build of systemd uses -Dsysusers=false: https://github.com/NixOS/nixpkgs/blob/22.05/pkgs/os-specific/linux/systemd/default.nix#L453

@evelikov-work
Copy link
Contributor

evelikov-work commented Jul 27, 2022

Yes that was fairly obvious by the Permission denied message itself. What I'm saying is that, systemd modules (like sysusers but not limited to) will look into the folder specified in systemd.pc.

If the files are *not installed in that location, then the module will not work as expected.

It sounds to me that if a feature (again sysusers or otherwise) is disabled, then the respective path should either be a) unset in the systemd.pc or b) pointing to special location that will not cause issues.

Either way, as mentioned originally feel free to add meson toggle if that makes sense for NixOS.

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

Successfully merging this pull request may close these issues.

5 participants