gamemode icon indicating copy to clipboard operation
gamemode copied to clipboard

Gamemode 1.8.1 can't set CPU governor and GPU Optimisation

Open bg2908 opened this issue 1 year ago • 68 comments

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.

bg2908 avatar Dec 21 '23 04:12 bg2908

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

dtheil avatar Dec 21 '23 18:12 dtheil

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

Saroumane avatar Dec 21 '23 21:12 Saroumane

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.

bg2908 avatar Dec 22 '23 08:12 bg2908

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?

Kagukara avatar Dec 22 '23 20:12 Kagukara

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

SaschaVasarrhelyi avatar Dec 23 '23 01:12 SaschaVasarrhelyi

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):

bg2908 avatar Dec 23 '23 02:12 bg2908

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.

SaschaVasarrhelyi avatar Dec 23 '23 04:12 SaschaVasarrhelyi

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

lxmint avatar Dec 24 '23 13:12 lxmint

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?

devz3r0 avatar Dec 25 '23 17:12 devz3r0

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.

Tuskiurhil avatar Dec 28 '23 00:12 Tuskiurhil

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.

frugaltech avatar Jan 01 '24 17:01 frugaltech

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

CargaisonTuba avatar Jan 06 '24 23:01 CargaisonTuba

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

SaschaVasarrhelyi avatar Jan 06 '24 23:01 SaschaVasarrhelyi

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.

ghost avatar Jan 10 '24 18:01 ghost

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

marcj303 avatar Jan 13 '24 17:01 marcj303

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.

tim-rex avatar Jan 16 '24 10:01 tim-rex

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

hir0xygen avatar Jan 17 '24 21:01 hir0xygen

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.

ghost avatar Jan 17 '24 21:01 ghost

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

SaschaVasarrhelyi avatar Jan 18 '24 15:01 SaschaVasarrhelyi

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 avatar Jan 18 '24 21:01 Iron-Squid

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.

Iron-Squid avatar Jan 18 '24 22:01 Iron-Squid

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 avatar Jan 19 '24 00:01 SaschaVasarrhelyi

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

SaschaVasarrhelyi avatar Jan 30 '24 23:01 SaschaVasarrhelyi

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;

mikeyjoel avatar Jan 31 '24 04:01 mikeyjoel

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.

SaschaVasarrhelyi avatar Jan 31 '24 12:01 SaschaVasarrhelyi

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.

marcj303 avatar Feb 03 '24 17:02 marcj303

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.

SaschaVasarrhelyi avatar Feb 03 '24 20:02 SaschaVasarrhelyi

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.

CargaisonTuba avatar Feb 13 '24 19:02 CargaisonTuba

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.

SaschaVasarrhelyi avatar Feb 13 '24 19:02 SaschaVasarrhelyi

@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).

thican avatar Feb 24 '24 23:02 thican