Tuesday, April 28, 2009

Slow Ubuntu startup because of tracker and updatedb

The applications tracker and updatedb (which is used for locate) seem to run at startup every day on some machines. This causes the machine to be much slower until they have finished, which is annoying.

Disabling Tracker

You can disable tracker if you don't use it. Open a console window and navigate to /etc/xdg/autostart/ and edit the file trackerd.desktop as root (using sudo). Add the line 


to the end of the file. do the same with the file tracker-applet.desktop.

This will disable the tracker for all users on the machine. To disable the tracker for a specific user only follow the guide on https://wiki.ubuntu.com/Tracker, which is where I found this solution too.

Cleaning up updatedb

updatedb is used to keep track of all files one your harddrive so that you can search them using locate. However there are on some machines installed several scripts that will run this program every time it boots and thus slow it down. Having this database updated every day seems like overkill to me, weekly should be sufficient.
Open a console window and navigate to /etc/cron.daily/, list the files there. If you find the files find.notslocate or find.notslocate.dpkg-new remove them using

sudo rm find.notslocate
sudo rm find.notslocate.dpkg-new

Check to see if you have both mlocate and slocate files you only need one of them. mlocate is the prefered locate by Ubuntu so lets remove slocate. Type:

sudo apt-get purge slocate

to remove it. It might say that slocate is  already uninstalled, in that case remove the slocate script by typing

sudo rm slocate

Finally lets move all the scripts that run updatedb to cron.weekly (which make them run weekly instead of daily). From the cron.daily folder type:

sudo mv mlocate ../cron.weekly/.
sudo mv find ../cron.weekly/.

To learn more about mlocate versus slocate check out http://shallowsky.com/blog/tags/boot/, which is where I found the solution to this problem.

1 comment: