Open CobaltCause opened 3 years ago
the systemd-sysctl already has a restartTrigger for /etc/sysctl.d/60-nixos.conf
systemd.services.systemd-sysctl =
{ wantedBy = [ "multi-user.target" ];
restartTriggers = [ config.environment.etc."sysctl.d/60-nixos.conf".source ];
};
for me the service gets restarted (monitored with journalctl -xe -f --unit=systemd-sysctl
) when i change the value of "vm.swappiness" = 101;
Hmm okay, trying this shows that it does actually work on my machine, but only after manually nixos-rebuild switch
ing; it still won't apply automatically at boot. Your monitoring command shed some light on the source of the problem, it emitted
systemd-sysctl[736]: Couldn't write '0' to 'dev/i915/perf_stream_paranoid', ignoring: No such file or directory
while booting. But, I'm still not sure exactly how to resolve that
what files are in /proc/sys/dev/i915/
┌─[~]
└─[charles@worky]$ exa -T /proc/sys/dev/i915
/proc/sys/dev/i915
├── oa_max_sample_rate
└── perf_stream_paranoid
does doing sudo sysctl -w dev.i915.perf_stream_paranoid=0
manually work
repeat 10000 { cat /proc/sys/dev/i915/ }
run this in zsh and rebuild and then check the output to check if the file disappears at some point
sadly inotifywait does not work on /proc files therefore we cant use this command
$(nix-build '<nixos>' -A inotify-tools)/bin/inotifywait -m /proc/sys/vm/swappiness
looks like this is a issue on other distros too https://forum.manjaro.org/t/cant-change-dev-i915-perf-stream-paranoid-to-0/66339
the command run by the systemd service can be run manually by doing
$(nix-build '<nixos>' -A systemd)/lib/systemd/systemd-sysctl
if this is an upstream issue and can't be fixed on our side then at least this should work
networking.localCommands = ''
${pkgs.procps}/bin/sysctl -w dev.i915.perf_stream_paranoid=0
'';
does doing
sudo sysctl -w dev.i915.perf_stream_paranoid=0
manually work
Yeah, it does
repeat 10000 { cat /proc/sys/dev/i915/ }
run this in zsh and rebuild and then check the output to check if the file disappears at some pointsadly inotifywait does not work on /proc files therefore we cant use this command
$(nix-build '<nixos>' -A inotify-tools)/bin/inotifywait -m /proc/sys/vm/swappiness
I tried the repeat
command a few times but didn't see any errors
looks like this is a issue on other distros too https://forum.manjaro.org/t/cant-change-dev-i915-perf-stream-paranoid-to-0/66339
the command run by the systemd service can be run manually by doing
$(nix-build '<nixos>' -A systemd)/lib/systemd/systemd-sysctl
Oh that's unfortunate. That command does work, though I have to run it as root. It appears to run without root but won't actually affect anything.
if this is an upstream issue and can't be fixed on our side then at least this should work
networking.localCommands = '' ${pkgs.procps}/bin/sysctl -w dev.i915.perf_stream_paranoid=0 '';
This does indeed work. Thank you!
i only know that that sysctl option has this issue so the title should include it
I marked this as stale due to inactivity. → More info
@stale This is still relevant.
Describe the bug
It appears that
boot.kernel.sysctl
don't automatically apply its configuration to the system correctly.Steps To Reproduce
Steps to reproduce the behavior:
configuration.nix
:nixos-rebuild switch
sysctl dev.i915.perf_stream_paranoid
will still report1
Expected behavior
sysctl dev.i915.perf_stream_paranoid
should report0
Additional context
Manually running
systemctl restart systemd-sysctl
after step 2 or 3 will make step 4 report the expected value.Notify maintainers
@Mic92 @flokli
Metadata
Maintainer information: