35

(System: 11.10 running Unity 3D)

When update-apt-xapi is running, CPU usage stays at 100% (for about a couple of minutes). Is that normal? I understand that the command runs update-apt-xapian-index to update the index of software packages.

My question is this: is such high CPU usage for a couple of minutes acceptable? (I have a Dell Inspiron 1545 laptop and the processor is "Intel® Core™2 Duo CPU T6400 @ 2.00GHz × 2 ")

If it could be harmful, what precaution can a non-technically proficient user take?

2
  • 1
    see also askubuntu.com/questions/59546/…
    – Lesmana
    Apr 24, 2012 at 19:18
  • lesmana, I've commented in that question about the possibility that update-apt-xapian-index may not be present in 12.04.
    – user25656
    Apr 25, 2012 at 2:18

5 Answers 5

16

It is completely harmless. If it were to go on and on and on, you could run:

sudo killall update-apt-xapian-index

to save your CPU from frying :D, which is only likely to be a risk when your system has bad cooling.

To answer your "sub-question", it is not really "acceptable", so much as it is not what is ideal, but it is "acceptable" in the sense that it does not stay going for long enough to cause damage :).

Pro-tip:
When this program is running, stop doing what ever it is you are doing on the computer at the time unless it is critical/important, and if you have the cpu-frequency indicator, set it to performance for the moment, and let the application run through its paces. This way, it will finish faster, and your system will be smoother to use when it's over (because of less of a lock on the resources).

5
  • Thanks! That's what I do: I close other programs, (browser, Calc, Movie Player) and wait till the CPU usage drops. It still takes one or two minutes. I have Hofmann's System Load Indicator installed.
    – user25656
    Nov 15, 2011 at 14:50
  • 1
    And even if your system did have bad cooling, running a the CPU at 100%, even constantly for months, would be very unlikely to cause problems, because the CPU's speed will decrease when the temperature gets too high, and if that is not able to happen, then the BIOS will power off the machine, unless manually configured not to. (The only damage that might result could be data loss from the machine powering off suddenly...and even that would be less likely than in a power failure, because presumably it would be done in a way that would allow hard drive read/write heads to come to rest.) Nov 16, 2011 at 3:36
  • 1
    @EliahKagan while that is all fine and dandy (and true) - it's not advisable to allow a laptop to get too hot for too long (some don't turn off immediately at a high temperature). The safest bet is to avoid it.
    – RolandiXor
    Nov 16, 2011 at 3:46
  • 1
    @EliahKagan my main laptop (HP dv7 1020us) is an example. Heat killed my battery twice. Now stop, thanks.
    – RolandiXor
    Nov 16, 2011 at 3:50
  • 1
    as always..you are great..!!! +1
    – Prasad RD
    Aug 23, 2012 at 12:40
10

Could only be solved satisfactory with:

apt-get purge apt-xapian-index

This removed the faulty program from the system and I trust my laptop will not start to use 100% CPU and simultaneously trash hard drives again.

1
  • what's apt-xapian-index? Aug 3, 2020 at 10:15
4

Listing some alternatives to the package removal solution.

  • You can make /etc/cron.weekly/apt-xapian-index-update non-executable:

    chmod a-x /etc/cron.weekly/apt-xapian-index-update

  • Alternatively, edit that script to pass the parameter --update to the update-apt-xapian-index command, so that it will update the index rather than rebuilding it. (For example, on 13.04, replace the parts $CMD --quiet with $CMD --update --quiet) (Source)

Note that removing the package (or preventing its execution) will not break the system, but it will slow down searches in Synaptic and APT. See also: "What kind of harm there is from removing (purging) package apt-xapian-index?"

3

Agreed that having your CPU usage at 100% for several minutes will not cause any harm.

You can always use:

acpi -tf

to check the systems temperature, if you are concerned.

Also, instead of killing the process you may want to try adjusting the priority of the process.

First find the process id:

pgrep update-apt-xapian-index

Then set the priority (-20 is highest and 19 is lowest):

renice 19 -p PID

That would set the update process to the lowest priority. It would take longer to finish, but would make the system usable while it is running.

5
  • Wouldn't I have to do that each time? I was wondering if it were possible to adjust the "niceness" once and for all.
    – user25656
    Nov 15, 2011 at 14:45
  • 1
    On line 463 of /etc/cron.daily/apt there should be the line nice ionice -c3 update-apt-xapian-index -q $xapian_extra_args, changing it to nice -n 19 ionice -c3 update-apt-xapian-index -q $xapian_extra_args. I am pretty sure this is where the index in launched from.
    – dpendolino
    Nov 15, 2011 at 15:22
  • @dpendolino Nice find, thanks. I'll have to try that. Nov 15, 2011 at 20:53
  • Unfortunately, that doesn't solve the problem either. :~( Nov 19, 2011 at 9:47
  • The nice and ionice fix was integrated in /ect/cron.weekly/apt-xapian-index, according to this forum post.
    – ignis
    Oct 14, 2013 at 18:48
2

I have run across an article which gives the code for making update-apt-xapi play nice, and reduce CPU usage. Read it here.

I haven't tested it personally yet, but I'm about to -- and the comment thread gives evidence of positive results.

Update - the article linked provides some lines to add/modify in the cron file to reduce CPU during update. As it turned out, those lines were already present in my case, so no help for me there. Might make a difference for others.

2
  • Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
    – RolandiXor
    Aug 23, 2012 at 14:11
  • 1
    @RolandTaylor - good point! updated entry.
    – Dɑvïd
    Aug 26, 2012 at 16:33

You must log in to answer this question.