I remember, not that long ago, how slow GNU/Linux was while booting when compared with the Windows operating system. This was also one of the main ‘complaints’ (this and the whole proprietary codecs related issues, eh! :D) that I usually received after asking some of my friends to try GNU/Linux.
But over the years, the Kernel, file systems, the desktops etc have matured a lot, and these days, my Ubuntu OS boots even faster than Windows 7!. Two of the main reasons why Ubuntu boots fast is that, it comes with somewhat a small number of ‘system services’ (important/core software programs that are loaded into the RAM while your computer boots) & a tool that significantly speeds up the loading times of these services to the RAM called ‘Ureadahead’.
However, there are still few things that you can do to speed up the OS a bit more, so I decided to write about few things that you can try out. The article might look long, but it won’t take more than 10-15 minutes of your time.
Removing ‘unnecessary’ system services, manually
If you know what you’re doing, then you can further get rid of another 1 or 2 services for reducing the boot-up times. There are few tools that you can use, but for ease of use, I’ll stick with the ‘BUM’ (boot-up-manager) utility.
Enter the below command in your Terminal window to install it first.
sudo apt-get install bum
Then use the below command to launch it.
If you don’t use applications such as ‘screen readers’ (designed for visually impaired users), then you can safely remove a system service called ‘speech-dispatcher’ as shown below. What you do is simple, just, remove the ‘check-mark’ and then from the menu go to ‘File’ -> ‘Apply’. When asked, choose ‘Yes’.
If you won’t be using any network connections, then there are few services that you can get rid of, but I think it’s better to leave them alone.
Removing unused applications and indicators running in the system’s background
Ubuntu comes with few applications that some users might not really use. And the reason why you might wanna remove them is because they run from your OS’s background as services, thus after removing you should not only be able to free few Megabytes from your RAM, but it should also speed up the desktop loading time as well.
Basically you can do two things. You can either completely remove some of these apps or you can disable them temporarily. Either way it’s fine, and below I’ve laid out both of them.
Temporarily disabling them …
In the recent past, Ubuntu used to let users enable/disable applications that were loaded with the desktop startup. But this ‘list’ is now hidden by default. But thanks to a simple trick (I got this one via AskUbuntu), you can easily make them visible and edit as needed.
For that, execute the below four commands, one by one.
mkdir -p ~/.config/autostart
cp /etc/xdg/autostart/*.desktop .
sed -i "s/NoDisplay=true/NoDisplay=false/g" *.desktop
Now, from the top right corner’s menu, click on ‘Startup Applications…’ and it should now show you all the user-related services that are loaded with the desktop.
Update: Starting with Ubuntu 12.10, this menu entry is now removed. But you can open the startup manager by simply searching for ‘startup applications’ on the ‘Dash’.
If you know what you’re doing, then you can remove a lot of these services (by removing the ‘check mark’, don’t click on the ‘Remove’ button!), but if you’re new to Ubuntu, then below are a list of some of the services that you can git rid of safely.
‘Backup-Monitor’ :- If you don’t need the ‘Deja-dup’ (default data backup tool) to schedule backups, then disable it.
‘Bluetooth-Manager’ :- If you don’t use Bluetooth, then disable this too.
‘Chat’ (telepathy indicator service) :- If you don’t use the ‘Telepathy’ chat client, then by disabling this you can free up about 2.7MB of your RAM.
‘Desktop Sharing’ :- If you don’t need remote desktop or desktop sharing features (most users don’t need this) then remove the ‘check-mark’ to disable that too.
‘GPG Password Agent’ :- This is a tool that adds encryption to email clients (has nothing to do with web based email services) and chat programs, if you use them, then keep this one. Otherwise, disable it.
‘Gwibber’ :- This is a microblogging client. If you don’t use it, then disable it.
‘Onboard’ :- This is the on-screen keyboard that comes with Ubuntu. Most won’t be using it, so yes, you can disable this one too.
‘Orca screen reader’ :- As you can see from the name, this is a screen reader application, most can disable this.
‘Personal file Sharing’ :- Unless you’re gonna be sharing files over a network (has nothing to do with applications such as ‘Bittorrent’ or if you use the internet), disable it.
‘Ubuntu One’ : I don’t think anyone would need an introduction to this as it’s the famous Ubuntu’s Cloud computing product. I don’t use this, but even if you don’t use it, it runs a service from the background and it uses 30MB or more of your RAM. If you don’t use it, then please disable it :D. (update: Starting with Ubuntu 14.04 LTS, this program is no longer included as it is now abandoned).
‘Update notifier’ :- If you don’t need to receive automatic update notifications (as you can execute it manually), then you can disable it as well. But for security reasons, I encourage you to keep it enabled.
Completely getting rid of some of them
You won’t be able to remove a lot of services as above with the below method. But, it frees up HDD spaces and ‘cleans’ up the system plus, some can be disabled using this method only (such as the below ‘indicator-messages’) and are not available in the above method.
*. ‘indicator-messages’ :- It’s a small icon on the top bar on your desktop that allows you to access various social apps and their settings (such as Gwibber, Empathy etc).
If you don’t need it, then enter the below command to get rid of it (the second command only removes the ‘indicator’/service that uses ‘telepathy’ not the app itself).
sudo apt-get autoremove indicator-messages
sudo apt-get autoremove telepathy-indicator
*. ‘Deja-dup': If you don’t use this file backup tool, use the below command to get rid of it.
sudo apt-get autoremove deja-dup
*. ‘Ubuntu One': If you’re sure that you don’t need it, then enter the below command to get rid of it (again, Ubuntu 14.04 LTS users do not have to worry about removing it anymore).
sudo apt-get autoremove ubuntuone-client python-ubuntuone-control-panel
Specially ‘thanks’ to Ubuntu one, and others, these steps should help you to reduce at least 35-40MB from your memory.
Removing temporary packages stored in your HDD
When you install packages in Ubuntu using the Software Center or the ‘apt-get’, ‘Synaptic’ … they all first download these packages and store then in your HDD (caching). As time goes on, this cache can get a lot bigger. Though other than the ‘wasted’ HDD space, it won’t have a big impact on your system’s performance.
However, I think by removing these packages should help to improve the performance of these package managers (including update manager) because they no longer have to deal with (compare, search etc) the long list of applications in the cache.
So from time to time, make sure to run the below command to clean this package cache.
sudo apt-get clean
When you install some packages, they also installs other packages with them (known as ‘dependencies’). However, when you remove those, some of those dependency packages don’t get removed automatically due to many reasons.
So from time to time, you can use the below command to safely get rid of some of those dependency packages that are no longer required.
sudo apt-get autoremove
Installing utilities that improve the system performance
*. ‘zRam': As most know, a ‘Swap’ file is a temporary location in your disk drive (including SSD etc) that’s being used by the OS to save data (temporarily) while loading/unloading programs from the disk drive to RAM (vice versa).
What ‘zRam’ does is, it creates a virtual and a compressed ‘Swap’ file on the RAM itself, so the RAM can now hold more programs and their data. This minimizes the need to use the ‘real Swap’ file on the disk drive, thus increases the performance as it minimizes the need to read from the disk.
I honestly haven’t seen huge improvements, but, you can try installing it anyway. If you use Ubuntu 12.10 Quantal Quetzal and 12.04 Precise Pangolin, then simply enter the below command.
sudo apt-get install zram-config
For older versions (11.04 Natty Narwhal & 11.10 Oneiric) use the below commands.
sudo apt-add-repository ppa:shnatsel/zram
sudo apt-get update
sudo apt-get install zramswap-enabler
That should do it.
*. Use ‘BFS’ (task scheduler): Every operating system has a core component called the ‘task scheduler’ which deals with multitasking. The one included in the GNU/Linux is called ‘CFS’, a conservative scheduler.
But ‘BFS’ on the other hand, is especially written for desktop/laptop computers and is a bit ‘aggressive’ one. In simple words, if want your PC to be a bit more ‘responsive’ while multitasking, then ‘BFS’ can help (it is not recommended to be used on environments such as Servers where heavy loads of applications is present).
There won’t be ‘huge’ performance increases (can be sometimes, such as gaming), but it’s worth trying anyway. For installing it in Ubuntu 11.04 to 12.04, use the below commands.
sudo add-apt-repository ppa:chogydan/ppa
sudo apt-get update
sudo apt-get install linux-image-generic-ck linux-headers-generic-ck
Once you install it, it’ll add a new menu into the GRUB boot loader‘s list, so you can switch between the new and the standard Kernel task schedulers that comes with Ubuntu with ease.
Update: For installing ‘BFS’ on Ubuntu 12.10, 13.04 etc, please use the instructions listed on ‘Step 7‘, below.
Reducing the ‘Swap’ file usage
If you have like 2GB or more RAM, then you can force Ubuntu to rely on more using the RAM rather than the ‘Swap’ file on the HDD (which improves the performance). I’ve already written a post on that, so please read this post for achieving that.
Update: I have come across another few methods that should come in handy for fine tuning Ubuntu (one in particular), so I decided to update this post. So here it goes.
Switch to ‘BFQ’ Disk I/O Scheduler
Just like the above mentioned ‘task scheduler’ that deals with processes, there is another very important utility in every operating system called the ‘disk i/o scheduler’, and it is its job to ‘distribute’ your hard disk’s ‘read/write’ (i/o) bandwidth in a way (as in situations like when the disk is busy while multiple programs trying to access it) so that the performance is kept at its optimal level.
So then, if your current disk i/o scheduler is not properly optimized to handle such situations (say that you are trying to open a memory hungry app while the HDD is busy copying a large file), the end result would be as such that the OS will lose its usual ‘responsiveness’, and thus your programs will open slower than usual, switching between opened apps will take a long time etc.
‘BFQ’ in that sense, is a new disk i/o scheduler that is designed to address such situations. Or in other words, if you are not that happy with the application loading times in Ubuntu when your HDD is ‘busy’, then you should try installing ‘BFQ’, because it is claimed by the developer plus, according to my experiences as well, ‘BFQ’ has the ability to load programs 260-670% faster!.
I have written a detailed review. So please go over to this page, and if you don’t need all the details, then just scroll down a bit for finding the instructions for installing it in Ubuntu (this will also install the ‘BFS’ task scheduler as well).
‘preload’ is a tool that keeps a track of your mostly used applications & the files that they load into RAM upon their execution. Then based on that data, it tries to predict which app (s) that has the highest probability of being executed by the user, in the near future, and it then loads its data into RAM, before it is being demanded.
When the accuracy of this prediction is high enough, it should improve the loading times of your favorite applications. If you have 512MB or more RAM, then you can try installing ‘preload’. I’ve also written a detailed review, but if don’t want to read it, then just enter the below command to install it.
sudo apt-get install preload
That’s it. Now reboot the computer & keep using the computer as usual. Once ‘preload’ has gathered enough data, you should see its ‘effect’ :).
Defrag your file system
It is the common belief that GNU/Linux file systems are better equipped to handle file fragmentation and that they don’t require any defragmentation. It is true that they have low file fragmentation ratio, but according some experts who have done extensive research, in some situations, the latter claim is simply not true.
So as an Ubuntu user, if you the ‘Ext4′ file system (default one used in Ubuntu), then you can use a tool called ‘e4defrag’ that lets you easily see whether the file system is fragmented or not and if it is, then you can use it to defrag it. For the instructions, please read this article.
Fastening the Shutting down process
Ubuntu has always been shutting down pretty quickly in my experience and over the years it has been getting better and better. However, the 12.10 version has been taking an awful lot time while turning off. But luckily I was able to found a temporary solution, and few have mentioned that it has helped them as well. So I decided to add it here.
You can read this article for the instructions, but please remember that, if you are not experiencing any issues while shutting down, then just ignore this ‘Step’.
Anyway, these are some of the things that came to my mind but if you have suggestions, then please throw in some comments. Again remember, even if you follow these steps, there’s no guarantee that you’ll see big improvements in performance, but they do help!. Good luck.