Linux Speed Up! Get a faster boot-up, a swifter desktop and more responsive apps.

Everyone loves a speedy computer. In this section we’ll look at some essential tricks to speed up your computer. You don’t have to be an experienced campaigner to get more mileage out of your Linux box. There are some techniques that even new users can employ to trick their Linux distro to boot faster.

Whether you dual-boot Linux with another OS or not, after you’ve installed your favourite Linux distro, the boot up process will surely be interrupted by the Grub bootloader. By default, most desktop Linux distros will display the Grub bootloader from anywhere between 10 to 30 seconds. One of the easiest ways to trick your computer into booting up faster is to trim the duration of the bootloader. If you always boot into the default option and are feeling adventurous, you can even skip the countdown completely, though we don’t suggest you do that. To tweak the Grub countdown, fire up a terminal and open the /etc/default/grub file in a text editor, such as sudo nano /etc/default/grub which will open the file in the Nano editor. Hunt for the GRUB_ TIMEOUT variable in the file which defines the duration that the boot loader is displayed. Then replace the value associated with this variable to something like 5 or 3. This is the duration in seconds. If you set it to 0, the countdown will be disabled and Grub will boot the default OS. Once you’ve set a new countdown timer, save the file and then inform Grub of the new settings with the command update-grub. Streamline startup services One of the major causes of longer boot times is that your system starts unnecessary apps and services during startup.
But before you start axing them, it’s best to get a picture of what’s happening while your distro boots up. Bootchart is a simple app that enables you to profile your Linux boot process and help measure the loading times of different services. You can use Bootchart to identify any bottlenecks in the boot up process. The app logs all activity and then displays the results in a detailed image file. You’ll find Bootchart in the repos of all the major distros, including Ubuntu, Fedora, OpenSUSE and Mageia. Use the distro’s package manager to find and install the bootchart package. Once you’ve installed the app, you’ll need to restart. When your desktop comes up, head to the /var/log/bootchart folder. Here you’ll find an image file (with the .png extension) which contains an analysis of the last boot process. A new time-stamped image file will be created on every subsequent boot up. The top of the image lists various statistics, such as the date of the test, the name of the distro, the kernel version and the enabled kernel options, as well as the time taken to boot the system. This is followed by two diagrams that show the CPU load and the disk activity during the boot up phase, and then comes the meat of the analysis. This meaty section contains a number of labelled bars each of which represents individual processes. Several bars terminate after a couple of seconds. The ones that continue through to the end depict services such as the Network Manager, Cron, and the CUPS daemon among others. The image also shows child processes and connects them to their parent processes with dotted lines. From this image you can find all the active processes and can then remove the ones you don’t need. For example, if you print occasionally, you can disable CUPS from starting at the boot time. Furthermore, the image also helps you identify processes that take control of all resources and force the other processes to wait, effectively blocking the boot process.
Now that you understand how your computer boots up and the services that are started, it’s time to tailor the boot process as per your requirements and shave off some time. The easiest way to free up resources in any Linux distro is to stop the unwanted processes from running or even starting up for that matter. Most Linux distros have a tool that let you see what’s going on and halt things, if necessary.
startupUbuntu ships with the Startup Applications tool that lets you add and remove any apps that you’d like the distro to launch when it boots up. For speedier boot ups, launch the app and disable any unnecessary service you find in there. By default, the app doesn’t display the full gamut of apps and services. To see the hidden services and apps that don’t come with a GUI, fire up a terminal and change to the directory that lists all the services with cd /etc/xdg/ autostart. Within this directory you’ll find individual files for all installed apps and services. In each file there’s a variable that controls whether the services is listed in the Startup Applications tool or not. You can change the default value of this variable inside each file with: sudo sed –in-place ‘s/NoDisplay=true/NoDisplay=false/g’*.desktop
When you relaunch the Startup Applications tool, you’ll find additional startup programs, such as Desktop Sharing, Personal File Sharing etc. You can read through their descriptions and disable any you don’t require. To disable a service from starting, select a service and simply uncheck the box next to its name. Remember not to click on the Remove button, so you can just re-enable it later. Also, don’t disable an autostart entry unless you understand what it does, otherwise you could adversely affect the usability of the distro. So if your computer doesn’t have Bluetooth hardware, you can safely disable the Bluetooth Manager applet. But if you disable Mount Helper, Ubuntu will stop automounting removable devices.

Turn off the bling

