Can't change swappiness (Solved)

Just been trying to change swappiness in Xubuntu.

First, I got a message that gedit was not installed, so I followed the recommendation to install it.
That seemed to go ok, but when I tried to edit sysctl.conf the problems started. Despite error messages, sysctl.conf was presented in a different window and I was able to edit and save it, but when I re-run cat /proc/sys/vm/swappiness, the edit has not affected swappiness (ie: it’s still set to 60, not 10)

Any ideas please? Thanks in advance.

M

mike@xubuntu:~$ free -m
total used free shared buff/cache available
Mem: 3950 1834 640 64 1475 1785
Swap: 4092 0 4092
mike@xubuntu:~$ cat proc/sys/vm/swappiness
cat: proc/sys/vm/swappiness: No such file or directory
mike@xubuntu:~$ cat /proc/sys/vm/swappiness
60
mike@xubuntu:~$ sudo gedit /etc/sysctl.conf
[sudo] password for mike:
sudo: gedit: command not found
mike@xubuntu:~$ gedit /etc/sysctl.conf
The program ‘gedit’ is currently not installed. You can install it by typing:
sudo apt install gedit
mike@xubuntu:~$ sudo apt install gedit
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-101 linux-headers-4.4.0-101-generic
linux-headers-4.4.0-98 linux-headers-4.4.0-98-generic
linux-image-4.4.0-101-generic linux-image-4.4.0-98-generic
linux-image-extra-4.4.0-101-generic linux-image-extra-4.4.0-98-generic
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
gedit-common gir1.2-gtksource-3.0 gir1.2-peas-1.0 libpeas-1.0-0
libpeas-1.0-0-python3loader libpeas-common
Suggested packages:
gedit-plugins
The following NEW packages will be installed
gedit gedit-common gir1.2-gtksource-3.0 gir1.2-peas-1.0 libpeas-1.0-0
libpeas-1.0-0-python3loader libpeas-common
0 to upgrade, 7 to newly install, 0 to remove and 55 not to upgrade.
Need to get 632 kB of archives.
After this operation, 5,745 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 Index of /ubuntu xenial/main amd64 libpeas-common all 1.16.0-1ubuntu2 [13.7 kB]
Get:2 Index of /ubuntu xenial/main amd64 libpeas-1.0-0 amd64 1.16.0-1ubuntu2 [47.3 kB]
Get:3 Index of /ubuntu xenial/main amd64 gir1.2-gtksource-3.0 amd64 3.18.2-1 [17.1 kB]
Get:4 Index of /ubuntu xenial/main amd64 gedit-common all 3.18.3-0ubuntu4 [131 kB]
Get:5 Index of /ubuntu xenial/main amd64 gir1.2-peas-1.0 amd64 1.16.0-1ubuntu2 [5,678 B]
Get:6 Index of /ubuntu xenial/main amd64 libpeas-1.0-0-python3loader amd64 1.16.0-1ubuntu2 [11.1 kB]
Get:7 Index of /ubuntu xenial/main amd64 gedit amd64 3.18.3-0ubuntu4 [406 kB]
Fetched 632 kB in 1s (411 kB/s)
Selecting previously unselected package libpeas-common.
(Reading database … 261526 files and directories currently installed.)
Preparing to unpack …/libpeas-common_1.16.0-1ubuntu2_all.deb …
Unpacking libpeas-common (1.16.0-1ubuntu2) …
Selecting previously unselected package libpeas-1.0-0:amd64.
Preparing to unpack …/libpeas-1.0-0_1.16.0-1ubuntu2_amd64.deb …
Unpacking libpeas-1.0-0:amd64 (1.16.0-1ubuntu2) …
Selecting previously unselected package gir1.2-gtksource-3.0:amd64.
Preparing to unpack …/gir1.2-gtksource-3.0_3.18.2-1_amd64.deb …
Unpacking gir1.2-gtksource-3.0:amd64 (3.18.2-1) …
Selecting previously unselected package gedit-common.
Preparing to unpack …/gedit-common_3.18.3-0ubuntu4_all.deb …
Unpacking gedit-common (3.18.3-0ubuntu4) …
Selecting previously unselected package gir1.2-peas-1.0:amd64.
Preparing to unpack …/gir1.2-peas-1.0_1.16.0-1ubuntu2_amd64.deb …
Unpacking gir1.2-peas-1.0:amd64 (1.16.0-1ubuntu2) …
Selecting previously unselected package libpeas-1.0-0-python3loader.
Preparing to unpack …/libpeas-1.0-0-python3loader_1.16.0-1ubuntu2_amd64.deb …
Unpacking libpeas-1.0-0-python3loader (1.16.0-1ubuntu2) …
Selecting previously unselected package gedit.
Preparing to unpack …/gedit_3.18.3-0ubuntu4_amd64.deb …
Unpacking gedit (3.18.3-0ubuntu4) …
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) …
Processing triggers for libc-bin (2.23-0ubuntu9) …
Processing triggers for man-db (2.7.5-1) …
Processing triggers for gconf2 (3.2.6-3ubuntu6) …
Processing triggers for libglib2.0-0:amd64 (2.48.2-0ubuntu1) …
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) …
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) …
Processing triggers for mime-support (3.59ubuntu1) …
Setting up libpeas-common (1.16.0-1ubuntu2) …
Setting up libpeas-1.0-0:amd64 (1.16.0-1ubuntu2) …
Setting up gir1.2-gtksource-3.0:amd64 (3.18.2-1) …
Setting up gedit-common (3.18.3-0ubuntu4) …
Setting up gir1.2-peas-1.0:amd64 (1.16.0-1ubuntu2) …
Setting up libpeas-1.0-0-python3loader (1.16.0-1ubuntu2) …
Setting up gedit (3.18.3-0ubuntu4) …
update-alternatives: using /usr/bin/gedit to provide /usr/bin/gnome-text-editor (gnome-text-editor) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu9) …
mike@xubuntu:~$ gedit /etc/sysctl.conf

** (gedit:9882): WARNING **: Couldn’t connect to accessibility bus: Failed to connect to socket /tmp/dbus-cX8z5tGIpX: Connection refused
mike@xubuntu:~$ sudo gedit /etc/sysctl.conf

** (gedit:9934): WARNING **: Couldn’t connect to accessibility bus: Failed to connect to socket /tmp/dbus-cX8z5tGIpX: Connection refused

(gedit:9934): Gtk-WARNING **: Calling Inhibit failed: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.SessionManager was not provided by any .service files

** (gedit:9934): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-spell-enabled not supported

** (gedit:9934): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-encoding not supported

** (gedit:9934): WARNING **: Set document metadata failed: Setting attribute metadata::gedit-position not supported
mike@xubuntu:~$

What’s the contents of

mousepad /etc/sysctl.conf

Odd. This shows the new setting for swappiness.

Even this command threw up an apparent error in the terminal though…
** (mousepad:3726): WARNING **: Couldn’t connect to accessibility bus: Failed to connect to socket /tmp/dbus-mExREEPecG: Connection refused

#
# /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
# Set swappiness to 10 (added by mikep)
vm.swappiness = 10
#

So what’s the output from:

cat /proc/sys/vm/swappiness

You can safely ignore those terminal warnings.

Thanks Mark,

That’s now

mike@xubuntu:~$ cat /proc/sys/vm/swappiness
10

which is correct…!

Is this something to do with having shut down yesterday and restarted today? And is it usual for everything else in sysctl.conf to be commented out?

Yes to both.

OK. Thanks once again, Mark…

I’ll close this thread now.

M

No problem Mike :slight_smile:

You can safely ignore those terminal warnings.