APT – How to Fix appstreamcli Hanging with 100% CPU Usage During Update

appstreamaptcpu loadgnome-software

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?

Best Answer

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

Related Question