Swapiness not changing after reboot

Hello,

I try to set swapiness to 0 but it goes back to 10 after a reboot.

cat /proc/sys/vm/swappiness
10

sudo gedit /etc/sysctl.conf

With Spaces around “=”
Add:

vm.swappiness = 0

save, reboot

cat /proc/sys/vm/swappiness
10

:see_no_evil:

I tried a different path/file (sudo gedit /usr/lib/sysctl.d/swap.conf), but same issue, the swapiness value is either not set to 0 or overridden back to 10 by something else.

clr-power-tweaks is setting /proc/sys/vm/swappiness

See man clr-power-tweaks.conf for how to configure clr-power-tweaks to your liking.

1 Like

Absolutely, this does the job

sudo echo ”/proc/sys/vm/swappiness 0“ > /etc/clr-power-tweaks.conf

That is almost correct, you want to do something like this:
echo ”/proc/sys/vm/swappiness 0“ | sudo tee -a /etc/clr-power-tweaks.conf

1 Like

sry, this is news to me - is the following example (another override) correct :

echo ”/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor powersave“ | sudo tee -a /etc/clr-power-tweaks.conf

(
until schedutil & if the computer has heavy work to perform, a manual/temporary switch per:

echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
)

You’re right. I wrote the cmd as root, my bad … and I add the sudo cmd here

1 Like

Well,

appends to the file if indeed it already exists.

This would destroy then create it anew with just the one line.

Not really
sudo echo … > /path/to/file does nothing, because the sudo cmd doesn’t give privilege for the redirection > only for the echo
But you’re right, the > overwrite any existing file.

err yeah, that’s one strong echo… that too

My personal preference isn’t to use tee, but just sudo vi ... instead and edit the file in place, add a little comment if needed etc. it’s not copy-paste easy, but worth the time to see a previous version and perhaps some hints I left myself earlier.

no answer, but -

printf "/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor powersave" | sudo tee --append /etc/clr-power-tweaks.conf

works for me. &

printf '\n%s\n' "/proc/sys/vm/swappiness 5" | sudo tee --append /etc/clr-power-tweaks.conf

after that + earlyoom (now).

1 Like

Why enable powersave ?