Modern desktops ship with fancy desktop effects to addsome zing to regular desktop tasks, such as opening and closing windows and apps. However, these fancy graphical compositing effects are not suitable on some resource-restricted machines and should be immediately turn off. There are also some fancy features that we have taken for granted. For example, the thumbnails preview in the filemanager. It wouldn’t make much difference when viewing the contents of a folder with a few files. But open a folder with hundreds of files on a slow machine and the file manager will consume precious resources generating thumbnails.
To turn off thumbnails on a Gnome-based machine, launch the Files file manager and head to Edit > Preferences. Here switch to the Preview tab and set the value Show thumbnails to Never. Additionally, Ubuntu users should install the CompizConfig Settings Manager with
sudo apt-get install compizconfig-settings-manager compiz-plugins-extra
to alter desktop effects. Similarly, Gnome users should install the Gnome Tweak Tool. It’s available in the official repos of mainstream Gnome-based desktop distros such as Fedora. RPM-based users can install it with yum install gnome-tweak-tool and Deb-based users with sudo apt-get install gnome-tweak-tool. If you use KDE, head to System Settings and look for desktop effects and then turn them off. Similarly the Nepomuk, Strigi and Akonadi features in the KDE desktop hog memory resources. You can disable Nepomuk and Strigi from System Settings by heading to the Desktop Search section. To disable Akonadi, shut down the Akonadi server with sudo akonadictl stop. Now open the /~.config/akonadi/akonadiserverrc file in a text editor and change the StartServer parameter from True to False. Since Akonadi is tied deep into the KDE desktop, when you launch any Akonadi-enabled app, it will automatically start the Akonadi server. Some KRunner runners and Plasma widgets also use Akonadi so you have to disable them as well. To disable Akonadi-enabled KRunner runners, press Alt+F2 on your keyboard and click on the Wrench icon. Then uncheck Nepomuk Desktop Search and the Instant Messaging Contacts runners. Next you need to tell the Digital clock widget not to display calendar events by right-clicking the digital clock in the panel and then heading to Digital Clock Settings. Switch to the Calendar tab and uncheck the Display Events option.
The indexing application apt-xapian-index speeds up certain search operations, but it can have a major detrimental effect on the performance of weaker computers. You can freely remove this package with sudo apt-get purge apt-xapian-index, because it’s not essential.
f you’re running a distro on a laptop, you’ll need to consider a few particular things. Your average laptop is effectively two machines. If you were to benchmark its performance you’d get different results with the same distro. This is because laptops are designed to tweak their performance based on power usage. When running on battery power, laptops will try to extend battery life by turning down their performance. You can get better control over this process with the TLP tool, which is an advanced power management command line tool for Linux that tries to apply various tweaks to conserve battery while maximising performance. You can install TLP in Ubuntu by first adding its PPA with sudo add-apt-repository ppa:linrunner/tlp, then refreshing your repos with sudo apt-get update before installing the tool with sudo apt-get install tlp tlp-rdw. Fedora users should type the following the following three commands:

sudo yum localinstall –nogpgcheck
sudo yum localinstall –nogpgcheck

Once installed, start TLP with sudo tlp start. Although it works in the background, there are some settings that you can apply manually to override the default TLP settings, such as enabling or disabling the Wi-Fi and Bluetooth radios on demand and switching between AC or battery settingsignoring the actual power source. These settings can be modified by editing TLP’s configuration file located at /etc/default/tlp. Furthermore, Ubuntu users who wish to take charge of the scaling powers of their laptop’s CPU, should also install the CPUFreq indicator with sudo apt-get install indicator-cpufreq. Once installed, you can control your CPU’s scaling feature via the indicator in the top menu bar.

Clean the crud

Use your package manager to install tools like BleachBit to spring clean your distro.
Over time, a typical Linux distro builds up a reservoir of unnecessary data. These left-over files and data artefacts can slow down a computer in mysterious ways. This is why, in addition to the tweaks mentioned in this feature, you should also take some time to regularly spring clean your distro. Your distro creates and stores thumbnails in hidden directories even after the original file has been removed. Over time, the number of thumbnails can increase dramatically. Head to the hidden .cache/thumbnails/ directory and remove the files under each sub-directory. If you diligently keep your distro updated, chances are you’ve also accumulated a stack of older kernels that you no longer need. These are kept in case you are unable to boot into your distro with the updated kernel and they are generally listed under the ‘Advanced options’ in the Grub menu. To remove the unused kernel, first find out the version you are currently running with the uname -r command. Then use your distro’s package manager to search for any packages beginning with ‘linux-image’ and remove the ones that don’t match the version of the current kernel. Fedora users can use the sudo yum remove kernel command which will automatically zap all unused kernel, while Ubuntu users can use the Ubuntu Tweak tool. It also helps to clean the package management system’s cache. Fedora users should use the sudo yum clean all command to streamline Yum, while Ubuntu users should use the sudo apt-get autoremove command to remove orphaned packages, followed by sudo apt-get autoclean to remove any partially installed packages or the packages that are no longer installed in the system.
The previous tricks  will help you get good traction out of your Linux distro with minimal effort. Got information to share? Be free to contact me on Twitter for suggestions.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.