Skip to content

Instantly share code, notes, and snippets.

@jackpot51
Created March 19, 2020 21:16
Show Gist options
  • Save jackpot51/d6d9a511dc15ad0fb6aad7208371c3e4 to your computer and use it in GitHub Desktop.
Save jackpot51/d6d9a511dc15ad0fb6aad7208371c3e4 to your computer and use it in GitHub Desktop.
Flatpak/Flathub Evaluation

Flatpak/Flathub Evaluation

Note that I will use flatpak to refer to the format, and flathub to refer to the flathub repository and packaging done by the flathub organization.

General

Command Line Use

There is basically no supported command line use for flatpak applications. There are indications that this is by design: flatpak/flatpak#1254 The easiest thing you can do is to add $HOME/.local/share/flatpak/exports/bin/ to your PATH, but then you need to use the fully qualified reverse domain name of the application, which isn't visible anywhere in any interface other than flatpak list --app, such as io.atom.Atom.

Some applications like KiCad have multiple binaries, for example, eeschema is the schematic editor, pcbnew is the PCB editor, and kicad is used to load projects. For scripting purposes it is useful to be able to call these binaries in an automatic way that works regardless of how KiCad is installed. See this Makefile for thelio-io as an example: https://github.com/system76/thelio-io-hardware/blob/a8e166cec9112d38d2bbe31a314689a8d7723ac8/Makefile#L48 What this does is call kicad2step, which is provided by KiCad, in order to generate CAD files automatically. Using the flathub version of KiCad, it is not clear how this process works, since this binary is not exported, and even if it were, you would have to detect that the user has installed it as a flatpak, for every single binary that you want to call.

Additionally, tools like FreeCad, OpenSCAD, and KiCad provide python libraries for advanced scripting. These libraries are not exported in any visible way. Here is an example of the use of the KiCad pcbnew library to generate manufacturing files automatically: https://github.com/system76/thelio-io-hardware/blob/a8e166cec9112d38d2bbe31a314689a8d7723ac8/script/plot This is not possible at all with a flatpak installation.

I added the following to my .bash_aliases to enable tools like Atom and Meld to be used with the commands atom and meld from the command line. This only works when using bash, so it cannot be used to fix the inability to discover binaries when using Makefiles, or scripts in languages like Python.

if command -v flatpak > /dev/null
then
    # Get a list of flatpak applications in the reverse domain name format
    readarray -t ids < <(flatpak list --app --columns=application)
    for id in "${ids[@]}"
    do
        # Take everything past the last dot (the name)
        name="${id##*.}"
        # Make it lowercase to approximate binary name
        binary="${name,,}"

        # If there is not already a command at that name
        if ! command -v "${binary}" > /dev/null
        then
            # Create an alias that runs the flatpak
            alias "$binary=flatpak run \"$id\""
        fi
    done
fi

Reliability

Installing a large application from flatpak can sometimes fail. Installing KiCad requires about 950 MB of data, since it includes all footprints and 3D models in one package. On several reinstalls it was not successful for me:

$ flatpak install org.kicad_pcb.KiCad
Looking for matches…
Found similar ref(s) for ‘org.kicad_pcb.KiCad’ in remote ‘flathub’ (user).
Use this remote? [Y/n]:


org.kicad_pcb.KiCad permissions:
    ipc   network   x11   dri   file access [1]

    [1] home

        ID                           Branch          Op         Remote          Download
 1. [✗] org.kicad_pcb.KiCad          stable          i          flathub         15.2 MB / 946.9 MB

Error: While pulling app/org.kicad_pcb.KiCad/x86_64/stable from remote flathub: Connection terminated unexpectedly
error: Failed to install org.kicad_pcb.KiCad: While pulling app/org.kicad_pcb.KiCad/x86_64/stable from remote flathub: Connection terminated unexpectedly

I tried again, leading to the following:

$ flatpak install org.kicad_pcb.KiCad
Looking for matches…
Found similar ref(s) for ‘org.kicad_pcb.KiCad’ in remote ‘flathub’ (user).
Use this remote? [Y/n]: Y

org.kicad_pcb.KiCad permissions:
    ipc   network   x11   dri   file access [1]

    [1] home


        ID                           Branch          Op         Remote          Download
 1. [✗] org.kicad_pcb.KiCad          stable          i          flathub         1.0 kB / 946.9 MB

Error: While trying to checkout a5ab7cc172d32a150ca2107cb4dace4ea5ca5a1205c22bc649aed9c0ed78024c into /home/jeremy/.local/share/flatpak/app/org.kicad_pcb.KiCad/x86_64/stable/.a5ab7cc172d32a150ca2107cb4dace4ea5ca5a1205c22bc649aed9c0ed78024c-5H0PH0: Opening content object 188f46fa5cb8c277f74ea5fafe913f261bfb8ccc7268c85c4596de886ce11517: Couldn't find file object '188f46fa5cb8c277f74ea5fafe913f261bfb8ccc7268c85c4596de886ce11517'
error: Failed to install org.kicad_pcb.KiCad: While trying to checkout a5ab7cc172d32a150ca2107cb4dace4ea5ca5a1205c22bc649aed9c0ed78024c into /home/jeremy/.local/share/flatpak/app/org.kicad_pcb.KiCad/x86_64/stable/.a5ab7cc172d32a150ca2107cb4dace4ea5ca5a1205c22bc649aed9c0ed78024c-5H0PH0: Opening content object 188f46fa5cb8c277f74ea5fafe913f261bfb8ccc7268c85c4596de886ce11517: Couldn't find file object '188f46fa5cb8c277f74ea5fafe913f261bfb8ccc7268c85c4596de886ce11517'

