13

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.

Hannu
  • 5,374
  • 1
  • 23
  • 40
  • 4
    Sorry, seems to be the same, the remedies described does not help. A "purge" on the package is not a remedy. – Hannu Jul 02 '18 at 15:59
  • 1
    It is... Purge and re-install. – Fabby Jul 02 '18 at 18:59
  • 1
    Have you tried reinstalling e.g. sudo apt install --reinstall libappstream3? – Bprodz Jul 03 '18 at 10:27
  • Brods your answer solved this for me. strange though when i attempted to remove it manually it said it was not installed, surely it must have been at some point otherwise i would not be getting updates at all? anyway im fixed. – CodingInTheUK Jul 04 '18 at 06:06
  • 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 04 '18 at 17:12
  • 2
    The actual fwupd bug: https://github.com/hughsie/lvfs-website/issues/33 – ricab Jul 04 '18 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 04 '18 at 21:07
  • Sorry, but this does not look like a complete duplicate of the page where one gets redirected to clicking in the yellow box on top of this page.. But I did place my answer over there in the hope it helps someone. Took me a while to figure out, since all info is found at different places. I just compiled ;-) it to a whole plan to refresh the cache. – Marcellus Jul 10 '18 at 14:46
  • 12
    https://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 '18 at 08:01
  • 1
    Seems this one comes back whatever you do; temporay fixes -> https://askubuntu.com/a/1059935 – Hannu Aug 11 '18 at 21:13
  • @Confusion: Yes. I agree. I just found and fixed this using xmlwf utility from expat package. In brief, install expat if not installed and run: xmlwf /var/cache/app-info/xmls/fwupd.xml /var/cache/app-info/xmls/fwupd.xml:265:60: not well-formed (invalid token) – user3183018 Oct 27 '18 at 05:40

2 Answers2

4

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
0

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