I have a Ubuntu system running xfce and 2 GB RAM. I have a 1GB swap file which, when multitasking begins to fill up. When I have even a small amount of free swap, I have no issues, but the second the swap fills, the system locks up. Not even the mouse will move, although, I am able to use [Alt]+[SysRq]+[K] to kill xfce, which still necessitates a reboot to get up and running again. I will provide more system details if they are needed. Thanks in advance.
1 Answers
Yes that is what happens when you run out of memory/swap. On the other hand I would have expected that Ubuntu starts killing random processes, desperately trying not to crash. It is a configuration somewhere in the system, but once out of memory there it is unsafe for your filesystem to keep running. So the most sane thing is to halt the system, trying not to corrupt any (more) data.
You have to figure out why you run out of memory, which application causes this to happen. top or htop can help you with that. htop probably needs to be installed with sudo apt-get install htop. The advantage of htop is that you can easily point and click on the column header you want to sort by.
If you can't eleminate the program, your best bet is to add extra RAM, but that costs money. Your second best bet is increasing swap space, but that costs performance.
As a temporary work around (until next reboot) you can test if this works:
- Find a filesystem with a lot of free space. On most default installs
/tmpwill dodf -h /tmp. At least several GB's should be free. - Create a large file (eg. 1M × 2000 = 2GB)
dd if=/dev/zero of=/tmp/extra.swap bs=1M count=2000 - Initialise the file as swap space
mkswap /tmp/extra.swap - Start using the file as swap space
sudo swapon /tmp/extra.swap
If this is working for you, you'll have to look into making a more definitive solution out of this.
- 5,593
- 2
- 25
- 35
-
This is supposed to happen if I am out of physical mem, but I have at least 200MB left of RAM when this happens... – nanofarad May 02 '12 at 11:37
-
Does `mkswap /tmp/extra.swap` need to be run as root? – nanofarad May 02 '12 at 11:43
-
1Not on my system, as long as you executed the dd as an unprivileged user too. Coming to think of it, as a safety measure, best is to do all these three commands as root (using `sudo`) so you cannot accidentally write to it. Just a safety measure. – jippie May 02 '12 at 14:15
-
I have quite a bit of physical mem left when it locks up... – nanofarad May 02 '12 at 18:04
-
Can you share the output of `free` when swap fills up? – jippie May 02 '12 at 18:12
-
If's not a full lockup, it's just the OOM killer doing its job, and *removing* my swap actually lets me use more memory before a lockup... Also I can't show the output of `free`, as I can't see my virtual consoles...+ – nanofarad May 02 '12 at 18:14
-
You have to figure out which application is causing this. Use `htop` as described above. Or make a batch job that logs the output of `top`, `free` and `dstat` to a file. – jippie May 02 '12 at 18:18
-
let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/3310/discussion-between-robert-arkenin-and-jippie) – nanofarad May 02 '12 at 20:05