Choose style:

Author Topic: [Solved] Changed swappiness value ignored on boot  (Read 384 times)

0 Members and 2 Guests are viewing this topic.

Offline briggers

  • nOOb
  • *
  • Posts: 3
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): 9
[Solved] Changed swappiness value ignored on boot
« on: September 23, 2018, 08:09:40 am »
Hello,
I've just installed peppermint 9 on an old acer aspire one AOA101 with 1mg of memory and want to set swappiness to 10 or lower.
I've added
vm.swappiness=10 to /etc/sysctl.conf
Then rebooted
when I issue command
cat /proc/sys/vm/swappiness
it reports
60
if issue command
cat /etc/sysctl.conf
it shows
vm.swappiness=10

So it seems to ignore the new value and continues with the default value of 60
Have I missed something?
Any help would be appreciated, thanks.
« Last Edit: September 24, 2018, 09:59:43 am by briggers »

Offline zebedeeboss

  • Global Moderator
  • Hero
  • *****
  • Posts: 2779
  • Karma: 519
  • Life first... Peppermint a close 2nd :)
    • View Profile
  • Peppermint version(s): Peppermint 9 Respin x64
Re: Changed swappiness value ignored on boot
« Reply #1 on: September 23, 2018, 10:02:14 am »
Hi briggers,

this is what I do - in a terminal copy and paste the command below

Code: [Select]
sudo bash -c "echo 'vm.swappiness = 10' >> /etc/sysctl.conf"

I am not sure in yours if no space after the swapiness and after the = make a difference - but the above always works for me

Regards Zeb...
Be Kind Whenever Possible...   It is Always Possible - Dalai Lama

Linux User #565092
P9Respin x64 Desktop - i7-6700K @ 4.00GHz - 32Gb RAM - NVIDIA GTX1070ti 8Gb - 2 x 27" 4k 3840x2160 - 1 x 34" 5120x2160
x64 Laptop - i7-7700HQ @ 2.80GHz - 8Gb RAM - Nvidia GTX1050 4Gb - 15.6" HD 1920x1080

Online PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 23544
  • Karma: 2616
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: Changed swappiness value ignored on boot
« Reply #2 on: September 23, 2018, 11:34:18 am »
Run:
Code: [Select]
sudo xed /etc/sysctl.conf
make it read:-
Code: [Select]
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
#

#kernel.domainname = example.com

# Uncomment the following to stop low-level messages on console
#kernel.printk = 3 4 1 3

##############################################################3
# Functions previously found in netbase
#

# Uncomment the next two lines to enable Spoof protection (reverse-path filter)
# Turn on Source Address Verification in all interfaces to
# prevent some spoofing attacks
#net.ipv4.conf.default.rp_filter=1
#net.ipv4.conf.all.rp_filter=1

# Uncomment the next line to enable TCP/IP SYN cookies
# See http://lwn.net/Articles/277146/
# Note: This may impact IPv6 TCP sessions too
#net.ipv4.tcp_syncookies=1

# Uncomment the next line to enable packet forwarding for IPv4
#net.ipv4.ip_forward=1

# Uncomment the next line to enable packet forwarding for IPv6
#  Enabling this option disables Stateless Address Autoconfiguration
#  based on Router Advertisements for this host
#net.ipv6.conf.all.forwarding=1


###################################################################
# Additional settings - these settings can improve the network
# security of the host and prevent against some network attacks
# including spoofing attacks and man in the middle attacks through
# redirection. Some network environments, however, require that these
# settings are disabled so review and enable them as needed.
#
# Do not accept ICMP redirects (prevent MITM attacks)
#net.ipv4.conf.all.accept_redirects = 0
#net.ipv6.conf.all.accept_redirects = 0
# _or_
# Accept ICMP redirects only for gateways listed in our default
# gateway list (enabled by default)
# net.ipv4.conf.all.secure_redirects = 1
#
# Do not send ICMP redirects (we are not a router)
#net.ipv4.conf.all.send_redirects = 0
#
# Do not accept IP source route packets (we are not a router)
#net.ipv4.conf.all.accept_source_route = 0
#net.ipv6.conf.all.accept_source_route = 0
#
# Log Martian Packets
#net.ipv4.conf.all.log_martians = 1
#

