Post Updated 6/7/2009.
I was tweaking my newly upgraded system and noticed that one of the quad cores was pegged at 100% usage. The rest were down in the weeds:
What was up with that? There’s two ways to find out. One is to go to the System Monitor and click on the Processes tab. Sort by %CPU Used and the offending process should pop to the top. Wow, was that process eating up some memory as well!
The other way is to executed a terminal and type “top” w/o the quotes. To is a great little application that lists the top users of CPU time, plus gives a bunch of great info at the top of the terminal screen like total uptime, CPU info, process statistics, etc.:
I chose the latter. Top showed a program called update-apt-xapi. Actually, there is no program with that exact spelling because Top truncates the names to 15 characters. The CPU-hogging program is actually update-apt-xapian-index. I’d never heard of it before, but it was sure cranking away. (Type ‘q’ to quit Top.) I looked up Xapian and found this description:
Xapian is an Open Source Search Engine Library, released under the GPL. It’s written in C++, with bindings to allow use from Perl, Python, PHP, Java, Tcl, C# and Ruby (so far!)
Xapian is a highly adaptable toolkit which allows developers to easily add advanced indexing and search facilities to their own applications. It supports the Probabilistic Information Retrieval model and also supports a rich set of boolean query operators.
So, why do I care and how do I make it go away? As it turned out, answering the second question would answer the first question. First, I purged the installed package from the terminal:
sudo aptitude purge apt-xapian-index
That got rid of the program, its settings, and its huge database, the latter located at /var/lib/apt-xapian-update/. It was still running in memory, though, sucking up 100% of one of the cores, so I had to kill the process. You can do this in System Monitor by selecting the offending process and clicking on End Process. Or, in the terminal:
sudo kill PID (where PID is the n umber from the first column in Top on xapian’s line, 13448 in the screenshot above)
One problem, though. After deleting the program, the Quick Search box no longer worked in Synaptic Package Manager. Oops. So, I reinstalled xapian:
sudo aptitude install apt-xapian-index
which restored the full Synaptic Quick Search function. But, I also had the bad program back. So, I tried the next step, which was to rename the executable:
sudo mv /usr/sbin/update-apt-xapian-index /usr/sbin/update-apt-xapian-index.stop
That would keep it from loading. But…same problem with Synaptic. Hmmm. After changing the name back, the next step was to find out who was telling the indexer to run and try to stop it there. It turns out that it installs itself to run weekly by adding a script to /etc/cron.weekly/. That’s easy to fix simply by making the script non-executable:
sudo chmod 644 /etc/cron.weekly/apt-xapian-index
That preserves the installation, just keeps it from being called to execute without my explicit permission. I thought that this worked like a champ, but a week later it was back.
So, I moved the script to execute only monthly:
sudo mv /etc/cron.weekly/apt-xapian-index /etc/cron.monthly/apt-xapian-index
At least it won’t eat up the CPU time quite so often. In the meantime, there is a bug files in launchpad on the problem, so maybe it will get fixed.