Flatpak Search not working on Oracle Linux/Red Hat 9.4

Introduction

Hey everyone, while setting up Oracle Linux 9.4, I ran into a frustrating issue: the flatpak search command wasn’t functioning as expected. This can be a real roadblock if you rely on flatpaks for managing applications. Let’s dive into the problem and explore solutions.

The Error

When attempting to search for the popular remote desktop client Remmina using the command:

Bash

[root@dell7420 testuser]# flatpak search remmina

The following error message pops up:

F: Failed to parse /var/lib/flatpak/appstream/flathub/x86_64/active/appstream.xml.gz file: Error on line 4875 char 29: <p> already set '
Organic Maps is a free Android & iOS offline maps app for travelers,
tourists, hikers, drivers and cyclists.
It uses crowd-sourced OpenStreetMap data and is developed with love by
' and tried to replace with ' ('
No matches found

Understanding the Problem

This error indicates a corrupted or malformed app stream file, specifically the appstream.xml.gz file located at /var/lib/flatpak/appstream/flathub/x86_64/active/. The app stream is a database used by flatpak to manage software information.

The issue seems to be that the <code> and <em> tags are not being handled correctly within the appstream.xml file. As a result, I followed these steps to resolve the problem:

  1. Copy the appstream.xml.gz file to a temporary directory:
    cp /var/lib/flatpak/appstream/flathub/x86_64/active/appstream.xml.gz /tmp
  2. Unzip the appstream.xml.gz file:
    gunzip /tmp/appstream.xml.gz
  3. Use the sed command to remove the <code> and <em> tags from the appstream.xml file:
    sed -i 's/<\/\?code>//g; s/<\/\?em>//g' /tmp/appstream.xml
  4. Re-zip the appstream.xml file:
    gzip /tmp/appstream.xml
  5. Copy the modified appstream.xml.gz file back to its original location:
    cp /tmp/appstream.xml.gz /var/lib/flatpak/appstream/flathub/x86_64/active/appstream.xml.gz

    Now the flatpak search will work.
    According to the Red Hat Jira bug, this issue will be resolved in Red Hat 9.5 and consequently also in Oracle Linux 9.5. This represents a permanent solution to the problem, however, it is not yet available at the time of writing.

Leave a Reply

Your email address will not be published. Required fields are marked *