Archive for November, 2005

Insufficient memory to execute commands

Sunday, November 27th, 2005

If you have played with Linux computers for a while, it is possible that in some ocassions one of them run out of memory for some reason. In this situation it is impossible to run simple commands such as ls. Recently I’ve read a little trick from Prentice Bisbal at Linux Journal that may help.

From Prentice…

About five years ago, a Linux system I was responsible for ran out of memory. Even simple commands, such as ls, failed with an insufficient memory error. The obvious solution to this problem was simply to reboot. One of the other system administrators wanted to look at a file that may have held clues to the problem, but he couldn’t remember the exact name of the file. We could switch to different directories, because the cd command is part of bash, but we couldn’t get a list of the files, because even ls would fail. To get around this problem, the other system administrator created a simple loop to show us the files in the directory:

$ for file in *; do echo $file; done

This worked when ls wouldn’t, because echo is a part of the bash shell, so it already
is loaded into memory. It’s an interesting solution to an unusual problem.

Cool! Isn’t it? Thanks to Prentice Bisbal.

Portage and nice

Thursday, November 24th, 2005

While you are compiling packages and at the same time you are working with your box, probably you’ll notice the machine is less responsive than usual. Although this in principle is not necessarly an abnormal behaviour it could be very annoying.

To diminish the impact of such situation, you could reduce the priority that the kernel assigns to emerge.

Portage provides a configuration parameter that allows you to control this priority. Edit /etc/make.conf and add the following:

PORTAGE_NICENESS=”17″

This will pass “17″ as value to the nice command. Possible values range from “-20″ to “20″, being “-20″ the highest priority and “20″ the lowest. 0 is standard or normal priority.

See nice man page for more info.