In order to fix this, I had to run the following, after installing ostree (using apt of course):

ostree fsck --repo ~/.local/share/flatpak/repo/ --delete

After this, I ended up with another error:

3 partial commits not verified
error: Repository corruption encountered

I tried again, and had the same error as the very first time. A few times I even got a 503 error:

$ flatpak install org.kicad_pcb.KiCad
Looking for matches…
Found similar ref(s) for ‘org.kicad_pcb.KiCad’ in remote ‘flathub’ (user).
Use this remote? [Y/n]:

org.kicad_pcb.KiCad permissions:
    ipc   network   x11   dri   file access [1]

    [1] home


        ID                           Branch          Op         Remote          Download
 1. [✗] org.kicad_pcb.KiCad          stable          i          flathub         30.9 MB / 946.9 MB

Error: While pulling app/org.kicad_pcb.KiCad/x86_64/stable from remote flathub: Server returned status 503: Service Unavailable
error: Failed to install org.kicad_pcb.KiCad: While pulling app/org.kicad_pcb.KiCad/x86_64/stable from remote flathub: Server returned status 503: Service Unavailable

None of these errors make it to the Pop!_Shop interface, it silently cancels the installation and shows the Install button is clickable again.

Size

Flatpak applications can impose significant disk space requirements, due to requiring an entire container runtime that may be different for each application, in addition to duplicates of GTK themes and NVIDIA driver packages. This also makes installation very slow. Installing the first flatpak application requires 650 MB on an NVIDIA system, and took around ten minutes to install. My connection is 250 Mbps, but flathub only delivered about 5 Mbps on average, with a maximum of about 10 Mbps, measured with nethogs. This is on par with Ubuntu's repos, unfortunately, but much slower than our proprietary repo.

Theming

Theming is broken, and will become more broken over time. Setting a GTK theme, for example, selecting the dark theme, only appears to work if you are running GNOME. Running GTK applications natively on other window managers selects the correct theme, but in flatpak they are always using Adwaita. This can be particularly jarring when using the dark theme at night. This problem occurs on the majority of the applications I have tested.

Also, the way the Pop theme is added is to install this package, which is thankfully done automatically: https://github.com/flathub/org.gtk.Gtk3theme.Pop However, this version of the GTK theme is based on GTK 3.34, and is only guaranteed to work with flatpak applications that are also targetting GTK 3.34. When 3.36 becomes the most popular GNOME release, after Ubuntu 20.04 is released, the default target of many, but not all of these apps will likely change. This means theme issues absolutely will occur if we have either the 3.34 or 3.36 versions of the theme available, since you cannot provide more than one version of a theme package as far as I have seen. I believe this is handled seamlessly with Adwaita since it is packaged as part of the GTK platform that the application targets.

Also, updates to the GTK theme must be done manually via a pull request to that repository. Currently we have a version of the 3.34 theme (for 19.10) from around mid-October, the release date of 19.10. Any fixes to this theme are not present in the flathub version, and again, this theme version will not work correctly with flatpak applications that use the GTK platform older or newer than 3.34. We need to verify that this is the case. Potentially we can provide different themes based on the version of the GTK runtime used.

Specific Application Issues

Atom

Atom worked fairly well. One exception is the built-in git diff tool, which allows for review and selective commits of changes. This tool breaks constantly on the flathub version.

We definitely need to update our Pop!_OS version (1.26.0), as the flathub version (1.45.0) is newer.

Blender

I did not test Blender that much. There is a python API which will not be accessible when using the flathub version as described above. I don't know how much it is used. https://docs.blender.org/api/current/index.html

Ubuntu 20.04 version (2.82a) is currently newer than flathub version (2.81a)

Cheese

No issues other than general issues above.

Ubuntu 20.04 version (3.36.0) is currently newer than the flathub version (3.34.0).

Dconf Editor

No issues other than general issues above.

Ubuntu 20.04 version (3.36.0) is currently newer than the flathub version (3.34.3).

D-Feet

No issues other than general issues above.

Ubuntu 20.04 version (0.3.15) is identical to the flathub version (0.3.15).

FlightGear

Did not launch with the flathub version.

Ubuntu 20.04 version (2019.1.1) is newer than the flathub version (2018.3.2).

GNOME Hex Editor

This one was particularly painfully bright when using Adwaita. No issues other than the general issues above.

Ubuntu 20.04 version (3.18.4) is identical to the flathub version (3.18.4).

GIMP

Scripting is an important part of the GIMP workflow. It is not obvious how to install plugins or how to use the scripting API exposed by GIMP when using the flathub version. https://docs.gimp.org/en/gimp-scripting.html

Ubuntu 20.04 version (2.10.14) is older than the flathub version (2.10.18). The Ubuntu version does not appear in Pop!_Shop on 20.04.

Inkscape

Scripted use of inkscape is used to generate the Pop icon theme. This is not feasible when using the flathub version.

Ubuntu 20.04 version (0.92.3) is older than the flathub version (0.92.4).

KiCad

I used KiCad as an example above, please read those.

Ubuntu 20.04 version (5.1.5) is identical to the flathub version (5.1.5). The Ubuntu version does not appear in Pop!_Shop on 20.04.

LibreOffice

No issues other than general issues above.

Ubuntu 20.04 version (6.4.0) is older than the flathub version (6.4.1.2).

Meld

I was not able to use meld as a git difftool when using the flathub version.

Ubuntu 20.04 version (3.20.2) is identical to the flathub version (3.20.2).

Steam

Launched multiple times after install asking for login information. Unable to set up a steam directory on an external drive.

Pop!_OS version (1.0.0.59) is older than the flathub version (1.0.0.61).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment