APT update error from fwupd.xml

Solution 1:

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.

Solution 2:

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.

Solution 3:

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.