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.

  • 1
    Unfortunately the file reverts to the original &-containing string when fwupdmgr refreshes. – ricab Jul 13 '18 at 12:51
  • yeah.. didn't think about that. – Nikola Jul 16 '18 at 9:06
  • 1
    Thanks. I explained my learning and implementing your solution here. In short, need to open /var/cache/app-info/xmls/fwupd.xml with either sudo gedit or sudo nano and goto line 256 and change the & symbol to &amp;, and save the file. During sudo apt update, the error will disappear. My system is using libappstream4 package. – Sun Bear Jul 23 '18 at 15:37

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

While this is not backported to xenial, one can upgrade libappstream-glib8 to the version in bionic and set up to receive upgrades for this package (but not the rest) from bionic.


If you find yourself in one of the cases marked ABORT, just undo all the steps you did so far and run sudo apt update at the end (I don't expect that to happen though, they are just there as a safeguard).

  1. save a file called (say) future.list in dir /etc/apt/sources.list.d (you'll need sudo) with the following content:

    deb mirror://mirrors.ubuntu.com/mirrors.txt bionic main
    deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates main
    deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-security main
  2. save a file called (say) future.pref in dir /etc/apt/preferences.d (you'll need sudo again) with the following content:

    Package: *
    Pin: release a=bionic*
    Pin-Priority: 50
  3. sudo apt update

  4. apt list -u and confirm it returns only "Listing... Done". If it returns more stuff, ABORT (see above).
  5. sudo apt install -assume-no -t=bionic libappstream-glib8. If, at this stage, apt claims that more is needed to satisfy dependencies than just replacing the old version with the new one, ABORT (see above).
  6. sudo mv /var/cache/app-info/xmls/fwupd.xml ~/fwupd.xml.bck
  7. restart (I found this was required, probably to load the new shared library version, maybe restart some service)
  8. sudo fwupdmgr refresh
  9. sudo appstreamcli refresh

Not the answer you're looking for? Browse other questions tagged or ask your own question.