flatpak a flathub pre PostmarketOS

flatpak a flathub pre PostmarketOS

Setup / Installation

Runtime dependencies

Note: If you are running a window manager from .xinitrc, make sure you are running a dbus session explicitly, i.e.:

# exec dbus-launch --exit-with-session your_favourite_wm

Installing Flatpak Itself

From: https://flatpak.org/setup/Alpine/

Note: To install Flatpak you will need to enable the Community repository, See: Repositories - Managing repositories

To install Flatpak run:

# apk add flatpak

Next you need to add a repository, for this guide we will use the recommended repository, Flathub.

$ flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

Now reboot to complete setup

Note: graphical installation of Flatpak apps may not be possible with Alpine.

Usage

To get all of the available options to use with the flatpak command run: flatpak --help or flatpak -h,

 

Search

To search for applications run flatpak search

Example:

~$ flatpak search chromium Name Description Application ID Version Branch Remotes Chromium Web Browser The web browser from Chromium project org.chromium.Chromium 96.0.4664.93 stable flathub Chromium B.S.U. Fast paced, arcade-style, top-scrolling space shooter net.sourceforge.chromium-bsu 0.9.16.1 stable flathub ungoogled-chromium A lightweight approach to removing Google web service dependency com.github.Eloston.UngoogledChromium 96.0.4664.45 stable flathub

 

Install

To install a package run flatpak install

~$ flatpak install com.github.Eloston.UngoogledChromium Looking for matches… com.github.Eloston.UngoogledChromium permissions: ipc network cups pulseaudio wayland x11 devices file access [1] dbus access [2] bus ownership [3] system dbus access [4] [1] /run/.heim_org.h5l.kcm-socket, home, xdg-run/pipewire-0 [2] org.freedesktop.FileManager1, org.freedesktop.Notifications, org.freedesktop.secrets, org.gnome.SessionManager [3] org.mpris.MediaPlayer2.chromium.* [4] org.freedesktop.Avahi, org.freedesktop.UPower ID Branch Op Remote Download 1. com.github.Eloston.UngoogledChromium.Codecs stable i flathub < 1.1 MB 2. com.github.Eloston.UngoogledChromium.Locale stable i flathub < 112.8 kB 3. com.github.Eloston.UngoogledChromium stable i flathub < 119.0 MB Proceed with these changes to the system installation? [Y/n]:

or if you dont know or dont want to type the exact package name:

~$ flatpak install chromium Looking for matches… Similar refs found for ‘chromium’ in remote ‘flathub’ (system): 1) app/net.sourceforge.chromium-bsu/x86_64/stable 2) runtime/com.github.Eloston.UngoogledChromium.Codecs/x86_64/stable 3) runtime/org.chromium.Chromium.Codecs/x86_64/stable 4) app/org.chromium.Chromium/x86_64/stable 5) app/com.github.Eloston.UngoogledChromium/x86_64/stable Which do you want to use (0 to abort)? [0-5]:

 

Remove

To remove a package run: flatpak remove

~$ flatpak remove com.github.Eloston.UngoogledChromium ID Branch Op 1. com.github.Eloston.UngoogledChromium stable r 2. com.github.Eloston.UngoogledChromium.Codecs stable r 3. com.github.Eloston.UngoogledChromium.Locale stable r Proceed with these changes to the system installation? [Y/n]:


or if you dont know or dont want to type the exact package name:

~$ flatpak remove chromium Similar installed refs found for ‘chromium’: 1) app/com.github.Eloston.UngoogledChromium/x86_64/stable (system) 2) runtime/com.github.Eloston.UngoogledChromium.Codecs/x86_64/stable (system) 3) All of the above Which do you want to use (0 to abort)? [0-3]:

 

Použitie:
  flatpak [VOĽBA…] PRÍKAZ

