76

appstreamcli is overheating my laptop by constantly using 100% of a core. My only solution is to kill it. Here's a screenshot of top:

output of top showing appstreamcli with 100% cpu usage

I can kill appstreamcli with either sudo kill pid or sudo killall appstreamcli. But once I do sudo apt update, the appstreamcli process returns again and hangs the update. If I then kill it, I get the following output:

Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success
'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli;
 then appstreamcli refresh > /dev/null;
 fi'
E: Sub-process returned an error code

What is this process and why is it using so much CPU?

Hee Jin
  • 886
  • 10
  • 23
nazar2sfive
  • 1,335
  • 2
    It's a bug. See this question: http://askubuntu.com/questions/774918/apt-get-is-stuck-at-fetched-xxkb-in-xxsec – alwaysask May 20 '16 at 04:10
  • 9
    68 degrees is a good temperature to cook an egg, but you will need much higher temperatures to cook a laptop. – Michael Hampton May 20 '16 at 10:44
  • @MichaelHampton My laptop gets cooked when some dumb kernel process takes all the CPU time; it gets up to 100 degrees celcius pretty easily. Then it switches off. – cat May 20 '16 at 18:12
  • @cat Right, 100 is the magic number where your laptop is cooking. Might be worth cleaning out its fan and redoing the thermal paste on its CPU. – Michael Hampton May 20 '16 at 18:13
  • @MichaelHampton 100 is the magic number at which the CPU says, "I'm switching off or else I will Halt and Catch Fire!!!". The fan is clean and the thermal paste new, it's just old. – cat May 20 '16 at 18:15
  • Is this OS X or Ubuntu ? – Suici Doga May 21 '16 at 04:47
  • @SuiciDoga Probably Ubuntu with an OS X theme; I find it unlikely someone would have apt-get set up with the Ubuntu package repositories on a Mac, even if it is (theoretically) possible - it is a lot more work. – Thomas May 22 '16 at 06:01
  • @MichaelHampton 68 degrees it quite a good temperature.My laptop goes upto about 70 degrees when something hogs one core (like opening a binary file in gedit / scratch).My laptop goes upto 99 degrees sometimes – Suici Doga Jun 02 '16 at 01:34

2 Answers2

79

This is caused by a bug https://bugs.launchpad.net/ubuntu/+source/appstream/+bug/1579712
The working solution (just tried myself):

First kill appstreamcli, either manually or with

sudo kill -KILL $(pgrep appstreamcli)

or

sudo pkill -KILL appstreamcli

Then:

wget -P /tmp https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i /tmp/appstream_0.9.4-1ubuntu1_amd64.deb /tmp/libappstream3_0.9.4-1ubuntu1_amd64.deb

After this you will be able to proceed with apt-get update as usual

David Foerster
  • 36,264
  • 56
  • 94
  • 147
sam50
  • 701
  • 12
    Exactly my problem , but what is appstreamcli by the way ? – Charles-Antoine Fournel May 20 '16 at 07:35
  • 17
    Be careful, this works on a 64-bit system; on a 32-bit, you have to change amd64 to i386 in the links. – Rmano May 20 '16 at 08:07
  • 1
    To do after sudo kill {pid} to pass the "dpkg status database is locked by another process" error. – Andrea May 20 '16 at 09:37
  • The problem is that appstreamcli is being run as root, so to bypass the database lock, just do: sudo killall appstreamcli – notAWasp May 20 '16 at 10:06
  • 2
    Since this bug manifests itself on a very rare occasion (according to the description), the fix has to be tested through a test case. Running sudo appstreamcli refresh --force without hanging will confirm that the fix works. It worked for me. Thank you for the solution! – nolexa May 20 '16 at 10:08
  • This bug causes sudo apt-get update to fail / lock up I call this a major bug ... think about the newbies that can't use a terminal...not to mention just installing some program off a website what is this deb package doing?....ugh – Rick T May 20 '16 at 10:49
  • I've allso found out that I had an unattedned-upgd running, which is a automatic upgarde, regarding I had all 0 in /etc/apt/apt.conf.d/10* so had to uninstal that as well. https://help.ubuntu.com/lts/serverguide/automatic-updates.html – Ivan Temchenko May 20 '16 at 15:25
2

Alternatively for what ever reason, if you don't want to install an out of repo package and just wait for an update you can uninstall it completely.

This will remove Discover on KDE:Plasma so I assume it will also remove the Gnome Software, or what ever your Ubuntu Flavor adds. If this is the case you can just use Muon on Kubuntu, or Synaptic on GTK based DEs.

Before you run this make sure you check the packages being removed to make sure that is ok with you.

You can figure out what something is by running

apt show appstream

to uninstall appstream run

sudo apt remove appstream
Goddard
  • 4,724
  • 2
  • 33
  • 51