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

Gamemode 1.8.1 can't set CPU governor and GPU Optimisation #452

Open
bg2908 opened this issue Dec 21, 2023 · 48 comments
Open

Gamemode 1.8.1 can't set CPU governor and GPU Optimisation #452

bg2908 opened this issue Dec 21, 2023 · 48 comments

Comments

@bg2908
Copy link

bg2908 commented Dec 21, 2023

Describe the bug
Update gamemode to 1.8.1 and get this when install

warning: directory permissions differ on /usr/share/polkit-1/rules.d/
filesystem: 750  package: 755

Run gamemoded -t and it would fail with this message

:: Feature tests
::: Verifying CPU governor setting
ERROR: Governor was not set to performance (was actually schedutil)!
::: Failed!
::: Verifying Scripts
::: Passed (no scripts configured to run)
::: Verifying GPU Optimisations
ERROR: Current AMD GPU performance level during gamemode does not match requested value!
	expected:high was:auto
::: Failed!

To Reproduce
Steps used to reproduce the behavior:

  1. Update gamemod to 1.8.1
  2. Run gamemoded -t
  3. Tests Failed!

Expected behavior
: All Tests Passed! after running gamemoded -t

System Info (please complete the following information):

  • OS and version: ArchLabs - 6.6.8-2-cachyos
  • GameMode Version 1.8.1

Additional context
Downgrade to GameMode version 1.7 and it work again.

@dtheil
Copy link

dtheil commented Dec 21, 2023

Same issue as above:
updated to 1.8.1 and got the message:

warning: directory permissions differ on /usr/share/polkit-1/rules.d/
filesystem: 750  package: 755

ran the command gamemoded -t and it returns the following message:

: Loading config
: Running tests

:: Basic client tests
:: Passed

:: Dual client tests
gamemode request succeeded and is active
Quitting by request...
:: Passed

:: Gamemoderun and reaper thread tests
...Waiting for child to quit...
...Waiting for reaper thread (reaper_frequency set to 5 seconds)...
:: Passed

:: Supervisor tests
:: Passed

:: Feature tests
::: Verifying CPU governor setting
ERROR: Governor was not set to performance (was actually powersave)!
::: Failed!
::: Verifying Scripts
::: Passed (no scripts configured to run)
::: Verifying GPU Optimisations
::: Passed (gpu optimisations not configured to run)
::: Verifying renice
::: Passed (no renice configured)
::: Verifying ioprio
::: Passed
ERROR: :: Failed!
: Tests Failed!

System info

  • OS and version: Archlinux - 6.6.7-arch1-1
  • GameMode Version 1.8.1

Additional context
Downgrading back to 1.7 fixed GameMode for me as well

@Saroumane
Copy link

I reproduce the problem, also using Archlinux - 6-6-7-arch1-1 and gamemode 1.8.1
In case someone is interested, it is possible to downgrade to previous working version with :
$ sudo pacman -U file:///var/cache/pacman/pkg/gamemode-1.7-1-x86_64.pkg.tar.zst

@bg2908
Copy link
Author

bg2908 commented Dec 22, 2023

From the new gamemode.ini file

; GameMode can renice game processes. You can put any value between 0 and 20 here, the value
; will be negated and applied as a nice value (0 means no change). Defaults to 0.
; To use this feature, the user must be added to the gamemode group (and then rebooted):
; sudo usermod -aG gamemode $(whoami)
renice=0

So I ran the command and added my username to the group gamemode, and now gamemode 1.8.1 work normally. I did not intend to use the renice function though.

@Kagukara
Copy link

Kagukara commented Dec 22, 2023

Just ran into this "issue" and adding myself to the gamemode group and restarted PC fixed the "problem". Is adding the user to the gamemode group now indented for gamemode to work?

@SaschaVasarrhelyi
Copy link

In my case that worked not for me. Gamemode can´t change the Governor. I added me to the group gamemode but no success.

@bg2908
Copy link
Author

bg2908 commented Dec 23, 2023

I added me to the group gamemode but no success.

Did you rebooted the machine?
From the gamemod.ini

To use this feature, the user must be added to the gamemode group (and then rebooted):

@SaschaVasarrhelyi
Copy link

Yes. I added me user to the gamemode group with "sudo usermod -aG gamemode sascha" in the terminal , reboot and do install again gamemode-1.8.1 because there was no effect by test gamemode with gamemoded -t in the console.
The CPU Governor can't change from gamemode-1.8.1 but the rest of the test are successfully as it was before.

@lxmint
Copy link

lxmint commented Dec 24, 2023

It worked for me without reboot after killing gamemoded process and adding my user to the gamemode group with vi.

@devz3r0
Copy link

devz3r0 commented Dec 25, 2023

I had the same issue, adding the user to the group fixed it, I even did not need to do a reboot.
So it is now not only for the renice process, now it counts for the governor too.
Why is this behavior change happening out of sudden?

@Tuskiurhil
Copy link

From the new gamemode.ini file

