12

(I am currently using Ubuntu 14.04 LTS, GNOME environment)

tl;dr How can I force more memory swapping (swappiness already at 100)?

I have recently been experiencing a lot of system freezes/crashes. Often when accessing busy websites. It has been happening so much I have htop loaded on my tty, so I can switch to it and terminate my browser (as GUI does not respond). However, sometimes I need to use REISUB.

I thought GNOME might work better than Unity, as my Debian system has no problems, and it did to a point, but I am still running high on memory, and getting freezes.

I looked at my free -m today, and noticed my swap was showing 0 used. Output:


             total       used       free     shared    buffers     cached
Mem:          1821       1673        148        221         40        643
-/+ buffers/cache:        989        832
Swap:         1933          0       1933

I did a temporary swappiness to 100 (sudo sysctl vm.swappiness=100). The results were still the same (0 being used even after running to near max system memory usage).

I looked at this answer:

How do I see if system is swapping? unfortunately as I am writing this, my system went into updates, and my packages are locked, so I cannot install this (sar) nor am I sure what package this is part of, in order to give another Output.

I have looked in the fstab, and my swap partition is being used correctly.

# swap was on /dev/sda3 during installation
 UUID=10fdfed2-1fde-4d9f-a8f1-3d2376b0ffcc none            swap    sw              0       0

I am using a shared swap partition with my Debian OS (dual boot, separate partition, shared swap). But the partition is not locked, and I did a quick swapoff ..., swapon ..., and swapon -s to see if it would possibly recognize my swap and start swapping. It appears to still be at low swapping (84 hooray), but my memory usage is at 90%+ usage. With around 13% memory usage by Chromium, 17% by GNOME.

I don't care if I am forced into slowness, but I can't be forced into full system freeze (can't access TTY, can't do Ctrl+Alt+Backspace, only Alt+SysReq R,E,I,S,U,B)

I had the same issue with 12.04 LTS (pre-packaged), but have recently gone to 14.04 LTS.

Bottom Line: How can I force swapping further, and/or control processes before they cause system stability issues?

(Side Note: Debian works fine, except for mouse touchpad issue)

Output of dmesg | grep error:

[   26.646691] EXT4-fs (sda2): re-mounted. Opts: errors=remount-ro

This is Ubuntu Partition. Same error on Debian Partition except sda7.

No Time
  • 1,167
  • System freezes like you describe often occur when hard drives begin failing. Have you checked the output of dmesg for errors? – Timothy Martin Aug 21 '14 at 17:56
  • @TimothyMartin updated with dmesg – No Time Aug 21 '14 at 19:52
  • 1
    From your dmesg it seems that the hard drive is failing, then the system remounts it as read-only. Can you install smartmontools and then run smartctl -a /dev/sda? – Renan Aug 21 '14 at 19:56
  • @Renan what output is needed from that command? – No Time Aug 21 '14 at 20:23
  • 1
    You are not low on ram. Look at the +/- buffers/cache line to get the actual amount of ram used by your system. See http://linuxatemyram.com/ for an explanation. Your getting freezes is not because you have low ram. It may be bad ram, or something wrong with video card or cpu or similar. – pqnet Aug 21 '14 at 22:24
  • @NoTime look at any lines that have a 'FAILED'/'FAILING_NOW'. – Renan Aug 21 '14 at 22:32
  • @pqnet makes sense for RAM. Doesn't make sense that it doesn't do it in Debian though.. :/ – No Time Aug 21 '14 at 22:45
  • @NoTime it may be related to a lot of different things. For example, a buggy driver which is only on ubuntu and not in debian. ctrl+alt+backspace should be disabled by default in ubuntu: did you enable it back again? Swapping the working set of running programs will often push your system beyond the level of "slow", in most cases you can only fix it with hard reset. – pqnet Aug 21 '14 at 23:01
  • In modern systems it is unthinkable to use swap as replacement for ram: it can still be used to swap out pages of processes which are not using them (for example, background idle daemons) – pqnet Aug 21 '14 at 23:06
  • @pqnet this is a netbook, ubuntu pre-installed (low memory only like ~=2G RAM. Ubuntu worked fine right up to the point where they stopped using U1 as much, then oneconf started eating into memory. I did new install, and did not have that problem again, until maybe 2 months ago or so? I try to keep minimum programs running (no startup programs, really only use it to access internet, and small scripts with python). I re-enabled ctrl/alt/backspace. I know RAM speed is much faster than paged HD space (even in an SSD, which I have). – No Time Aug 22 '14 at 01:41
  • swapping on SSD may work, but will inevitably lead to fast SSD destruction. This may be the reason Ubuntu tweaked itself to avoid swapping as much as possible. What is the setting of cat /proc/sys/vm/vfs_cache_pressure? – pqnet Aug 22 '14 at 05:21
  • @pqnet at 100 now (on Debian), and Ubuntu – No Time Aug 22 '14 at 05:49
  • @NoTime are pages being swapped in Debian? – pqnet Aug 22 '14 at 05:51
  • " cannot install this (sar) nor am I sure what package this is part of" - sysstat – steve Aug 09 '17 at 23:11
  • Check: https://askubuntu.com/a/103916/660555 – alper Jun 12 '22 at 15:03

2 Answers2

2

Please read this article Stackoverflow you have 643 cached memory and 148 free ~ 800 mb. Your swap file will be used when cached and free mem are equal vm.swappiness in percents

-4

in /etc/sysctl.conf increase vm.swappiness=50