Latest Comments by Nevertheless
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
11 Apr 2018 at 12:18 pm UTC
11 Apr 2018 at 12:18 pm UTC
Quoting: OlliCInteresting! Thanks for the info!Quoting: NeverthelessBy using Polkit. I think it also logs something about executing pkexec. Start the daemon and follow the logs with 'journalctl -f --user-unit gamemoded'.Quoting: OlliCAnd how does it apply CPU governor changes?Quoting: NeverthelessEdit: I guess I will be using Ferals programm sooner or later anyway. I just don't like running root daemons without even having the time to read the source code.. or better, having some security experts reading the sourcecode. Don't get me wrong, I do trust Feral, but a daemon is in a delicate position, and even small flaws can be exploited.
It's not a root daemon. It runs as a normal user using systemds usermode and polkit.
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
11 Apr 2018 at 10:53 am UTC
11 Apr 2018 at 10:53 am UTC
Quoting: OlliCAnd how does it apply CPU governor changes?Quoting: NeverthelessEdit: I guess I will be using Ferals programm sooner or later anyway. I just don't like running root daemons without even having the time to read the source code.. or better, having some security experts reading the sourcecode. Don't get me wrong, I do trust Feral, but a daemon is in a delicate position, and even small flaws can be exploited.
It's not a root daemon. It runs as a normal user using systemds usermode and polkit.
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
11 Apr 2018 at 10:10 am UTC
Setuid is used in a lot of cases to elevate privileges. In mount, umount, su, sudo for example. In this case it gives me exactly what I want: I can switch the governor without having to provide a password. It does nothing more. So I don't see any risk.
11 Apr 2018 at 10:10 am UTC
Quoting: marcusOops, yes, sorry, pasted the wrong file. Strike the sudo! It doesn't hurt, but it's absolutely not needed.Quoting: NeverthelessThis is really bogus, broken code ...Quoting: mike44Good but I would prefer not to install anything. Could we simply run a command before and after playing?I found a simple suid program on the net, which I just had to change a bit to do the right things.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );
return 0;
}
and to set it back to powersave:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );
return 0;
}
The setuid command is useless since
- a) you are already root (per chmod u+s)
- b) you would not be able to elevate your privileges like that if you were not. That would be a security hole. The purpose of setuid is to drop privileges when you are already root. Not to elevate them (see man setuid).
Using sudo in the system commandline makes no sense as well. It is benign if you have a setuid root binary (i.e. does nothing, just leave it out). If you are not yet root it will ask of course but then you can really just use the commandline directly. Skip the c and use bash.
Setuid is used in a lot of cases to elevate privileges. In mount, umount, su, sudo for example. In this case it gives me exactly what I want: I can switch the governor without having to provide a password. It does nothing more. So I don't see any risk.
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
11 Apr 2018 at 6:27 am UTC Likes: 1
sudo chmod u+s binary
That works for me.
Edit: I guess I will be using Ferals programm sooner or later anyway. I just don't like running root daemons without even having the time to read the source code.. or better, having some security experts reading the sourcecode. Don't get me wrong, I do trust Feral, but a daemon is in a delicate position, and even small flaws can be exploited.
11 Apr 2018 at 6:27 am UTC Likes: 1
Quoting: ShmerlAs you said it has to be owned by root, thenQuoting: NeverthelessI found a simple suid program on the net, which I just had to change a bit to do the right things.How do you set the resulting binary? I tried making it owned by root:root and then giving it setuid flag, but it still fails when setuid is called from it.
sudo chmod u+s binary
That works for me.
Edit: I guess I will be using Ferals programm sooner or later anyway. I just don't like running root daemons without even having the time to read the source code.. or better, having some security experts reading the sourcecode. Don't get me wrong, I do trust Feral, but a daemon is in a delicate position, and even small flaws can be exploited.
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
10 Apr 2018 at 7:55 pm UTC Likes: 3
10 Apr 2018 at 7:55 pm UTC Likes: 3
Quoting: wvstolzingYes you could. But you had to provide your password before you start your game and after you quit it. You can't setuid a bash script, so a binary helps there.Quoting: Nevertheless...Couldn't you do the same with something like
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );
return 0;
}
...
sudo sh -c 'echo powersave | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'
Does it have to be compiled C code?
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
10 Apr 2018 at 6:54 pm UTC Likes: 2
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );
return 0;
}
and to set it back to powersave:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );
return 0;
}
10 Apr 2018 at 6:54 pm UTC Likes: 2
Quoting: mike44Good but I would prefer not to install anything. Could we simply run a command before and after playing?I found a simple suid program on the net, which I just had to change a bit to do the right things.
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );
return 0;
}
and to set it back to powersave:
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
setuid( 0 );
system( "echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor" );
return 0;
}
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
10 Apr 2018 at 3:55 pm UTC
10 Apr 2018 at 3:55 pm UTC
Quoting: lucifertdarkNo problem. It didn't fit the error anyway!Quoting: NeverthelessI guess I should have said I edited the output to remove my name.Quoting: lucifertdark./bootstrap.sh/home/"user"? Is that correct?
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.29.0
Source dir: /home/user/gamemode
Build dir: /home/user/gamemode/build
Build type: native build
Build machine cpu family: x86_64
Build machine cpu: x86_64
Project name: gamemode
Native c compiler: cc (gcc 5.4.0-6ubuntu1)
Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".
It refuses to compile for me, followed the instructions to the letter, scratching my head right now, any help would be appreciated.
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
10 Apr 2018 at 3:44 pm UTC
Edit.. ok forget it! :)
10 Apr 2018 at 3:44 pm UTC
Quoting: lucifertdark./bootstrap.sh/home/"user"? Is that correct?
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.29.0
Source dir: /home/user/gamemode
Build dir: /home/user/gamemode/build
Build type: native build
Build machine cpu family: x86_64
Build machine cpu: x86_64
Project name: gamemode
Native c compiler: cc (gcc 5.4.0-6ubuntu1)
Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".
It refuses to compile for me, followed the instructions to the letter, scratching my head right now, any help would be appreciated.
Edit.. ok forget it! :)
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
10 Apr 2018 at 10:44 am UTC
10 Apr 2018 at 10:44 am UTC
Quoting: mike44Good but I would prefer not to install anything. Could we simply run a command before and after playing?You could do all it does yourself in a script before and after playing. It will just need sudo to do anything.. That's what a daemon keeps away from the user.
Feral Interactive have released an open source tool that’ll help get the most performance out of Linux games
10 Apr 2018 at 10:34 am UTC Likes: 14
10 Apr 2018 at 10:34 am UTC Likes: 14
Holy cow, Linux has a game mode ;-)
- Here's the most played games on Steam Deck for January 2026
- GOG are giving away Alone in the Dark: The Trilogy to celebrate their Preservation Program
- Steam Survey for January 2026 shows a small drop for Linux and macOS
- Valheim gets a big birthday update with optimizations, Steam Deck upgrades and new content
- AMD say the Steam Machine is "on track" for an early 2026 release
- > See more over 30 days here
- Is it possible to have 2 Steam instances (different accounts) at …
- mr-victory - I need help making SWTOR work on Linux without the default Steam …
- WheatMcGrass - Browsers
- Jarmer - New Desktop Screenshot Thread
- Hamish - Will you buy the new Steam Machine?
- DoctorJunglist - See more posts
How to setup OpenMW for modern Morrowind on Linux / SteamOS and Steam Deck
How to install Hollow Knight: Silksong mods on Linux, SteamOS and Steam Deck