; GameMode can renice game processes. You can put any value between 0 and 20 here, the value
; will be negated and applied as a nice value (0 means no change). Defaults to 0.
; To use this feature, the user must be added to the gamemode group (and then rebooted):
; sudo usermod -aG gamemode $(whoami)
renice=0

So I ran the command and added my username to the group gamemode, and now gamemode 1.8.1 work normally. I did not intend to use the renice function though.

stumbled upon the same issue today and adding myself to the gamemode group fixed it for me.

@frugaltech
Copy link

I have been looking into this issue as well. I see a change in data/com.feralinteractive.GameMode.policy.in from version 1.7.0 to version 1.8.1. If I use the file from version 1.7.0, everything works. I am no Policykit expert, but to me, it looks like the new version of the policy does not actually allow anything. In any case, tweaking this file seems to work.

@CargaisonTuba
Copy link

Hello, I have the same line "ERROR: Governor was not set to performance (was actually powersave)!"
However I'm new to linux and I don't know how to add a user to a group (I don't even know how it's related to the problem)
Also despite following the instructions for Ubuntu (I run Kubuntu) I don't why gamemode is installed in /home, and now the commands provided to uninstall it doesn't work
ninja: Entering directory builddir'
ninja: fatal: chdir to 'builddir' - No such file or directory
`
If someone has the time to answer me, thanks

@SaschaVasarrhelyi
Copy link

Hi,
try to open a Terminal (Strg + Alt + t) and type into it

cd /home/$USER/gamemode

then make the uninstall steps again, also

systemctl --user stop gamemoded.service
ninja uninstall -C builddir

It shuld now find the Builddir to uninstall it.
Greetings

@jhpgcj
Copy link

jhpgcj commented Jan 10, 2024

Can confirm this very issue also happens to me. I'm using gamemode 1.8.1 (happened on 1.8 too, not on 1.7), Pop OS! 22.04 (kernel 6.6.6), already tried adding my user to gamemode group and restarting. Issue still remains.

@marcj303
Copy link

I don't get any directory permissions issue, but I do get the ERROR: Governor was not set to performance (was actually schedutil)!
I ran built and installed with bootstrap.sh, added myself to the gamemode group, and rebooted. No errors were reported until I ran gamemoded -t.

$ gamemoded -t
: Loading config
Loading config file [/usr/share/gamemode/gamemode.ini]
: Running tests

:: Basic client tests
:: Passed

:: Dual client tests
gamemode request succeeded and is active
Quitting by request...
:: Passed

:: Gamemoderun and reaper thread tests
...Waiting for child to quit...
...Waiting for reaper thread (reaper_frequency set to 5 seconds)...
:: Passed

:: Supervisor tests
:: Passed

:: Feature tests
::: Verifying CPU governor setting
ERROR: Governor was not set to performance (was actually powersave)!
::: Failed!
::: Verifying Scripts
::: Passed (no scripts configured to run)
::: Verifying GPU Optimisations
::: Passed (gpu optimisations not configured to run)
::: Verifying renice
::: Passed (no renice configured)
::: Verifying ioprio
::: Passed
ERROR: :: Failed!
: Tests Failed!

I built:

8cea4c2 (HEAD -> master, origin/master, origin/HEAD) Fix hybrid CPU core pinning
4a82094 Fix build with musl
5180d89 (tag: 1.8.1) Update version to 1.8.1
$ id
uid=1000(marc) gid=1000(marc) groups=1000(marc),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),133(lxd),134(sambashare),998(gamemode)
$ uname -a
Linux samus2 6.5.0-14-generic #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

@tim-rex
Copy link

tim-rex commented Jan 16, 2024

Added myself to gamemode group

sudo gpasswd -a $USER gamemode

This appears to have resolved the immediate issue for me. gamemoded -t now succeeds and no further instances of privilege errorsin the system journal when activating/deactivating gamemode from code.

Arch Linux with gamemode v1.8.1

I do still see the following, not sure what that's about at present

ERROR: Could not inspect tasks for client [19204]! Skipping ioprio optimisation.

@hir0xygen
Copy link

hir0xygen commented Jan 17, 2024

Can reproduce, adding oneself to the gamemode group (creating it beforehand if it does not exist) fixes the issue at hand.

Edit: Tested on latest Debian stable 12.4 with GNOME

@jhpgcj
Copy link

jhpgcj commented Jan 17, 2024

Can reproduce, adding oneself to the gamemode group (creating it beforehand if it does not exist) fixes the issue at hand.

Added my user to the group (it already existed) and the issue remains.

@SaschaVasarrhelyi
Copy link

It dosen't fix for me too. The Group:gamemode exists and i am in the group gamemode. That dosn't fix the problem on Ubuntu Mate 22.04 LTS with Kernel: Kernel Linux 6.5.0-14-generic x86_64 and Mate: MATE 1.26.0
It must be an other reason why gamemode-1.8.1 have no rights to change the CPU- Governor on Ubuntu x.xy

@Iron-Squid
Copy link

Iron-Squid commented Jan 18, 2024

This occurs for me as well, on Arch Linux. Adding myself to the gamemode group using usermod clears the issue of not being able to pass a test.
https://wiki.archlinux.org/title/Gamemode#Installation

Though, the polkit issue still remains regardless of this quick fix to get gamemode working.

@Iron-Squid
Copy link

The polkit issue seems to be resolved by changing the permission of /usr/share/polkit-1/rules.d from 750 to 755.
https://bbs.archlinux.org/viewtopic.php?pid=2144554#p2144554

This fix is specific to Arch Linux. I'm unsure if it'll work for any other distros.

@SaschaVasarrhelyi
Copy link

What Polkit Rules Files and rights are in Your Directory?
Can You Put the Terminaloutput from "ls -l /usr/share/polkit-1/rules.d/" ?
In my case it is:
-rw-r--r-- 1 root root 515 Feb 10 2022 blueman.rules
-rw-r--r-- 1 root root 263 Mär 17 2021 geoclue-2.0.rules
-rw-r--r-- 1 root root 368 Feb 7 2022 org.freedesktop.bolt.rules
-rw-r--r-- 1 root root 768 Mär 16 2023 org.freedesktop.Flatpak.rules
-rw-r--r-- 1 root root 251 Mai 17 2023 org.freedesktop.fwupd.rules
-rw-r--r-- 1 root root 261 Jun 9 2022 org.freedesktop.NetworkManager.rules
-rw-r--r-- 1 root root 334 Mär 14 2022 org.freedesktop.packagekit.rules
-rw-r--r-- 1 root root 594 Jun 3 2022 org.gtk.vfs.file-operations.rules
-rw-r--r-- 1 root root 527 Mär 11 2022 systemd-networkd.rules

@SaschaVasarrhelyi
Copy link

I am reinstall the 1.8.1 Version of Gamemode again and take the Terminaloutput here:

:~/gamemode$ ./bootstrap.sh

  • meson setup builddir --prefix=/usr --buildtype debugoptimized -Dwith-systemd-user-unit-dir=/etc/systemd/user
    The Meson build system
    Version: 1.3.1
    Source dir: /home/sascha/gamemode
    Build dir: /home/sascha/gamemode/builddir
    Build type: native build
    Project name: gamemode
    Project version: 1.8.1
    C compiler for the host machine: cc (gcc 11.4.0 "cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
    C linker for the host machine: cc ld.bfd 2.38
    Host machine cpu family: x86_64
    Host machine cpu: x86_64
    Compiler for C supports arguments -Waggregate-return: YES
    Compiler for C supports arguments -Wunused: YES
    Compiler for C supports arguments -Warray-bounds: YES
    Compiler for C supports arguments -Wcast-align: YES
    Compiler for C supports arguments -Wclobbered: YES
    Compiler for C supports arguments -Wempty-body: YES
    Compiler for C supports arguments -Wformat=2: YES
    Compiler for C supports arguments -Wformat-nonliteral: YES
    Compiler for C supports arguments -Wformat-signedness: YES
    Compiler for C supports arguments -Wignored-qualifiers: YES
    Compiler for C supports arguments -Wimplicit-function-declaration: YES
    Compiler for C supports arguments -Winit-self: YES
    Compiler for C supports arguments -Wmissing-format-attribute: YES
    Compiler for C supports arguments -Wmissing-include-dirs: YES
    Compiler for C supports arguments -Wmissing-noreturn: YES
    Compiler for C supports arguments -Wmissing-parameter-type: YES
    Compiler for C supports arguments -Wnested-externs: YES
    Compiler for C supports arguments -Wno-discarded-qualifiers: YES
    Compiler for C supports arguments -Wno-missing-field-initializers: YES
    Compiler for C supports arguments -Wno-suggest-attribute=format: YES
    Compiler for C supports arguments -Wno-unused-parameter: YES
    Compiler for C supports arguments -Wold-style-definition: YES
    Compiler for C supports arguments -Woverride-init: YES
    Compiler for C supports arguments -Wpointer-arith: YES
    Compiler for C supports arguments -Wredundant-decls: YES
    Compiler for C supports arguments -Wreturn-type: YES
    Compiler for C supports arguments -Wshadow: YES
    Compiler for C supports arguments -Wsign-compare: YES
    Compiler for C supports arguments -Wstrict-aliasing=3: YES
    Compiler for C supports arguments -Wstrict-prototypes: YES
    Compiler for C supports arguments -Wstringop-overflow: YES
    Compiler for C supports arguments -Wstringop-truncation: YES
    Compiler for C supports arguments -Wtype-limits: YES
    Compiler for C supports arguments -Wundef: YES
    Compiler for C supports arguments -Wuninitialized: YES
    Compiler for C supports arguments -Wunused-but-set-variable: YES
    Compiler for C supports arguments -Wwrite-strings: YES
    Found pkg-config: YES (/usr/bin/pkg-config) 0.29.2
    Run-time dependency libsystemd found: YES 249
    Run-time dependency dbus-1 found: YES 1.12.20
    Run-time dependency threads found: YES
    Library dl found: YES
    Message: Asking pkg-config for systemd's 'sysusersdir' directory
    Run-time dependency systemd found: YES 249
    Checking for function "pidfd_open" : NO
    Configuring build-config.h using configuration
    Run-time dependency inih found: YES undefined
    Configuring gamemoded.service using configuration
    Configuring gamemode.conf using configuration
    Configuring 10-gamemode.conf using configuration
    Configuring com.feralinteractive.GameMode.service using configuration
    Configuring com.feralinteractive.GameMode.policy using configuration
    Configuring gamemode.rules using configuration
    Configuring gamemoderun.1 using configuration
    Configuring gamemoded.8 using configuration
    Configuring gamemodelist.1 using configuration
    Configuring gamemode-simulate-game.1 using configuration
    Program appstreamcli found: YES (/usr/bin/appstreamcli)
    Message:

    Build configuration:

    prefix: /usr
    bindir: /usr/bin
    datadir: /usr/share
    libdir: /usr/lib/x86_64-linux-gnu
    libexecdir: /usr/libexec
    includedir: /usr/include
    PAM limits.d directory: /etc/security/limits.d
    systemd user unit directory: /etc/systemd/user
    systemd group directory: /usr/lib/sysusers.d
    D-BUS service directory: /usr/share/dbus-1/services
    PolKit Action Directory: /usr/share/polkit-1/actions

    Options:

    sd-bus provier: systemd
    examples: true
    util: true

Build targets in project: 10

gamemode 1.8.1

User defined options
buildtype : debugoptimized
prefix : /usr
with-systemd-user-unit-dir: /etc/systemd/user

Found ninja-1.10.1 at /usr/bin/ninja

  • ninja -C builddir
    ninja: Entering directory `builddir'
    [37/37] Linking target daemon/gamemoded
  • set +x
    Install to /usr? [y/N] y
  • sudo ninja install -C builddir
    ninja: Entering directory `builddir'
    [0/1] Installing files.
    Installing lib/libgamemode.so.0.0.0 to /usr/lib/x86_64-linux-gnu
    Installing lib/libgamemodeauto.so.0.0.0 to /usr/lib/x86_64-linux-gnu
    Installing util/cpugovctl to /usr/libexec
    Installing util/gpuclockctl to /usr/libexec
    Installing util/cpucorectl to /usr/libexec
    Installing util/procsysctl to /usr/libexec
    Installing daemon/gamemoded to /usr/bin
    Installing example/gamemode-simulate-game to /usr/bin
    Installing /home/sascha/gamemode/lib/gamemode_client.h to /usr/include
    Installing /home/sascha/gamemode/builddir/data/gamemoderun.1 to /usr/share/man/man1
    Installing /home/sascha/gamemode/builddir/data/gamemoded.8 to /usr/share/man/man8
    Installing /home/sascha/gamemode/builddir/data/gamemodelist.1 to /usr/share/man/man1
    Installing /home/sascha/gamemode/builddir/data/gamemode-simulate-game.1 to /usr/share/man/man1
    Installing /home/sascha/gamemode/builddir/meson-private/gamemode.pc to /usr/lib/x86_64-linux-gnu/pkgconfig
    Installing /home/sascha/gamemode/builddir/meson-private/libgamemodeauto.pc to /usr/lib/x86_64-linux-gnu/pkgconfig
    Installing /home/sascha/gamemode/builddir/data/gamemoded.service to /etc/systemd/user
    Installing /home/sascha/gamemode/builddir/data/gamemode.conf to /usr/lib/sysusers.d
    Installing /home/sascha/gamemode/builddir/data/10-gamemode.conf to /etc/security/limits.d
    Installing /home/sascha/gamemode/builddir/data/com.feralinteractive.GameMode.service to /usr/share/dbus-1/services
    Installing /home/sascha/gamemode/builddir/data/com.feralinteractive.GameMode.policy to /usr/share/polkit-1/actions
    Installing /home/sascha/gamemode/builddir/data/gamemode.rules to /usr/share/polkit-1/rules.d
    Installing /home/sascha/gamemode/data/gamemoderun to /usr/bin
    Installing /home/sascha/gamemode/data/gamemodelist to /usr/bin
    Installing /home/sascha/gamemode/data/io.github.feralinteractive.gamemode.metainfo.xml to /usr/share/metainfo
    Installing /home/sascha/gamemode/example/gamemode.ini to /usr/share/gamemode
    Installing symlink pointing to libgamemode.so.0.0.0 to /usr/lib/x86_64-linux-gnu/libgamemode.so.0
    Installing symlink pointing to libgamemode.so.0 to /usr/lib/x86_64-linux-gnu/libgamemode.so
    Installing symlink pointing to libgamemodeauto.so.0.0.0 to /usr/lib/x86_64-linux-gnu/libgamemodeauto.so.0
    Installing symlink pointing to libgamemodeauto.so.0 to /usr/lib/x86_64-linux-gnu/libgamemodeauto.so
  • '[' '' '!=' true ']'
  • systemctl list-unit-files
  • grep -q polkit.service
    Failed to list unit files: Die Wartezeit für die Verbindung ist abgelaufen
  • systemctl --user daemon-reload

@mikeyjoel
Copy link

Confirming that adding to group works on opensuse tumbleweed as well.

sudo zypper install -y gamemode gamemode gamemode libgamemodeauto0;
sudo usermod -a -G gamemode $(whoami)
systemctl --user enable --now gamemoded.service;

Then proceed with testing and using on your launcher/games.
gamemoded -t;

@SaschaVasarrhelyi
Copy link

On Ubuntu-Mate 22.04LTS that dosn't work. I'am in the group gamemode but it's not work.
It is not able to change the governor and the test with gamemode -t failed.

@marcj303
Copy link

marcj303 commented Feb 3, 2024

For those that are still having issues even after adding yourself to the gamemode group (and rebooting)...

My setup: Ubuntu 22.04 with the 6.5 kernel (HWE). AMD 5600G CPU.

TLDR:sudo apt install linux-tools-6.5.0-15-generic

I decided to check alternative utilities that would let me set the governor and what my issue might be with gamemode. I had updated to the newer 6.5 kernel for the new performance features for AMD recently. In looking at governor documentation I learned that the 6.5 kernel supports the new AMD p-state driver: https://docs.kernel.org/admin-guide/pm/amd-pstate.html

I tried running the cpupower utility, but hit a warning:

WARNING: cpupower not found for kernel 6.5.0-15-generic

You may need to install the following packages for this specific kernel:
linux-tools-6.5.0-15-generic
linux-cloud-tools-6.5.0-15-generic

You may also want to install one of the following packages to keep up to date:
linux-tools-generic
linux-cloud-tools-generic

I checked and linux-tools-generic points to the 5.15 kernel version, so we need to install the 6.5 version.

linux-tools-generic is already the newest version (5.15.0.92.89)

sudo apt install linux-tools-6.5.0-15-generic
sudo apt install cpupower

Then I'm able to set the governor with cpupower.

sudo cpupower frequency-info
sudo cpupower frequency-set
sudo cpupower frequency-set -g performance
sudo cpupower frequency-set -g powersave

After linux-tools-6.5.0-15-generic was installed, I was able to run gamemoded -t successfully.

Maybe someone else knows what is in the linux-tools that is required for gamemoderun. And maybe gamemoded could give a warning if it isn't installed.

https://ubuntu.pkgs.org/22.04/ubuntu-updates-main-amd64/linux-tools-6.5.0-15-generic_6.5.0-15.15~22.04.1_amd64.deb.html

This package provides the architecture dependant parts for kernel
version locked tools (such as perf and x86_energy_perf_policy) for
version 6.5.0-15 on
64 bit x86.

@SaschaVasarrhelyi
Copy link

I test it, but it's failed again.
I install linux-tools everytime i get an new kernel because of using cpupower to set my cpu to powersave on startup but i have give it another try and uninstall gamemode 1.7 and install gamemode 1.8.1 again.
Have you removed gamemode 1.7 as root? Otherwise ninja can not delete the files from the old version.
If you try "gamemoded -v" the version of the gamemode in use you can see in the terminal.
I'am interrested what version you have test.

@CargaisonTuba
Copy link

Hi as a linux noob I just didn't see it was available as a package for Ubuntu.
So I installed it using apt install gamemode and it works well now.
Sorry for disturbing you and thanks for your work.

@SaschaVasarrhelyi
Copy link

Hi, the Ubuntu Packages are very outdated if you use the LTS. The Git- Release are the newest versions of this Application and have to compile by yourself if you want to use the newest App- Version of Gamemode.
If you don't want the newest Version with new Feature youre right to use the Ubuntu Package to install with Synaptic ore an other Package- manager.
The Problem is the version 1.8.1 (Newest Release at the Moment) that not run at Ubuntu as it should.

@thican
Copy link

thican commented Feb 24, 2024

@SaschaVasarrhelyi

It dosen't fix for me too. The Group:gamemode exists and i am in the group gamemode. That dosn't fix the problem on Ubuntu Mate 22.04 LTS with Kernel: Kernel Linux 6.5.0-14-generic x86_64 and Mate: MATE 1.26.0 It must be an other reason why gamemode-1.8.1 have no rights to change the CPU- Governor on Ubuntu x.xy

It also happened to me, until I noticed the directory /sys/devices/system/cpu/cpufreq on my system was empty, and therefore no cpufreq symlinks under each /sys/devices/system/cpu/cpuX repertories; those messages when running gamemoded --test were the tell:

ERROR: glob failed for cpu governors: (No such file or directory)
ERROR: glob failed for cpu governors: (No such file or directory)
ERROR: Governor was not set to performance (was actually )!

Notice how in the last message, the content after "was actually" is empty string.

In fact the former directory was empty because my kernel (configured by myself) was lacking the correct P-State option for my CPU.
So enable CONFIG_X86_INTEL_PSTATE or CONFIG_X86_AMD_PSTATE (or both) according to your CPU vendor (or try using the expected kernel binary from your distribution).

@ralmachado
Copy link

Same problem on Pop_OS! 22.04, with the 6.6.10-76060610-generic kernel.

The gamemode group did not exist, so I created it as a regular user group and added myself to the group - did not work. I then tried creating the group as a system group (gid < 1000) - did not work.

Also tried @marcj303's answer by installing the kernel appropriate linux-tools package - also did not work.

Ultimately, polkit seems to be denying the execution of any gamemode tools, as @SaschaVasarrhelyi commented in #411 (comment).
The gamemode.rules file is in /usr/share/polkit-1/rules.d/, with file permissions matching other files in the directory (644).

journalctl output:

Mar 08 12:49:15 sieger pkexec[6902]: rodrigo: Error executing command as another user: Not authorized [USER=root] [TTY=unknown] [CWD=/home/rodrigo] [COMMAND=/usr/libexec/cpugovctl set performance]
Mar 08 12:49:15 sieger gamemoded[2610]: Requesting update of governor policy to perfo
Mar 08 12:49:15 sieger gamemoded[6902]: Error executing command as another user: Not authorized
Mar 08 12:49:15 sieger gamemoded[6902]: This incident has been reported.
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: External process failed with exit code 127
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: Output was:
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: Failed to update cpu governor policy
Mar 08 12:49:15 sieger pkexec[6905]: rodrigo: Error executing command as another user: Not authorized [USER=root] [TTY=unknown] [CWD=/home/rodrigo] [COMMAND=/usr/libexec/procsysctl split_lock_mitigate 0]
Mar 08 12:49:15 sieger gamemoded[6905]: Error executing command as another user: Not authorized
Mar 08 12:49:15 sieger gamemoded[6905]: This incident has been reported.
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: External process failed with exit code 127
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: Output was:
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: Failed to update split_lock_mitigate
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: Skipping ioprio on client [6858,6858]: ioprio was (0) but we expected (4)
Mar 08 12:49:15 sieger pkexec[6908]: rodrigo: Error executing command as another user: Not authorized [USER=root] [TTY=unknown] [CWD=/home/rodrigo] [COMMAND=/usr/libexec/procsysctl split_lock_mitigate 1]
Mar 08 12:49:15 sieger gamemoded[6908]: Error executing command as another user: Not authorized
Mar 08 12:49:15 sieger gamemoded[6908]: This incident has been reported.
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: External process failed with exit code 127
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: Output was:
Mar 08 12:49:15 sieger gamemoded[2610]: ERROR: Failed to update split_lock_mitigate

id output:

uid=1000(rodrigo) gid=1000(rodrigo) groups=1000(rodrigo),4(adm),27(sudo),46(plugdev),124(lpadmin),137(sambashare),138(gamemode),999(docker)

Sleuthing on StackExchange, it was said that JavaScript style .rules do not work on polkit < 0.106 (pkaction --version reports 0.105), which is odd because there are multiple other rules files in /usr/share/polkit-1/rules.d/, including ones from flatpak and systemd. So I then tried to create a pkla file mimicking gamemode.rules, /etc/polkit-1/localauthority/50-local.d/99-gamemode.pkla shown below, but that also did not work.

[Enable gamemode requests]
Identity=unix-user:gamemode
Action=com.feralinteractive.GameMode.governor-helper;com.feralinteractive.GameMode.gpu-helper;com.feralinteractive.GameMode.cpu-helper;com.feralinteractive.GameMode.procsys-helper
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Could it really be that polkit < 0.106 won't allow gamemode versions above 1.7 to work at all?

@JustCauseWhyNot
Copy link

I'm using gentoo, and gamemode renice isn't working even if after adding my user to the gamemode group.

@ralmachado
Copy link

Tested on EndeavourOS (polkit 124) and Ubuntu 23.10 (polkit 123) - both worked and passed all tests, which makes me think polkit might be the culprit here.

To really ensure that issue lies with polkit, it would have to be upgraded from source on Ubuntu 22.04, keeping as many other packages intact, but I'm not too keen on doing that on the only machine I have and possibly breaking something :/

Screenshot_20240309_125753
Screenshot from 2024-03-09 13-30-24

@ralmachado
Copy link

I got it to work, the solution is to create the following .pkla in /etc/polkit-1/localauthority/50-local.d:

[Enable gamemode requests]
Identity=unix-group:gamemode
Action=com.feralinteractive.GameMode.governor-helper;com.feralinteractive.GameMode.gpu-helper;com.feralinteractive.GameMode.cpu-helper;com.feralinteractive.GameMode.procsys-helper
ResultAny=yes
ResultInactive=yes
ResultActive=yes

Basically, it's the same as the gamemode.rules file but in the older format accepted by the outdated polkit in Ubuntu 22.04.

image

@JustCauseWhyNot
Copy link

I've tried what you pasted, and it still doesn't work for me.

id
uid=1000(justcausewhynot) gid=1000(justcausewhynot) groups=1000(justcausewhynot),10(wheel),18(audio),27(video),85(usb),97(input),100(users),250(portage),272(plugdev),385(gamemode)

gamemode version: v1.8.1 pkaction version 124

@ralmachado
Copy link

I've tried what you pasted, and it still doesn't work for me.
id

uid=1000(justcausewhynot) gid=1000(justcausewhynot) groups=1000(justcausewhynot),10(wheel),18(audio),27(video),85(usb),97(input),100(users),250(portage),272(plugdev),385(gamemode)

gamemode version: v1.8.1 pkaction version 124

My solution was intended only for outdated polkit versions (used in Ubuntu LTS), which doesn't support the shipped polkit rules file.

I tried a clean build in an arch based distro with polkit 124 and it worked. Check journalctl output after a gamemoded -t to see if the issue is in fact polkit :)

@JustCauseWhyNot
Copy link

JustCauseWhyNot commented Mar 9, 2024

Here's my ~/everthing/current log

Mar 09 11:59:29 [polkitd] Started polkitd version 124
Mar 09 11:59:29 [polkitd] Loading rules from directory /etc/polkit-1/rules.d
Mar 09 11:59:29 [polkitd] Loading rules from directory /usr/share/polkit-1/rules.d
Mar 09 11:59:29 [polkitd] Finished loading, compiling and executing 2 rules
Mar 09 11:59:29 [dbus-daemon] [system] Successfully activated service 'org.freedesktop.PolicyKit1'
Mar 09 11:59:29 [polkitd] Acquired the name org.freedesktop.PolicyKit1 on the system bus
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set performance]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set -1 -1 1]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set 0 0 1]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set ]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set performance]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set -1 -1 1]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set 0 0 1]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set ]
Mar 09 11:59:29 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:29 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set performance]
Mar 09 11:59:30 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:30 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set -1 -1 1]
Mar 09 11:59:34 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:34 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set 0 0 1]
Mar 09 11:59:34 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:34 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set ]
Mar 09 11:59:35 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:35 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set performance]
Mar 09 11:59:35 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:35 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set -1 -1 1]
Mar 09 11:59:35 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:35 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/gpuclockctl 0 set 0 0 1]
Mar 09 11:59:35 [pkexec] pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
Mar 09 11:59:35 [pkexec] justcausewhynot: Executing command [USER=root] [TTY=unknown] [CWD=/] [COMMAND=/usr/libexec/cpugovctl set ]

@JustCauseWhyNot
Copy link

JustCauseWhyNot commented Mar 9, 2024

I found out the issue. It's the fact that in /etc/security/limits.d/10-gamemode.conf it's set to -10 not -20. The odd thing is that despite me now changing it to -20 gamemoded renice is still failing with anything past 10. Do I need to do something to update polkit configs?

After more testing the max I can set is -19. -20 doesn't work for somereason despite setting -20 in gamemode.conf

@ralmachado
Copy link

I found out the issue. It's the fact that in /etc/security/limits.d/10-gamemode.conf it's set to -10 not -20. The odd thing is that despite me now changing it to -20 gamemoded renice is still failing with anything past 10. Do I need to do something to update polkit configs?

After more testing the max I can set is -19. -20 doesn't work for somereason despite setting -20 in gamemode.conf

This is a niceness problem, not really related to this issue, but yes, you should only let usermode processes renice to -19 for safety reasons. Root should be able to renice to -20 to kill any hung processes.

In any case, setting the limit to -19 should be enough, otherwise disable renice in gamemode config.

@SaschaVasarrhelyi
Copy link

Hi @ralmachado, you are right,
i try to make this .pkla file at the right position as you say and it's work for me with the gamemode 1.8.1.
Thank you very much

@SaschaVasarrhelyi
Copy link

:~$ gamemoded -v
gamemode version: v1.8.1

:~$ gamemoded -t
: Loading config
Loading config file [/usr/share/gamemode/gamemode.ini]
: Running tests

:: Basic client tests
:: Passed

:: Dual client tests
gamemode request succeeded and is active
Quitting by request...
:: Passed

:: Gamemoderun and reaper thread tests
...Waiting for child to quit...
...Waiting for reaper thread (reaper_frequency set to 5 seconds)...
:: Passed

:: Supervisor tests
:: Passed

:: Feature tests
::: Verifying CPU governor setting
::: Passed
::: Verifying Scripts
::: Passed (no scripts configured to run)
::: Verifying GPU Optimisations
::: Passed (gpu optimisations not configured to run)
::: Verifying renice
::: Passed (no renice configured)
::: Verifying ioprio
::: Passed
:: Passed

: All Tests Passed!

Good work

@stvoidit
Copy link

stvoidit commented Apr 5, 2024

I faced the same problem, but in slightly different conditions, as it seemed to me, however, the solution #452 (comment) It helped me.

OS: Linux Mint 21.3 x86_64
Host: 82UH Legion 7 16ARHA7
Kernel: 6.8.4-stvoid
Shell: bash 5.1.16
DE: Cinnamon 6.0.4
CPU: AMD Ryzen 9 6900HX with Radeon Graphics (16) @ 4.935GHz
GPU: AMD ATI Radeon RX 6700/6700 XT / 6800M
GPU: AMD ATI 37:00.0 Rembrandt

By default, the version from the standard Ubuntu "1.6.1-1 build2" repository was installed.

I wanted to put together a more recent version. Fortunately, everything worked out the first time, although I often have errors with the assembly of some modules and other things, because I am building an up-to-date stable kernel with clang-18, so the variables CC=clang-18 CXX=clang-18 LLVM=-18 were set in my environment (I don't know if it could does this affect a successful build, but suddenly someone will encounter).

Immediately after successful completion ./bootstrap.sh I ran the "gamemoded -t" test and got this error.

At first I tried to add myself to the gamemode group, but it didn't work because there was no such group. However, this was not a problem for version 1.6.1.

After the reboot, I added myself to the group again and this time the group already existed.
However, this did not eliminate the problem with passing the tests.
Therefore, I created the file /etc/polkit-1/localauthority/50-local.d/gamemode.pkla by logging in as root (pkaction version 0.105).
After that, I rebooted, ran the tests and they worked.


At the moment, I am observing errors in the log, more specifically, I am interested in what is said about IGPU, can I ignore it and everything is fine or does it need to be solved?

апр 05 23:47:59 space pkexec[10216]: pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
апр 05 23:47:59 space gamemoded[10185]: ERROR: Configured iGPU power threshold value '-1.000000' is invalid, ignoring iGPU default governor.
апр 05 23:47:59 space gamemoded[10185]: ERROR: Failed to open file for read /sys/class/powercap/intel-rapl/intel-rapl:0/intel-rapl:0:0/energy_uj
апр 05 23:47:59 space pkexec[10219]: pam_unix(polkit-1:session): session opened for user root(uid=0) by (uid=1000)
апр 05 23:47:59 space gamemoded[10185]: ERROR: Skipping ioprio on client [10215,10215]: ioprio was (0) but we expected (4)
апр 05 23:47:59 space gamemoded[10185]: ERROR: Skipping ioprio on client [10223,10223]: ioprio was (0) but we expected (4)
апр 05 23:47:59 space gamemoded[10185]: ERROR: Addition requested for already known client 10223 [/home/stvoid/.local/share/Steam/ubuntu12_32/steam-launch-wrapper].
апр 05 23:47:59 space gamemoded[10185]:     -- This may happen due to using exec or shell wrappers. You may want to
апр 05 23:47:59 space gamemoded[10185]:     -- blacklist this client so GameMode can see its final name here.
апр 05 23:47:59 space gamemoded[10185]: ERROR: Skipping ioprio on client [10226,10226]: ioprio was (0) but we expected (4)
gamemoded -s
> gamemode is active

@stvoidit
Copy link

stvoidit commented Apr 5, 2024

little update: grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

When using the game, I see that the value of scaling_governor changes correctly to performance, and this leads to powersave

I don't know if it's related, but I was interested in checking it out.

@nipnipj
Copy link

nipnipj commented Apr 11, 2024

Linux mint 21.3 here.

::: Verifying CPU governor setting
ERROR: Governor was not set to performance (was actually schedutil)!

This Comment worked!

@brooksvb
Copy link

brooksvb commented May 7, 2024

This is the policy that helped me:

// /etc/polkit-1/rules.d/10-gamemode.rules
polkit.addRule(function(action, subject) {
    if (action.id.match("com.feralinteractive.GameMode.governor-helper") ||
        action.id.match("com.feralinteractive.GameMode.gpu-helper") ||
        action.id.match("com.feralinteractive.GameMode.cpu-helper") ||
        action.id.match("com.feralinteractive.GameMode.procsys-helper")) {
        if (subject.isInGroup("gamemode") || subject.user === "<YOUR USERNAME>") {
            return polkit.Result.YES;
        }
    }
});

@TickDracy
Copy link

TickDracy commented May 8, 2024

I got it to work, the solution is to create the following .pkla in /etc/polkit-1/localauthority/50-local.d:

Thanks a lot. That indeed solved it for me on Pop!_OS 22.04.

Noob question: Creating that file is harmless, or it can create hypothetical issues with other apps?

@ralmachado
Copy link

Noob question: Creating that file is harmless, or it can create hypothetical issues with other apps?

In theory, no. The pkla is simply an older format for polkit rules, and the one I posted is simply the translation of gamemode polkit rules to it.
(I am in no way an expert into how polkit works, but unless the rules can be exploited by other applications this should not cause issues, security or compatibility wise)

@Samueru-sama
Copy link

Samueru-sama commented May 17, 2024

I get usermod: group 'gamemode' does not exist when trying to run usermod -aG gamemode $(whoami)

This is on artix linux.

EDIT: I was able to fix the issue by manually creating the group with groupadd -f 'gamemode' now it passes all tests.

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

No branches or pull requests