I'm trying to set my swappiness to a more reasonable value than 60, but I get errors:

root@server1:~# sysctl vm.swappiness=10
sysctl: permission denied on key 'vm.swappiness'
root@server1:~# swapoff -a
swapoff: Not superuser.
root@server1:~# sudo swapoff -a
swapoff: Not superuser.
root@server1:~# echo 10 > /proc/sys/vm/swappiness
bash: /proc/sys/vm/swappiness: Permission denied

What's going on here??

Ubuntu 14.04 Server

  • Is this on a VPS perhaps? OpenVZ? Cuz you are in a "jail" if so and you can not change those parameters. – Rinzwind Mar 11 '16 at 19:48
  • This is on a VPS. I'm not familiar with OpenVZ, what is that? A virtualization mechanism? – Daniel Mar 11 '16 at 21:24

What you want it not possible. Your Virtual private server (VPS) does not allow this (OpenVZ (probably the most popular?), Solaris Containers and LXC are 3 examples of such systems).

Basically there is one server that is divided up into containers of which you use one. Changing swappiness would change it for all containers so you are not allowed to change it. It is set by the provider.

On a side note: changing swappiness on a VPS is not going to solve any problem you believe to have. On a VPS like OpenVZ swap is the same as RAM (and I expect it to be the same on any VPS). So your problem is solved by adding RAM.

  • 1
    Really? The swapfile is in a ramdisk? weird... Well then I no longer have concerns about swap usage. – Daniel Mar 11 '16 at 21:51
  • well I am not claiming -yours- is ;-) But I would assume it is the same with all of these systems (they make money by you paying for the same RAM they can sell to 9 others hoping you 9 can share it without noticing it slowing down). – Rinzwind Mar 11 '16 at 21:53
  • Aha. Well I'm not running out of RAM, I've got a few gig free out of 6, but I'm seeing 400M swap in use. – Daniel Mar 11 '16 at 21:55
  • That could be them not giving you full access to the RAM you expect you have ;-) – Rinzwind Mar 11 '16 at 21:59
  • Oh I can hit 6GB RAM usage if I need it. That's not an issue. And if swap is in a ramdisk then it's a moot point. – Daniel Mar 11 '16 at 22:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.