Update on my swapping woes

I feel a bit embarrased about the ranting and complaining about Linux yesterday, ’cause as it turned out and as suggested by most of the commenters, on Linux you actually have the tools to fix the system when it is broken.

And broken it was, but only on my box.

The comment that sent me down the path to solving the problem was this one:

Marc Paradise Says:

You can reduce linux’s annoying tendency to swap out too fast:

Here are some instructions on how to do this for ubuntu:

http://ubuntuforums.org/showpost.php?p=1255511&postcount=43

See, at the time I thought my problem was that the system was swapping way too much, to the point where I couldn’t get in contact with it.  That is how it behaved.  It would run out of RAM, the disk would be spinning, it would slow down to the point where I couldn’t interact with the machine.

So reducing swapping might crash some programs if they run out of memory, but at least I would be able to interact with the system.

Sounded like just the thing to go for.

Well, when I followed the instructions I came to this command, with this troubling error:

$ sudo swapoff -a
swapoff: cannot canonicalize /dev/disk/by-uuid/d00bfdb4-c541-4d56-8448-b0a13ce352a8: No such file or directory

Ups, something is wrong here.  Could it be that the system doesn’t know where the swap partition is?  I checked the system monitor and to my horror found that it uses 0 bytes of swap, even when I am trying to fill up the RAM with all the applications I can fire up.

Yep, something is wrong here.

I googled for “swapoff: cannot canonicalize” — I find that googling the error message usually leads me to the answer faster than actually thinking about it — and then I hit this thread: http://ubuntuforums.org/showthread.php?t=802398

I followed the advice there and update /etc/fstab and viola, my swapping is back up (well, after running swapon -a).

If I stress the system now, of course some tools slow down as they are swapped out, but the behaviour is no where near what it was earlier.

Why the symptoms earlier looked like swapping rather than crashing applications I don’t know, but I don’t really care either.  I’m just happy to have a stable system back.

Sorry for ranting, Linux, in the end you came through for me :)

Tags:

4 Responses to “Update on my swapping woes”

  1. Søren Sandmann Says:

    The reason it looks like swapping is that when you have no swap whatsoever, the kernel can’t remove malloced memory from RAM (where would it put it?). However it *can* remove binaries that are mmaped read-only because those can be recreated from the bits that are already on the disk.

    So rather than killing applications, it just starts thrashing code pages as the amount of available RAM shrinks.

  2. Thomas Mailund Says:

    Ah, Sandmann, that makes a lot of sense!

    BTW, when are you back in Denmark again?

  3. Søren Sandmann Says:

    I’ll be back in Denmark around Christmas and New Years, but I don’t have the dates yet. Speaking of which, it’s about time we start finding dates for the meeting in Næstformationen …

  4. Thomas Mailund Says:

    Well, some of us meet on Tuesday ;-)

    But yeah, some time around xmas we should have a meeting as usual.

Leave a Reply