I posted this over at the OLPC News Forums, and decided to share it with Hackszine readers as well.
Most of the time, the 256MB in the XO Laptop is sufficient. But I use yum to install software, and it can be very memory hungry. I often run out of RAM when installing more than a few packages at once (or a single package that decides it needs a bunch of other packages to work properly). There are two things I suggest before using yum: 1) quit all activities except terminal and cross your fingers or 2) enable some swap space and not worry.
The quick and dirty way to enable swap space is to put an SD card that you don’t care about into the XO, and run one of these commands:
Note that this will destroy whatever’s on the SD card, and in the long run is not good for it because it puts a lot of wear and tear on it.
On the default operating system that came with your XO:
su mkswap /dev/mmcblk0 swapon /dev/mmcblk0 exit
On a joyride, Update.1, or later:
sudo mkswap /dev/mmcblk0 sudo swapon /dev/mmcblk0
You can replace swapon /dev/mmcblk0
with swapoff /dev/mmcblk0
when you are done and want to remove the SD card, or shut down the machine then remove the SD card. Don’t remove it while you’re using it as a swap drive or the system will probably crash.
As with anything that has “su” or “sudo” in it, if you mistype something, you may damage the operating system. One safety tip I can suggest is that you type the command like this:
swapon /dev/mmc[TAB][TAB]
That invokes tab filename completion, where it will either type out mmcblk0 for you, or show you a bunch of options. If you see anything other than mmcblk0, or mmcblk0p1/2/3, you might have mistyped the command. (The p1, p2, etc variants may appear if the SD card has multiple partitions on it).
I use this all the time to give myself some extra memory. It is slow because it’s swapspace on an SD card, but it’s much better than running out of memory while running yum. (The consequence of running out of memory is that you end up with improperly installed software). This is also handy if you are going to run a ton of activities at once, or if you are planning to use memory-intensive apps that you install with Yum, such as openoffice, gnumeric, etc.
ADVERTISEMENT