How to run Ubuntu 12.04/10 or 10.04/10 on old computers with (very) limited resources

If you have an old desktop or laptop computer with (very) limited resources and you update to the newest Ubuntu releases you might realize that your computer is very slow. This is because Ubuntu 12.04/12.10 or 13.04/13.10 uses much more resources than previous releases. This howto shows you how you can tweak your computer to run Ubuntu 12.04/12.10 or 10.04/10.10 smoothly on computers with (very) limited resources.

Step 1: 
Change Shell or Desktop environment

This is probably the key and most important measure to succeed in your endeavour, as the standard desktop environments (i.p. Unity in Ubuntu 12.04/12.10) use a lot of resources for a nice looking and feature rich desktop. The most common lightweight shell or desktop environments (use little resources i.p memory) are LXDE and Xfce, whereas LXDE is the lighter of the two. Other lightweight environments are Awesome, Enlightenment (E) and Razor-qt, whereas Enlightenment is even a little lighter than LXDE. Using a 7 years old laptop (1.86 GHz Processor, 486MB RAM) with Ubuntu 10.10 the following amounts of memory were used after start-up: Enlightenment 67MB LXDE 75MB Razor-qt 94MB Xfce 135MB Standard desktop 180MB

The following article discusses the different Ubuntu shells / desktop environment in detail:

Personally I recommend Ubuntu beginners to use LXDE for computers with very limited resources and LXDE or Xfce for computer with limited resources. Choosing a common desktop environment usually includes less problems and more online help in case of problems. In Ubuntu 12.04/12.10 LXDE and Xfce can be installed from the Software Center or Synamptic Pakage Manager. Instructions for Ubuntu 10.04/10.10 can be found here

Step 2: 
Disable unnecessary applications

Another measure to speed-up your old computer is to disable unnecessary start-up applications. Many applications are started by default, but you will never or only very occasionally use them. To do so, you have first have to make the hidden start-up applications visible. You can do so by running the following command in the terminal:

sudo sed -i "s/NoDisplay=true/NoDisplay=false/g" /etc/xdg/autostart/*.desktop

For further details I recommend you the following article:

Now you can disable the unnecessary start-up applications. To do so run "gnome-session-properties" from the terminal (or alt+f2). In my experience you can disable around 50% of the start-up applications. Typical candidates are: Backup Monitor, Bluetooth manager, Desktop Sharing, Gwibber, Ubuntu One or Zeitgeist Data Hub.

Step 3: 
Decrease swappiness (1 GB memory (RAM) or less)

Computers with relatively low RAM memory (1 GB or less) tend to be slow in Ubuntu as Ubuntu accesses the hard disk too much. On the hard disk there's a separate partition for virtual memory, called the swap. When Ubuntu uses the swap too much, the computer slows down a lot. Ubuntu's inclination to use the swap, is determined by a value. The lower the value, the longer it takes before Ubuntu starts using the swap. On a scale of 0-100, the default value is 60. Which is much too high for normal desktop use.

Check your current swappiness value run the following command in the terminal:
cat /proc/sys/vm/swappiness

The result will probably be 60. To change the swappiness into a more sensible setting and improve the cache management, type in the terminal:
sudo gedit /etc/sysctl.conf

Scroll to the bottom of the text file and add your swappiness and cache parameters to override the defaults. Copy/paste the following lines:
# Decrease swap usage to a workable level vm.swappiness=10
# Improve cache management vm.vfs_cache_pressure=50

Save and close the text file and reboot your computer. After the reboot, check the new swappiness setting:
cat /proc/sys/vm/swappiness

Note: your machine might benefit from an even bigger decrease in swappiness. A useful rule of thumb might be this: 1 GB RAM or more: Swappiness at 10, less than 1 GB RAM: swappiness at 5

Step 4: 
For 768 MB Memory (RAM) or less: enable zRam

When your computer has very little RAM (768 MB or less), then of course your best choice is a lightweight member of the Ubuntu family (see Use Xubuntu or Lubuntu on old computers) or to change to a lightweight Desktop environment as described above. But even then the lack of memory might remain a problem and cause your system to slow down from time to time, even when the swappiness has been decreased to 5. In that case, you might achieve better results by enabling the experimental kernel module zRam. This module creates a compressed swap file in your RAM. The compression factor is the gain: with that, you "increase" your RAM.

Note: this hack might make your system unstable! So do not apply it on important computers.The price you pay for this, is threefold:

  • Your processor (CPU) is being taxed more heavily, because it'll have to compress and decompress all the time;
  • When the system has filled the RAM swap, it'll start swapping on the hard drive as well. With a heavy burden: the chunk of memory that has been sacrificed for the RAM swap.
  • For the time being it's still an experimental module, so this extra layer of complexity might cause instability. That's why, for the time being, I advise zRam only for computers with very little RAM, and even then only in combination with a swappiness that has been decreased to 5. Furthermore, zRam isn't suitable yet for production computers, but only for test machines and other, non-essential computers. zRam is already included in Ubuntu 12.04/12.10. In Ubuntu 10.04/10.10 you can install it with the following commands: sudo add-apt-repository ppa:shnatsel/zram sudo apt-get update sudo apt-get install zramswap-enabler