Flatpak

From Alpine Linux
Revision as of 12:51, 23 December 2021 by Eddsalkield (talk | contribs) (→‎Setup / Installation: Fix instructions for local user accounts)
This material is work-in-progress ...

More documentation and testing is needed, but everything currently here should be safe to follow.
(Last edited by Eddsalkield on 23 Dec 2021.)

Flatpak is a technology for building and distributing applications with the goal of having a universal package format for all Linux distributons, it is similar to Snap,


Setup / Installation

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

To install Flatpak you will need to enable the Community repository, See: Post Installation - Repositories

To install Flatpak run:

# apk add flatpak

It's recommended to run flatpak as your user, rather than as root. Therefore, add your user to the flatpak group:

# adduser <YourUsername> 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 <appplicationname>

Example:

Contents of 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 <applicationname>

Contents of $ 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:

Contents of $ 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 <applicationname>

Contents of $ 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:

Contents of $ 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]:


Developers

These are all hosted on Flathub.org.

Troubleshooting

Permission errors

If you receive errors about permissions then you may need to add your user to the flatpak group:

adduser <YourUsername> flatpak


Note: You may need to log out and log back in or reboot for the group change(s) to take effect



Fixing audio issues

If you have a minimal setup and don't have access to audio devices you will need to set the XDG_RUNTIME_DIR variable. Save the following script in /etc/profile.d/xdg_runtime_dir.sh and re-login to have it set up properly.

if test -z "${XDG_RUNTIME_DIR}"; then
  export XDG_RUNTIME_DIR=/tmp/$(id -u)
fi

When you launch a Flatpak you will need to start pulseaudio as well:

pulseaudio --start && flatpak run com.example.Example


Links


See Also