appstreamcli hanging with 100% CPU usage during update

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


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