5

Ubuntu 16.04

I'm getting this apt update error:

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

I have previously run:

sudo apt install appstream/xenial-backports
sudo apt update
sudo apt upgrade

The above error still exists.

Zanna
  • 69,223
  • 56
  • 216
  • 327
user142377
  • 101
  • 1
  • 4
  • 1
    `appstream` has been known to mess up the `fwupd.xml` file...Do you have any custom data in it? if not, you can just delete it and try to update. Maybe you can even see what the error is, manually correct it, and notify the developer at [github](https://github.com/hughsie/fwupd). – Jos Jul 10 '18 at 13:23
  • 3
    Possible duplicate of [how I can fix "AppStream cache update completed, but some metadata was ignored due to errors."?"](https://askubuntu.com/questions/854168/how-i-can-fix-appstream-cache-update-completed-but-some-metadata-was-ignored-d) – Panther Jul 10 '18 at 13:37
  • 2
    answers in https://askubuntu.com/questions/854168/how-i-can-fix-appstream-cache-update-completed-but-some-metadata-was-ignored-d have not worked. Deleting fwupd.xml did work. – user142377 Jul 10 '18 at 16:22
  • I suggest you add this finding either as an answer to the proposed duplicate, or as an answer to this question here (your own) below, if you do not consider it to be the same problem. I voted to leave open in the meantime – Zanna Jul 10 '18 at 17:28
  • 1
    Today there was a new /var/cache/app-info/xmls/fwupd.xml causing the same issue, so the issue is not solved. – user142377 Jul 11 '18 at 15:50
  • 2
    Possible duplicate of [Ubuntu 16.04: appstreamcli error while get-update](https://askubuntu.com/questions/894519/ubuntu-16-04-appstreamcli-error-while-get-update) – geras Aug 03 '18 at 19:33
  • There's this about [replacing with libappstream-glib8 for xenial with libappstream-glib8 for bionic](https://ubuntuforums.org/showthread.php?t=2395753&p=13784553#post13784553) however this is my main machine and not prepared to experiment. – user142377 Aug 08 '18 at 02:19

3 Answers3

5

Following the comments, what solved this for me was:

# rm /var/cache/app-info/xmls/fwupd.xml
# appstreamcli refresh --force
AppStream cache update completed successfully.
# apt update

Everything seems fine now.


Should also add that I have version 0.10.6 installed from xenial/back-ports.

smac89
  • 813
  • 2
  • 12
  • 19
  • Hope you're more lucky than me. Tried that a few weeks ago, then it *appeared* to be fixed, but the problem was back after a few days. – Déjà vu Jul 24 '18 at 17:28
  • @RingØ In that case, fingers crossed but so far so good – smac89 Jul 24 '18 at 17:38
  • Unfortunately, after a shutdown and restart a few hours later the problem is back. – Déjà vu Jul 25 '18 at 00:33
  • @RingØ What version do you have? Mine is `AppStream CLI tool version: 0.10.6` – smac89 Jul 25 '18 at 00:45
  • The same on ubuntu 16.04 fully patched. Did you do a cold shutdown, then restart after some time, and `apt update`? – Déjà vu Jul 25 '18 at 01:11
  • @RingØ I've simply restarted gnome-shell a number of times, but let me try full restart and see if it returns – smac89 Jul 25 '18 at 01:42
  • Restarted and still no problems after running `apt update`. I also ran `appstreamcli refresh --force`, and once again I got the same success message. If it helps I am running kernel version 4.15 (`uname -r`) – smac89 Jul 25 '18 at 02:43
1

I found that the error described in your question is caused by a typo in /var/cache/app-info/xmls/fwupd.xml.

My fix procedure:

  1. Open this file on the terminal with command sudo gedit /var/cache/app-info/xmls/fwupd.xml. I am using the gedit text editor here. You can use any text editor that you are comfortable with.
  2. Goto line 265 which says <checksum filename="Firmware_SF30&SN30_Pro_V1.26.dat" target="content" type="sha1">3ef2bdee8aca2a45b9f53b4d4cce9722523f57f8</checksum>. All I did to fix the error was to correct the typo SF30&SN30 to SF30&amp;SN30. That is the symbol & should be changed to &amp;.
  3. Finally, save the file and exit.

To check if successful, run on terminal sudo apt update. The error should not be there. But if it was still there, I ran the command appstreamcli refresh --force and then sudo apt update. By this stage, I no longer encountered the error during the same login session.

Additional notes:

  1. Sometimes, Ubuntu does notify me of new packages that are available for installation and will ask me for permission to install these new packages. After installing these new packages, I have encountered the same error messages in your question during sudo apt update. To avoid the error, I just redo the procedure as mentioned above. Hope the developers can quickly fix this bug.
  2. I have come across advice to remove files fwupd.xml and 50appstream. However, I noticed that these files contained instructions to serve certain purposes. Hence, my fix procedure did not remove those files. If you want to remove them, I suggest you make a backup of them first.
Sun Bear
  • 2,078
  • 5
  • 26
  • 70
1

After experiencing the same update issues I built a short-term solution that helps to mend the situation until developers adjust the syntax errors in the problematic XML file.

Proposed Short-Term Solution: bugfix.sh

#! /bin/bash
# bugfix.sh
#
# DESCRIPTION
#   Temporary fix for Ubuntu firmware update issues
#   Created by h8rt3rmin8r on 20180804
#
# BUG INFORMATION 
#   File location:  /var/cache/app-info/xmls/fwupd.xml
#   Line number:    265

SRC_STRING=$(sudo cat /var/cache/app-info/xmls/fwupd.xml)
OLD_SUBSTRING='Firmware_SF30&SN30_Pro_V1'
NEW_SUBSTRING='Firmware_SF30&amp;SN30_Pro_V1'

touch /dev/shm/bugfix.xml
echo ${SRC_STRING/$OLD_SUBSTRING/$NEW_SUBSTRING} > /dev/shm/bugfix.xml

sudo mv /dev/shm/bugfix.xml /var/cache/app-info/xmls/fwupd.xml

Instructions On Using bugfix.sh:

To run bugfix.sh, simply copy the code above into a new file (using a text editor like gedit) and save that file as "bugfix.sh" in a convenient location.

While located in the same directory as the bugfix.sh script, enable script execution with the following command: sudo chmod +x bugfix.sh

Run the bugfix script with the command: ./bugfix.sh

Additional Notes:

Running this script will temporarily solve the problem at hand. If the error in question pops up again at a later date then just run the script again.

For easy access you could even store this script in /usr/local/bin so you can call it directly from the terminal with bugfix.sh. Then, as long as the bug is around, you can call bugfix.sh before running sudo apt-get update && sudo apt-get -y dist-upgrade.