Speed up Ubuntu Linux!
In the following tutorial you are going to fine tweak your Ubuntu Linux setup in order to speed up the boot process as well as the startup time of some frequently used applications.
use bootchart to profile boot times and bootlenecks easily through an intuitive image graph
install withsudo apt-get install bootchart
then you’ll get a graph in /var/log/bootchart directory each time you boot your system.
charts will be looking like the image on the right (click to zoom)
- Upgrade to Ubuntu Karmic 9.10. In this version of Ubuntu Linux most of the services have been transitioned from the venerable System-V init daemon to the new upstart daemon by Scott James Remnant, Ubuntu employee. This transition has highly improved the speed of both startup and shutdown processes.
- utility to tweak services startup
refer to post Managing startup services
Comments on what some services actually are meant to can be found here http://ubuntuforums.org/showthread.php?t=89491.
Be careful in disabling services since many despite not being necessary provide indeed useful features! - disable sl-modem-daemon startup service (uninstall that package) if you do not need to use the analog 56kbps modem.
- vmware-networking in vmware workstation 6.5 and 6.5.1 lags at boot time, consider switching to VirtualBox virtual machine.
- remove a few tty. By default there are F1 through F7, we do not need all seven: in folder /etc/event.d/ comment out all entries in tty4 tty5 files. 3 vts should be enough. The benefit from this is anyway extremely small.
- Profile your boot (NOTE: from Ubuntu Karmic 9.10 profile is automatically invoked at any major software update)
When you have the Grub menu to start your system, hit the “e” for edit the kernel line you normally start with. Then move to the end of the Kernel line and edit quiet splash to quiet splash profile. Don’t save this line just let it boot up “b” once with this profile parameter.
This boot will go very slow because it is profiling (read putting all read disk blocks behind each other) the normal boot to optimize performance. All subsequent boots will then go faster. If all boots go very slow afterwards make sure that the profile parameter was not saved as a boot option. - check the sixth column in file /etc/fstab set 0 for devices that do not need to be checked regularly
set 1 only for root /
set 2 for other partitionsThis is the standard, however you could have wrongly edited fstab file. This setup ensures only root filesystem is quickly checked at boot time, thus saving a little time excluding other filesystems when not necessary (these will be checked only after a dirty shutdown or on a scheduled basis). - in the file fstab also tweak your filesystems to support relatime instead of atime. This should be the default for kernels 2.6.30 upwards though (Ubuntu Karmic 9.10 runs 2.6.31 and includes this change). The rationale is that with the atime option enabled the kernel always has to perform a write operation to the disk when the kernel accesses a file, even without modifying its contents. With relatime this occurs only when content is modified reducing this way the number of write operations. Thank you to Paul for highlighting this.
UUID=1234567-abcd-efghi-ab12-1234567 / ext3 relatime,errors=remount-ro 0 1
- (NOTE: from Ubuntu Karmic 9.10 and the transition towards upstart this is enabled by default)
Enable concurrent booting allows Ubuntu to take full advantage of dual-core processors, as well as processors that hyperthread or multithread.
NOTE: this doesn’t seem to work for me. It messes up GNOME loading, probably due to an unsolved race condition. However, if you manage to have it notably improves your boot loading time.These settings are located in your /etc/init.d/rc file.
sudo gedit /etc/init.d/rc
Look for CONCURRENCY=none and change it to:
CONCURRENCY=shellrace conditions problems with dbus hal and gdm exhist
http://ubuntuforums.org/showthread.php?t=574992
https://bugs.launchpad.net/ubuntu/+source/hal/+bug/149881 - Some people report increasing the programs loading times by using prelink program. This is intended to prelink binaries to libraries only once in a while instead of each time the executable is launched. The time saved varies according to each program and its use of external libraries.
You can install prelink via
sudo apt-get install prelink
then run it the first time with
prelink -mR
and edit file /etc/defaults/prelink and change “PRELINKING=unknown from “unknown” to “yes”reference with performance benchmarks here
http://www.quintinriis.com
http://ubuntuforums.org/showthread.php?t=1971
http://ubuntuforums.org/showthread.php?t=74197
- Figure out SWAP problems.
Indeed swap has a high impact over our system performance, however I am not going to focus on swap usage here, but on swap misconfiguration. This can lead to a 10 seconds delay in the startup / boot process.Symptoms: Splash screen freezes after about 10 seconds of normal boot and stays this way for about a minute or so and never resumes (all text mode boot after). The boot process is stuck for 10 seconds after launching local-premount scripts with following message:
Begin: Waiting for resume deviceThis behavior is caused by the fact that you have somehow modified your swap partition (new linux setup? new hard disk? swap partition resize?) and thus initramfs-tools cannot find the partition through the old UUID.first make the swap partition work again by
sudo mkswap /dev/sda9
(where sda9 should be the corresponding partition on your system. Check gparted to ensure this. This will DESTROY all your data if you use it on a data partition, like your /home one)then compute the UUID of the new swap partition
sudo blkid /dev/sda9change the UUID code in both these files
/etc/fstab
(only change the one concerning /dev/sda9!)
/etc/initramfs-tools/conf.d/resumerebuild the initramfs with
update-initramfs -uYou can also change back the swap UUID with this command
mkswap -U UUID /dev/swapdev
where UUID is the ID shown in both mentioned /etc files (the ID should be the same in both them, otherwise follow the 1-3 steps!) - Disabling in BIOS USB Legacy Support lets you gain ~8 sec. that the system usually spends probing USB 1.1 legacy devices.
IMPROVE GNOME STARTUP/LOADING TIME
- In System -> Preferences -> Startup Applications disable the unneded services and edit every entry you still need to load deferring the loading time. The rationale is that all these services are not needed to load GNOME and thus can be loaded a few seconds after the desktop environment has loaded its core components.
In order to achieve this goal edit every command section as follows:sh -c "sleep 60; exec bluetooth-applet" or sh -c "sleep 30; exec /usr/lib/evolution/2.28/evolution-alarm-notify"
the number after sleep indicate the seconds after which the command is run.
Try to set a number greater than 30 and different numbers for each service prioritizing those you consider more important while further deferring the least important ones. - (NOTE: from Ubuntu Karmic 9.10 sreadahead is installed by default. This is an improved version of readahead)Configure readahead to preload files needed in your dektop environment while waiting for the username and password prompt. The more RAM you have the more you can preload. 512 is really the minimum.In /etc/readahead you can find the lists of preloaded files for the boot sequence (we have customized this in the previous step). Now we are going to create a profile of our desktop.At the login prompt, now change vts with CTRL+ALT+F1, login and write down
sudo readahead-watch -o /etc/readahead/gnome /
This will grind the disk for a while then it will return you to a command prompt. The profiler is now in the background watching all actions. Now, without logging out, go to your destop login prompt (ALT+F8 ) and log in normally. After you are fully logged in, press CTRL+ALT+F1 to go back to your terminal, and stop the profiler with
sudo killall readahead-watch
We would have to prune the resulting list a bit as Jdong suggests: In a terminal, run:
cat /etc/readahead/gnome | xargs -i ls -lk {} | sort -rn -k +5 | lessThis will display all the files readahead wants to cache, sorted by largest file first. The 5th column (before date) is the size of the file in KB. Make sure there’s nothing too large. If it’s bigger than 10,000KB or so, it’s probably not worth preloading. You can remove unwanted files from the preload list by opening /etc/readahead/gnome in your favorite editor, and deleting its line.
NOTE: If you have your home on a different partition, you should repeat the previous steps for each partition, replacing ‘gnome’ filename with a different name and the mountpoint / with each interested mountpoint.
To make your linux box apply this trick at every boot edit file /etc/rc.local and add in the line preceding ‘exit 0′:for list in /etc/readahead/*; do readahead-list $list done
OPTIMIZATIONS NOT RELATED TO STARTUP
- Move your temporary files /tmp folder to your RAM if you have loads of memory. This will also provide you greater privacy. Edit /etc/fstab and add the following line to it
tmpfs /tmp tmpfs defaults,noexec,nosuid 0 0
- Enable Firefox pipelining
type about:config in Firefox’s address bar.
Type pipelining in the filter text box. This will leave three options on screen.
Double-click network.http.pipelining to turn its value from false to true.
Do the same for network.http.proxy.pipelining
Double-click on network.http.pipelining.maxrequests and change “4” to “6.” (do not increase this value beyond)
Finally, on any blank space in the browser window, right-click and choose New>Integer
When prompted for a name, type nglayout.initialpaint.delay and set its value to 0. - Remove unnecessary font packages since they will speed up font cache rebuilt.
in a terminal issue the command:dpkg -l | grep ii| awk '{print $2}' | grep ttfyour output would be probably far too long. You may safely remove all packages except for the following ones: ttf-bitstream-vera, ttf-dejavu, ttf-dejavu-core, ttf-dejavu-extra, ttf-freefont, ttf-opensymbol AND those of the languages you actually use on your system (check each package language searching for it with Synaptic package manager).
All the other ones can be safely removed. - Enable Ethernet network offloading
click here for the howto
- Consider removing mono framework.
sudo apt-get –purge remove libmono0
NOTE: this would remove also some default applications such as Tomboy (replace it with ZIM or Basket Note Pads), and F-Spot (replace it with gThumb) - Preload is an “adaptive readahead daemon” that runs in the background of your system, and observes what programs you use most often, caching them in order to speed up application load time. By using Preload, you can put unused RAM to good work, and improve the overall performance of your desktop system.
This does not waste much RAM, and does not either improve boot up speed, it only acts for applications started after the boot up process.
use sudo apt-get install preload to install it,
use sudo apt-get install ld.so.preload-manager to install a program useful to manage the preloaded ones.reference: http://www.techthrob.com/tech/preload.php
- Disable all the not needed plugins in gedit, gnome default text editor. Gedit text editor is a pretty fast application, however some plugins do really put a burden on it! You can disable them from menu Edit -> Preferences -> Plugins
- Improve OpenOffice startup speed: from within one OpenOffice window select Tools -> Options -> Memory
Number Of Steps: 30
Use for OpenOffice.org: 128
Memory Per Object: 20
Number Of Objects: 20
Enable Quickstarter: Checked
Related posts:
- Swap Area not working
- [EN] Configure HP Pavilion QuickPlay multimedia buttons in Ubuntu Linux
- Linux Power Saving Tweaks for HP Pavilion laptops
- Managing startup services
- working with system logs
- Disk quota management
- Enable larger persistent data for Linux Live on SolidState or USB devices
Print This Post
|
Email This Post

This is cool version of the cat sort command
cat /etc/readahead/gnome | xargs -i ls -lk {} | sed -r -e ‘s![-rw0-9]* [0-9] [a-Z]* [a-Z]* !!’ | sed ‘s!\([0-9]*\)!\1 : size !p’ | sort -rn -k
[...] Speed up your Ubuntu Linux boot! | Nobody was Born with Linux Knowledge. [...]
how does removing libmono make ubuntu boot faster?
Most of these comments tell me what to do but not how to do it… not a good thing to do for newbies. Also, your comments on booting do not apply to those of us who use the Windows bootloader (i.e., we installed using WUBI).
@MossBliss – if it doesn’t apply, then don’t try it – no problem.
Trying this kind of thing – any kind of sudo editing – can completely trash your system. Just one character in the wrong case in one file saved is enough – and if you don’t write down every step (it’s a good idea to keep an A4 pad and a pencil to write the time, and a quick note at each step) then you’ll find the only way out is to reinstall.
Also, if you’re messing like this, it’s clever to have /home on a separate partition.
Tweaking like this maybe fun – but it’s not worth it for most people. I tried ‘concurrency+shell’ and learned a hard lesson – reinstalled and didn’t lose much more than a day’s messing and updating.
Concurrency needs startup scripts sequence to be fine-tuned in order to prevent race conditions.
At the moment is advised against enabling it.
However, in case you have enabled it and the system fails to prompt you with the graphical login and desktop you can easily revert the changes by editing back
/etc/init.d/rc
using the safe mode boot option -> root terminal -> pico /etc/init.d/rc
if things get messed up badly you can revert the changes by editing the file from an Ubuntu live CD and chrooting to the local setup.
Of course your advice to keep track of every change until you can achieve system stability is wise, however none of these changes puts your data and filesystem in danger and all can be reverted easily.
Thanks for the feedback!
Any chance of an update on this thread? taken from the starting place of 9.04! I know they have done a lot of work solving some of the problems from before but I think that you could help us top that no?
Oh yeah, I think Jaunty is already quite fast at booting but maybe there are still some finetunes… can you tell us which are them?
Works well, but gnome still goes like snail? Any desktop enviroment could be faster,stable than gnome?
XFCE is a great desktop environment, extremely light and fast, yet very extensible with tons of plugins and extensions.
LXDE is a new promising extremely light desktop environment.
Enlightment is another one worth trying.
Пригодился пост…сохранил на винт на всякий пожарный
I’m thinking of trying out some of these tips. How much of a difference can they make with Ubuntu 9.10 since it boots so fast already?
There still could be some.
The system boot up is far better optimized now on Ubuntu 9.10 than before, so the best thing you could do is check with bootchart if there is any program taking too long to load, other tips concerning the system part may not be of much of a difference although you could try by yourself – they can all be reverted!
You would get the major benefits from the GNOME and applications loading tips though.
If you have time to try please report back your experience!
Bootchart says the boot AFTER I booted with ‘profile’ was 18 seconds quicker than the one BEFORE booting with ‘profile’; from 1:29 down to 1:11. YMMV.