Ubuntu 16.04: appstreamcli error while get-update [duplicate]

I am trying to enable WiFi. I tried sudo apt-get update. But I am getting this error:

The AppStream system cache was updated, but some errors were detected, which might lead to missing metadata. Refer to the verbose log for more information.
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-cache > /dev/null; fi'
E: Sub-process returned an error code

How can I complete sudo apt-get update and enable Wifi in Ubuntu-16.04?


I have had the same problem and the problem was that there was (in my case) an inappropriately escaped character in file /var/cache/app-info/xmls/fwupd.xml in line 265 which broke the xml, hence the error. In line <checksum filename="Firmware_SF30&SN30_Pro_V1.26.dat" target="content" type="sha1">3ef2bdee8aca2a45b9f53b4d4cce9722523f57f8</checksum> the & symbol must be encoded &amp; for this to be a valid xml.


A similar bug was reported here

This answer suggested the below in order to solve it (a few people said that it helped them):

Removing /usr/bin/appstreamcli is fine if you install the fixed package afterwards.

To install this manually, please do (for amd64, adjust URLs for other architectures):

cd /tmp && mkdir asfix
cd asfix
wget https://launchpad.net/ubuntu/+archive/primary/+files/appstream_0.9.4-1ubuntu1_amd64.deb
wget https://launchpad.net/ubuntu/+archive/primary/+files/libappstream3_0.9.4-1ubuntu1_amd64.deb
sudo dpkg -i *.deb