Vstavané príkazy:
 Manage installed applications and runtimes
  install                Install an application or runtime
  update                 Update an installed application or runtime
  uninstall              Uninstall an installed application or runtime
  mask                   Mask out updates and automatic installation
  pin                    Pin a runtime to prevent automatic removal
  list                   List installed apps and/or runtimes
  info                   Show info for installed app or runtime
  history                Show history
  config                 Configure flatpak
  repair                 Repair flatpak installation
  create-usb             Put applications or runtimes onto removable media

 Find applications and runtimes
  search                 Search for remote apps/runtimes

 Manage running applications
  run                    Spustí aplikáciu
  override               Override permissions for an application
  make-current           Specify default version to run
  enter                  Enter the namespace of a running application
  ps                     Enumerate running applications
  kill                   Stop a running application

Správa prístupu k súborom
  documents              List exported files
  document-export        Udelí aplikácii prístup k určenému súboru
  document-unexport      Revoke access to a specific file
  document-info          Show information about a specific file

Manage dynamic permissions
  permissions            List permissions
  permission-remove      Remove item from permission store
  permission-set         Set permissions
  permission-show        Show app permissions
  permission-reset       Reset app permissions

Správa vzdialených repozitárov
  remotes                Zoznam všetkých konfigurovaných vzdialených repozitárov
  remote-add             Add a new remote repository (by URL)
  remote-modify          Modify properties of a configured remote
  remote-delete          Delete a configured remote
  remote-ls              List contents of a configured remote
  remote-info            Show information about a remote app or runtime

Zostavenie aplikácií
  build-init             Initialize a directory for building
  build                  Run a build command inside the build dir
  build-finish           Finish a build dir for export
  build-export           Exportuje adresár zostavenia do repozitára
  build-bundle           Create a bundle file from a ref in a local repository
  build-import-bundle    Importuje súbor balíka
  build-sign             Podpíše aplikáciu alebo prostredie
  build-update-repo      Aktualizuje súbor zhrnutia v repozitári
  build-commit-from      Create new commit based on existing ref
  repo                   Show information about a repo

Voľby pomocníka:
  -h, --help              Zobrazí voľby pomocníka

Voľby aplikácie:
  --version               Vypíše informácie o verzii a skončí
  --default-arch          Vypíše predvolenú architektúru a skončí
  --supported-arches      Vypíše podporované architektúry a skončí
  --gl-drivers            Print active gl drivers and exit
  --installations         Print paths for system installations and exit
  --print-updated-env     Print the updated environment needed to run flatpaks
  --print-system-only     Only include the system installation with --print-updated-env
  -v, --verbose           Show debug information, -vv for more detail
  --ostree-verbose        Show OSTree debug information



After lots of internet searches and abortive attempts to resolve this, I discovered the problem. Basically, I did not actually have flatpak’s public GPG key. Fortunately the solution is trivially easy.

First you need to download flatpak’s public key file…

wget https://flathub.org/repo/flathub.gpg

This returns something that looks similar to this…

--2022-02-01 17:16:26-- https://flathub.org/repo/flathub.gpg
Resolving flathub.org (flathub.org)... 46.235.231.150, 46.235.230.111, 2a00:1098:82:e::1:1, ...
Connecting to flathub.org (flathub.org)|46.235.231.150|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2844 (2.8K) [application/octet-stream]
Saving to: ‘flathub.gpg’

flathub.gpg 100%[=====================================================>] 2.78K --.-KB/s in 0s
2022-02-01 17:16:26 (457 MB/s) - ‘flathub.gpg’ saved [2844/2844]

Copy and rename the key to correct location(s). If you intend to use flatpak’s “beta” repository then you need to copy a keyfile for that too.

cp flathub.gpg ~/.local/share/flatpak/repo/flathub.trustedkeys.gpg
cp flathub.gpg ~/.local/share/flatpak/repo/flathub-beta.trustedkeys.gpg

Make sure the keyfiles are actually where they should be…

ls -la ~/.local/share/flatpak/repo/*.trustedkeys.gpg

Should return something similar to this…

-rw-rw-r-- 1 garf garf 2844 Feb 1 17:41 
/home/garf/.local/share/flatpak/repo/flathub-beta.trustedkeys.gpg
-rw-rw-r-- 1 garf garf 2844 Feb 1 17:37 
/home/garf/.local/share/flatpak/repo/flathub.trustedkeys.gpg

That’s it! No more Flatpak public key error. You should now be able to install Flatpak applications to your home directory as intended. ????

Marek Mihók