Ubuntu – appstreamcli: AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml

16.04appstreamaptupdates

How do I get rid of this?

$ sudo apt-get update
Hit:1 http://se.archive.ubuntu.com/ubuntu xenial InRelease
Hit:2 http://se.archive.ubuntu.com/ubuntu xenial-updates InRelease                                                                                             
Hit:3 http://download.virtualbox.org/virtualbox/debian xenial InRelease                                                                                        
Hit:4 http://se.archive.ubuntu.com/ubuntu xenial-backports InRelease                                                        
Hit:5 http://ppa.launchpad.net/freecad-community/ppa/ubuntu xenial InRelease                  
Get:6 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:7 http://ppa.launchpad.net/freecad-maintainers/freecad-daily/ubuntu xenial InRelease                     
Hit:8 http://ppa.launchpad.net/freecad-maintainers/freecad-stable/ubuntu xenial InRelease                      
Hit:9 http://ppa.launchpad.net/geany-dev/ppa/ubuntu xenial InRelease         
Get:10 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [517 kB]               
Hit:11 http://ppa.launchpad.net/gezakovacs/ppa/ubuntu xenial InRelease                                        
Hit:12 http://ppa.launchpad.net/otto-kesselgulasch/gimp-edge/ubuntu xenial InRelease                            
Hit:13 http://ppa.launchpad.net/pmjdebruijn/darktable-release/ubuntu xenial InRelease                          
Hit:14 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease                                       
Get:15 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [455 kB]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [221 kB]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata [67,7 kB]
Get:18 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons [68,0 kB]
Get:19 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata [107 kB]
Get:20 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons [142 kB]
Fetched 1 685 kB in 1s (969 kB/s)                                  
AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml
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

$ sudo appstreamcli --version
AppStream CLI tool version: 0.10.6

$ sudo appstreamcli refresh-cache --force --verbose
** (appstreamcli:13014): DEBUG: Added /usr/share/app-info/xmls to metadata search path.
** (appstreamcli:13014): DEBUG: Added /var/lib/app-info/yaml to metadata search path.
** (appstreamcli:13014): DEBUG: Added /var/cache/app-info/xmls to metadata search path.
** (appstreamcli:13014): DEBUG: Refreshing AppStream cache
** (appstreamcli:13014): DEBUG: Searching for data in: /usr/share/app-info/xmls
** (appstreamcli:13014): DEBUG: Searching for data in: /var/cache/app-info/xmls
** (appstreamcli:13014): DEBUG: Searching for data in: /var/lib/app-info/yaml
** (appstreamcli:13014): DEBUG: Reading: /usr/share/app-info/xmls/org.freedesktop.fwupd.xml
** (appstreamcli:13014): DEBUG: Reading: /var/cache/app-info/xmls/fwupd.xml
** (appstreamcli:13014): DEBUG: WARNING: Could not parse XML data: Entity: line 265: parser error : EntityRef: expecting ';'
        <checksum filename="Firmware_SF30&SN30_Pro_V1.26.dat" target="content" t
                                                            ^

---SNIP-------

** (appstreamcli:13014): DEBUG: system/os/package/zathura-pdf-poppler.desktop extends system/os/package/zathura.desktop, but system/os/package/zathura.desktop was not found.
** (appstreamcli:13014): DEBUG: Error while updating the in-memory data pool: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml
** (appstreamcli:13014): DEBUG: Stemming language is: en
AppStream system cache was updated, but problems were found: Metadata files have errors: /var/cache/app-info/xmls/fwupd.xml

Looking at:
Library corruption error during apt-get update
The "remedies" does not help, the problem persists.

Reading this:
Ubuntu 16.04: appstreamcli error while get-update
… sadly has an older version to download and install as remedy.

Best Answer

This requires a manual edit, due to a bug in a settings file for the fwupd package:

sudo apt install expat
xmlwf /var/cache/app-info/xmls/fwupd.xml
sudo vim /var/cache/app-info/xmls/fwupd.xml

Go to the line number given by xmlwf In my case I got

/var/cache/app-info/xmls/fwupd.xml:268:72: not well-formed (invalid token)

Replace the & character (on the line 268 in my case) with &amp;

Then you can run update again:

sudo apt update
Related Question