###################################################################
# Magic system request Key
# 0=disable, 1=enable all
# Debian kernels have this set to 0 (disable the key)
# See https://www.kernel.org/doc/Documentation/sysrq.txt
# for what other values do
#kernel.sysrq=1

###################################################################
# Protected links
#
# Protects against creating or following links under certain conditions
# Debian kernels have both set to 1 (restricted)
# See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
#fs.protected_hardlinks=0
#fs.protected_symlinks=0

###################################################################
# Set Swappiness (manually set by briggers)
#
vm.swappiness = 10
SAVE the file and exit the text editor.

Back in the terminal reload sysctl with
Code: [Select]
sudo sysctl -p
then check vm.swappiness with
Code: [Select]
cat /proc/sys/vm/swappiness
if it reports 10, reboot...

Then check again with
Code: [Select]
cat /proc/sys/vm/swappiness
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline briggers

  • nOOb
  • *
  • Posts: 3
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): 9
Re: Changed swappiness value ignored on boot
« Reply #3 on: September 24, 2018, 07:01:42 am »
Thanks for the reply, but that is exactly what I have done.
This is the tail of sysctl.conf
---
Code: [Select]
richard@AOA110 ~ $ tail /etc/sysctl.conf
# Protected links
#
# Protects against creating or following links under certain conditions
# Debian kernels have both set to 1 (restricted)
# See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
#fs.protected_hardlinks=0
#fs.protected_symlinks=0

# Decrease swappiness to a more reasonable level for ssd
vm.swappinesss=10
richard@AOA110 ~ $

---
After reboot :

Code: [Select]
richard@AOA110 ~ $ cat /proc/sys/vm/swappiness
60
richard@AOA110 ~ $

This suggests that it fails to read sysctl.conf on startup or there is a later process that rewrites the default value.
I've tried both
Code: [Select]
vm.swappinesss=10
and
Code: [Select]
vm.swappinesss = 10
and it makes no difference

However i8f i change it for the session with
Code: [Select]
richard@AOA110 ~ $ sudo sysctl vm.swappiness=10
[sudo] password for richard:
vm.swappiness = 10
richard@AOA110 ~ $ cat /proc/sys/vm/swappiness
10
richard@AOA110 ~ $

It changes as you can see

It's always worked for me on other distros
« Last Edit: September 24, 2018, 07:09:25 am by briggers »

Online PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 23544
  • Karma: 2616
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: Changed swappiness value ignored on boot
« Reply #4 on: September 24, 2018, 07:45:58 am »
Your tail output is showing a typo with 3 S's in:-

vm.swappinesss = 10

in your sysctl.conf file .. correct that and I'll bet it'll work.
« Last Edit: September 24, 2018, 07:50:04 am by PCNetSpec »
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec

Offline briggers

  • nOOb
  • *
  • Posts: 3
  • Karma: 0
  • New Forum User
    • View Profile
  • Peppermint version(s): 9
Re: Changed swappiness value ignored on boot
« Reply #5 on: September 24, 2018, 09:05:25 am »
Oh my gosh - and another way of being stupid is...

Thank you very much for spotting that. It explains why it worked when typed in for a session.

All good now  :)

Online PCNetSpec

  • Administrator
  • Hero
  • *****
  • Posts: 23544
  • Karma: 2616
  • "-rw-rw-rw-" .. The Number Of The Beast
    • View Profile
    • PCNetSpec
  • Peppermint version(s): Peppermint 8R, 9, and 9R
Re: Changed swappiness value ignored on boot
« Reply #6 on: September 24, 2018, 09:44:42 am »
Hey we've all done it .. two sets of eyes, and all that :)
WARNING: You are logged into reality as 'root' .. logging in as 'insane' is the only safe option.

Team Peppermint
PCNetSpec