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


** (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.

  • 4
    Sorry, seems to be the same, the remedies described does not help. A "purge" on the package is not a remedy.
    – Hannu
    Jul 2, 2018 at 15:59
  • 3
    I believe this is a different problem. The OP's appstream version (0.10.6) depends on libappstream4. I have the same issue and libappstream3 is not installed. Installing it does not fix the issue. Reinstalling libappstream4 does not fix the issue either. Nor does reinstalling appstream completely
    – ricab
    Jul 4, 2018 at 17:12
  • 2
    The actual fwupd bug: github.com/hughsie/lvfs-website/issues/33
    – ricab
    Jul 4, 2018 at 20:42
  • 4
    @karel et al this is not a duplicate, it is caused by a problem in fwupd that can't be fixed by purges and reinstalls. According to the authors a backport is needed in ubuntu.
    – ricab
    Jul 4, 2018 at 21:07
  • 12
    askubuntu.com/a/1053018/28943 actually contains the answer: manually edit /var/cache/app-info/xmls/fwupd.xml to replace the & by &amp; (in line 265 in my version)
    – Confusion
    Jul 13, 2018 at 8:01

2 Answers 2


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

To add to Frederik's answer above: The second number after the colon refers to the column where the error is. I also had an issue with the & character. Removing it solved it for me.

You can go directly to the line with vim by entering:

sudo vim +<LINE_NUMBER> /var/cache/app-info/xmls/fwupd.xml

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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