Runtime inside a file .flatpak

May 31, 2024
E

Can you tell me if it is possible to include a runtime (org.kde.Platform) in a.flatpak file so that the.flatpak file can also be installed on a PC that does not have an internet connection in case the runtime is not present on the machine. Basically, that the flatpak can be copied, for example, on a USB stick and installed on any PC even when you don’t have the possibility to connect to the flathub repositories to download the runtime? Of course, I realize that this will make the.flatpak file much larger.

C

No, a .flatpak bundle can only include a single ref.

As an alternative, you can use flatpak create-usb:

E
Replying to #2

Thanks for the clarification. I would also like to know if it is possible to download the flatpaks of the apps and runtimes from flathub? Because I don’t see the possibility from the site and it seems strange to me. In flatpak format obviously.

C
Replying to #3

Unlike with other package formats, .flatpak bundles are not used natively by flatpak. Flathub hosts an ostree repo that flatpak pulls from.

E

Thanks for the clarification. Honestly I find it a bit of a flaw. Just out of curiosity, does the same thing apply to Canonical’s SNAPs?

R
Replying to #5

Why?

It can also be an OCI instead of ostree Bringing OCI images to the desktop with Flatpak - Open Container Initiative

E
Replying to #6

Sorry for my ignorance, but I’m trying to understand. If I used OCI repo instead of OStree repo, could I create a .flatpak file that also brings the runtime. So that I can distribute the flatpak even on a PC that does not have the ability to access the network to download it?

R
Replying to #7

No, that’s on the repo side of things. That’s why I was confused, why you would even care or identify this as a flaw.

You can as mentioned above, just run create-usb and solve your problem.

E

I was able to use the flatpak create-usb command with these commands:

flatpak info -o org.tarro.lamiavideoteca
terminal answer: lamiavideoteca1-origin

flatpak remote-modify --collection-id=org.tarro.lamiavideoteca lamiavideoteca1-origin
flatpak create-usb ~/Scrivania/Flatpak/LaMiaVideoteca org.tarro.lamiavideoteca

An empty folder is created but it weighs about 500 Mb,

so i try to install it on a virgin PC with these commands:

flatpak remote-add --user lamiavideoteca1-origin '/home/enrico/Scrivania/Flatpak/LaMiaVideoteca' --no-gpg-verify
flatpak remote-modify --collection-id=org.tarro.lamiavideoteca lamiavideoteca1-origin
flatpak install --sideload-repo='/home/enrico/Scrivania/Flatpak/LaMiaVideoteca'
lamiavideoteca1-origin org.tarro.lamiavideoteca

the command works, but unfortunately I note with regret that the PC connects to the network to download the runtime.

R
Replying to #10

I guess you tried to package the runtime like that too?

E

razzeee
Sorry I can’t understand? You mean I have to issue the command:
flatpak create-usb ~/Scrivania/Flatpak/LaMiaVideoteca (runtime/org.kde.Platform/x86_64/6.6) after giving the command
flatpak create-usb ~/Scrivania/Flatpak/LaMiaVideoteca org.tarro.lamiavideoteca?
To include it?

E

Sorry I thought it was possible to install everything in one package (folder in this case), but I guess you can just make a flatpak create-usb for one app/runtime at a time. flatpak create-usb ~/Scrivania/Flatpak/Runtime org.kde.Platform/x86_64/6.6 give me this error:

(flatpak create-usb:12250): OSTree-CRITICAL **: 21:25:12.067: ostree_collection_ref_new: assertion 'collection_id == NULL || ostree_validate_collection_id (collection_id, NULL)' failed
Errore di segmentazione (core dump creato)

What does it mean?

R
Replying to #13

It should never core dump. That’s something, you should probably report to the flatpak issue tracker.

H
Replying to #14

it does as some of these errors call abort()

E
Replying to #15

I changed distribution and tried again (Kubuntu 24.04). I managed to ‘extract’ the runtime using the same command that was giving me the error. Maybe it was just a ‘collection_id’ problem. The file that is generated inside the folder is not visible (.ostree) which is why I couldn’t see it (it was a trivial thing).