You are not logged in.

#1 2025-10-12 19:37:48

knob
Member
Registered: 2009-01-30
Posts: 51

[SOLVED] Install Flatpak apps in chroot

I am booting the live environment, then I proceed to install and configure my system and before rebooting I would like to also install some Flatpak apps.

The issue am facing is that I get this error:
Failed to install org.freedesktop.Platform.openh264: While trying to apply extra data: apply_extra script failed, exit status 256

I know I could install them after rebooting, but I have an install script and I want to automate things such that everything is ready to be used after reboot.

I've looked around and tried some things before proceeding with the flatpak install but with no success:
sysctl -w kernel.unprivileged_userns_clone=1
or
chmod u+s $(which bwrap)

All of these are happening in arch-chroot and at this point I don't know what else to do.

Last edited by knob (2025-10-14 10:06:02)

Offline

#2 2025-10-13 12:01:22

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,320

Re: [SOLVED] Install Flatpak apps in chroot

In the arch-chroot environment you are running as root , not as user.

Flatpak is designed to be run as user.

but I have an install script and I want to automate things such that everything is ready to be used after reboot.

Split off the parts related to user config and run them on first login of the user.
You could even try automatically logging in the user, running the config and then logging them out again.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2025-10-13 13:30:56

knob
Member
Registered: 2009-01-30
Posts: 51

Re: [SOLVED] Install Flatpak apps in chroot

I am actually interested in doing "flatpak install --system" such that the apps are available for all users.

Yes, that is an option, was thinking about going with a systemd one-time unit that runs before first login - though that happens after reboot.
I am also considering going with systemd-nspawn in the live environment currently instead of using arch-chroot.

Offline

#4 2025-10-13 14:00:04

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 14,320

Re: [SOLVED] Install Flatpak apps in chroot

flatpak install --system

That will mean you have 2 competing package managers on your system, pacman and flatpak.

IF you do go that route create a meta-package with conflicts for all apps you install with flatpak that are also available through pacman .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#5 2025-10-13 14:22:32

knob
Member
Registered: 2009-01-30
Posts: 51

Re: [SOLVED] Install Flatpak apps in chroot

Yes, they will be competing but I don't see them conflicting, they have different spaces - I use Flatpak for the big apps.

I managed to make it work, I did something like:

sysctl -w kernel.unprivileged_userns_clone=1
systemd-nspawn -D "/mnt" --as-pid2 --capability=all -q /bin/bash -lc "/apps.sh"

Where apps.sh is something like:

#!/usr/bin/env bash
set -eEuo pipefail

pacman -S --noconfirm flatpak xdg-desktop-portal-gtk
flatpak --system remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

chmod u+s $(which bwrap)
flatpak install -y --noninteractive --system flathub com.spotify.Client
flatpak install -y --noninteractive --system flathub com.vscodium.codium 
chmod u-s $(which bwrap)

Thank you for the suggestions.

Last edited by knob (2025-10-13 14:33:12)

Offline

Board footer

Powered by FluxBB