maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Flatpak on Sailfish OS (https://talk.maemo.org/showthread.php?t=100909)

rinigus 2020-01-05 10:40

Flatpak on Sailfish OS
 
2 Attachment(s)
This is to announce Flatpak support for Sailfish. Its raw on the edges, limited, but possible and, hopefully, will be available for your SFOS devices. With it, Flatpak allows you to use latest SDKs for your code development and running applications developed for Linux and distributed in this format.

Development is done via repositories at https://github.com/sailfishos-flatpak.

For issues and documentation see https://github.com/sailfishos-flatpak/main

Right now, Flatpak support is available for Sony Xperia Tama devices (unofficial port) with the hope that other devices will follow. Due to QtWayland limitations, only Qt/QML applications run well with Gdk apps refusing to start due to the absence of currently standard Wayland extensions.

For issues, see README at Github and its issue trackers.

Obligatory screenshots below showing KDE Plasma Mobile Web browser running on Sailfish.

Fellfrosch 2020-01-05 10:46

Re: Flatpak on Sailfish OS
 
:eek: Amazing

Kabouik 2020-01-05 11:16

Re: Flatpak on Sailfish OS
 
Unbelievable. Great work Rinigus, again. Thanks a lot, the community owes you a lot. :o

Maemish 2020-01-05 21:23

Re: Flatpak on Sailfish OS
 
The flatpak is unknown to me. What are the benefits? With "Make Mint faster" instructions the flatpak is one to be deleted for good because of... something. So what are the benefits of flatpak? Curious.

rinigus 2020-01-05 22:05

Re: Flatpak on Sailfish OS
 
https://en.wikipedia.org/wiki/Flatpak

In lay terms, it is a packaging format that allows you to run applications in a sandbox. As a result, your application sits in the same perceived environment regardless on whether it runs on Debian, Fedora, Gentoo, or, with the developed support, on Sailfish. There are limitations that make its use limited, but some we could maybe resolve.

Now, for us, it means ability to run KDE Plasma Mobile apps. In future, with Wayland compositor update, Gdk apps as well. In addition, it also allows to develop using Qt 5.12/5.13 already now.

There is a price to pay. Native look is not available, at least right now. Starting apps takes longer time as container has to be prepared. Keyboard requires special attention and a mod of the app before used. Hopefully, the latter can be resolved and we could use SFOS keyboard.

As a developer, I have distributed Pure Maps and OSM Scout Server via Flatpaks. As a result, I can package it in one place and have it on all desktop distributions. For native look, you have to package separately and write accordingly, as done for SFOS and Ubuntu Touch. For my apps, KDE Kirigami (as in Plasma Mobile) style is used for Flatpaks.

eson 2020-01-06 06:00

Re: Flatpak on Sailfish OS
 
There's no locale in OSM Scout Server flatpak?

Maemish 2020-01-06 06:40

Re: Flatpak on Sailfish OS
 
Thanks Rinigus, I understand now the benefits. Is this something that can be use also for Leste and N900? And longer starting times do not matter that much if the app works well after launching and if otherwise the application would be without reach with the device. Great work you do.

rinigus 2020-01-06 06:53

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by eson (Post 1564183)
There's no locale in OSM Scout Server flatpak?

Maybe. I don't know, tbh. never checked it. Should put into my todo list...

rinigus 2020-01-06 06:57

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by Maemish (Post 1564184)
Thanks Rinigus, I understand now the benefits. Is this something that can be use also for Leste and N900? And longer starting times do not matter that much if the app works well after launching and if otherwise the application would be without reach with the device. Great work you do.

As long as kernel is reasonably current (don't know what's reasonably current means over here), I presume it can work. But I know too little about Leste and N900 to make any specific comments

eson 2020-01-06 09:22

Re: Flatpak on Sailfish OS
 
1 Attachment(s)
Quote:

Originally Posted by rinigus (Post 1564185)
Maybe. I don't know, tbh. never checked it. Should put into my todo list...


There isn't. Works fine in Pure Maps flatpack.

nthn 2020-01-06 09:50

Re: Flatpak on Sailfish OS
 
Outstanding work!

rinigus 2020-01-06 15:57

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by eson (Post 1564187)
There isn't. Works fine in Pure Maps flatpack.

That red box is regarding map labels selection, not really locale as of GUI. Note that you could set some better Qt style which will show these items in dropboxes (no idea why default sucks so much)

taixzo 2020-01-06 16:34

Re: Flatpak on Sailfish OS
 
How does the memory usage of Flatpak apps compare with native ones?

Bundyo 2020-01-06 16:38

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by taixzo (Post 1564193)
How does the memory usage of Flatpak apps compare with native ones?

Probably every one loads its own libs, so worse than running shared.

rinigus 2020-01-06 18:09

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by taixzo (Post 1564193)
How does the memory usage of Flatpak apps compare with native ones?

Excellent question. That's what I found regarding it: https://github.com/flatpak/flatpak/i...ment-356259401

So, in practice:

- if you have KDE platform with Qt 5.12 installed in home (--user)
- all apps using this platform will share Qt libs and all libs in the platform
- the libs bundled with the apps (like some ones required for specific action by that app) will not be shared between apps

In this respect, it the same for us now. All libs bundled with the apps don't share RAM even if they are the same.

So, we get an overhead of loading platform libs to RAM, but we can minimize it by using the same runtime as much as we can.

However, the discussion in that linked issue is interesting for getting info on Flatpak internals.

MartinK 2020-01-07 17:56

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by rinigus (Post 1564195)
So, we get an overhead of loading platform libs to RAM, but we can minimize it by using the same runtime as much as we can.

I can get some background about what I have found so far about the on-disk space using of Flatpaks to complement the data about RAM usage.

For that it's important to note, how Flatpaks & runtimes are actually stored - in a single shared OSTree repo. OSTree provides some key benefits for flatpaks:
  • git like per app & per runtime repo
  • differential updates (only changes from previous version are transferred on update)
  • automatic deduplication of everything in the repo

Especially the last point is pretty important and should be stressed. Thanks to this, you can have say 5 versions of the KDE (or any other) installed, but it will not consume much less than 5 full copies (basically size of all the shared bits + all the individual differences).

The same thing is true for applications - everything is automatically deduplicated against everything else. So if two apps bundle the same thing, say libfoo built the same way, resulting in the same binaries or say some bitmap files - there will always be just a single copy stored for all the apps.

To summarize - thanks to its innovative storage layout even with the need for runtimes when compared to "normal" packages, Flatpak is pretty efficient in both storage of runtimes and apps as well as for runtime and app updates.

Many of these things are simply not possible or pretty hard to do just with regular RPM (easy parallel installation & automatic deduplication).

Also - HUGE thanks to rinigus for working on this - you are really a hero! :)

I was secretly hoping Jolla would pick this up as the main native app distribution mechanism given that it fixes many many of the problems of the current platform and store (such as the App version and system version of Qt being the same, turning Qt updates into a tricky and ornerous process). But this is also a way. :)

Fingers crossed that this time they they will give priority to any changes needed in the regular Sailfish OS for full Flatpak support, so that Sailfish OS users on as many devices as possible can use it. :)

rinigus 2020-01-07 20:32

Re: Flatpak on Sailfish OS
 
@MartinK: thanks a lot for the background. I am sure we will be able to get it working on all devices or at least on the updated ones. Right now I am focusing on getting the keyboard working, then would have to polish different aspects and when its end-user usable, get it supported on wide range of devices.

If done well, I am sure Jolla will see the benefit in it. But we don't have to rely on them and let it out as much as we could through community.

mankir 2020-01-09 18:05

Re: Flatpak on Sailfish OS
 
very promising at all! i am not able to run the plasma browser, may be i forgot something?

rinigus 2020-01-10 07:17

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by mankir (Post 1564251)
very promising at all! i am not able to run the plasma browser, may be i forgot something?

Probably.

Its not ready yet for general use. Making good progress with the keyboard (can already trigger SFOS one from Flatpak app), but need to polish keyboard-app communication further. When ready, will have to see how to properly incorporate that into the platform.

rinigus 2020-01-11 14:36

Re: Flatpak on Sailfish OS
 
I have just released new flatpak runner with Sailfish keyboard support. The keyboard required
  • Having DBus service running in P2P mode for communication of Sailfish application rotation and activity state
  • Modified Maliit Qt plugin inside Flatpak container to trigger keyboard and rotate it

It could still have some issues with the keyboard, but those could be resolved later. I presume it should also work with the hardware keyboard device as it should be configured on Maliit server side (residing on SFOS).

So, right now we can use QML/Qt apps with the keyboard. Keyboard follows application screen orientation, hides when you switch away from it, can be used to enter chars.

Example packaging script for Angelfish is in the separate repository, https://github.com/sailfishos-flatpak/example-apps

rinigus 2020-01-12 21:50

Re: Flatpak on Sailfish OS
 
I have made tmp solution that mounts Maliit plugin into any app running in Flatpak. This solution requires:

- flatpak-maliit-plugin-qt installed in SFOS
- app should use KDE 5.12 runtime

Just released flatpak-runner will add the plugin into container when app is running and keyboard can be used.

So, this means that we can use Flatpak applications as they are provided by KDE and Flathub. No recompile or hacking is needed. Assuming that they are QML/Qt 5.12 ...

Proper solution will be to add Maliit plugin as an extension of KDE runtime. Will talk to KDE devs about it.

rinigus 2020-01-18 09:14

Re: Flatpak on Sailfish OS
 
Yesterday, patches required to libhybris linker were merged and, I presume, will be part of the next SFOS release. Which would bring Flatpak support for many, if not all, devices. If you are using unofficial port, you could already ask maintainers to bump their libhybris to version 0.0.5.34 to get it working in between updates.

mankir 2020-01-18 09:59

Re: Flatpak on Sailfish OS
 
great work, angelfish is running now (a bit sluggish, but that is not the point). would be nice to get some audio apps working, audacity should be possible, i saw the mic levelmeter even with the last version... unfortunally flathub does not have an arm version of mixxx, would be crazy to dj with a mobile!

rinigus 2020-01-18 10:20

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by mankir (Post 1564471)
great work, angelfish is running now (a bit sluggish, but that is not the point). would be nice to get some audio apps working, audacity should be possible, i saw the mic levelmeter even with the last version... unfortunally flathub does not have an arm version of mixxx, would be crazy to dj with a mobile!

Audio, as such, should work. At least I can hear sound in videos from BBC. As for audacity, check if it fulfills requirements:

- should be Qt/QML 5.12
- no additional windows open.

Requirements explained in this thread

bennypr0fane 2020-01-25 15:32

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by rinigus (Post 1564143)
Right now, Flatpak support is available for Sony Xperia Tama devices (unofficial port) with the hope that other devices will follow. Due to QtWayland limitations, only Qt/QML applications run well with Gdk apps refusing to start due to the absence of currently standard Wayland extensions.

What, pray tell, are Gdk apps? I suppose you are not talking about Google Glass Dev Kit? Maybe GTK is what you mean?

rinigus 2020-01-25 15:35

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by bennypr0fane (Post 1564748)
What, pray tell, are Gdk apps? I suppose you are not talking about Google Glass Dev Kit? Maybe GTK is what you mean?

see https://en.wikipedia.org/wiki/GDK#/m...chitecture.svg

Gtk sits on top of Gdk

rinigus 2020-01-26 21:43

Re: Flatpak on Sailfish OS
 
New flatpak runner is out: 0.4.0

This time it has been mainly about making it usable. From now on, you don't need to make GL extension manually anymore - its made for you on the first start of flatpak-runner.

The app takes care of refreshing the list of flatpak applications installed on your device and generates corresponding .desktop files. As a result, you can launch them as if they are SFOS apps from the app grid.

When started without hosting any app, it will show the list of installed flatpak apps and will allow you to tune environment for each of them. You can add default and app-specific env variables, change QT scaling and DPI parameters. For qtwebengine based browser, I recommend to set scaling to 2 or 3 (depending on your device) for better hidpi screen support.

Known bugs: https://together.jolla.com/question/...not-respected/

coderus 2020-02-03 19:25

Re: Flatpak on Sailfish OS
 
is tere a list/wiki with usable software? :D i am new to flatpak and no idea what i just installed :DD

rinigus 2020-02-03 20:07

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by coderus (Post 1565029)
is tere a list/wiki with usable software? :D i am new to flatpak and no idea what i just installed :DD

Right now, unless you wish to compile it, list is short:

- Angelfish available from KDE Flatpak repo, org.kde.mobile.angelfish; developed at https://invent.kde.org/jbbgameich/plasma-angelfish

- Maybe Matrix client Spectral, https://gitlab.com/spectral-im/spectral

We are limited to QML apps due to QtWayland 5.4 that we have and which is used in the compositor run by flatpak-runner. On top of that, flatpak-runner compositor is in particularly bad and assumes that it has only one window to show. Which does cause some issues. Depending on Qt update on SFOS, we will either have to work with QtWayland 5.4 or just wait with this limitation for now.

I'm mainly looking into improving the browser, Spectral has issues with touch controlled devices (issues filed). Browser, as distributed now, is slow. Bugfix is known and already applied, but may require further investigation on my side.

As for other software, much is written for desktop. Gtk apps are no go for now (too old QtWayland compositor).

In sum, right now, you have to get hands dirty to get software that you want and be ready to fix it. Shouldn't be a problem, right?

Did you check that your device has newer libhybris? libhybris-0.0.5.34 is required.

mosen 2020-02-03 20:25

Re: Flatpak on Sailfish OS
 
I am trying the github instructions on Proš but struggle at adding the repos.

Code:

[nemo@mosen-Pro1 ~]$ flatpak remote-add -vv --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
F: Opening user flatpak installation at path /home/nemo/.local/share/flatpak
F: Loading https://flathub.org/repo/flathub.flatpakrepo using libsoup
F: Received 4040 bytes
Usage: gpg-connect-agent [options] (-h for help)Usage: gpg-connect-agent [options] (-h for help)F: Imported 1 GPG key to remote "flathub"
F: Fetching summary file for remote ?flathub?
Warning: Could not update extra metadata for 'flathub': While fetching https://dl.flathub.org/repo/summary.sig: [28] Timeout was reached

The kdeapps repo added without that trouble but still if i do remote-ls:

Code:

flatpak remote-ls --user kdeapps
error: While fetching http://distribute.kde.org/flatpak-ap...g/summary.sig: [52] Server returned nothing (no headers, no data)

What may i miss?

When installing sth:
Code:

[nemo@mosen-Pro1 ~]$ flatpak install -vv --user org.kde.mobile.angelfish
F: Opening user flatpak installation at path /home/nemo/.local/share/flatpak
Looking for matches?
F: Fetching summary file for remote ?flathub?
F: Failed to download optional summary
F: An error was encountered searching remote ?flathub? for ?org.kde.mobile.angelfish?: Unable to load summary from remote flathub: While fetching https://dl.flathub.org/repo/summary.sig: [28] Timeout was reached
F: Fetching summary file for remote ?kdeapps?
Usage: gpg-connect-agent [options] (-h for help)Found similar ref(s) for ?org.kde.mobile.angelfish? in remote ?kdeapps? (user).
Use this remote? [Y/n]: Y
F: No installations directory in /etc/flatpak/installations.d. Skipping
F: Fetching summary file for remote ?kdeapps?
Usage: gpg-connect-agent [options] (-h for help)F: Transaction: install kdeapps:app/org.kde.mobile.angelfish/arm/master[*]
F: Looking for remote metadata updates for kdeapps
F: marking op install:app/org.kde.mobile.angelfish/arm/master resolved to 0317b5bae437bf982c139a3b9a8207fc4f736c6a56e81e9736911789dbd3ad5c
F: Fetching summary file for remote ?flathub?
F: Failed to download optional summary
error: The application org.kde.mobile.angelfish/arm/master requires the runtime org.kde.Platform/arm/5.12 which was not found
[nemo@mosen-Pro1 ~]$ flatpak install -vv --user org.kde.Platform/arm/5.12
F: Opening user flatpak installation at path /home/nemo/.local/share/flatpak
Looking for matches?
F: Fetching summary file for remote ?flathub?
F: Failed to download optional summary
F: An error was encountered searching remote ?flathub? for ?org.kde.Platform/arm/5.12?: Unable to load summary from remote flathub: While fetching https://dl.flathub.org/repo/summary.sig: [28] Timeout was reached
F: Fetching summary file for remote ?kdeapps?
Usage: gpg-connect-agent [options] (-h for help)error: No remote refs found similar to ?org.kde.Platform/arm/5.12?


coderus 2020-02-03 20:37

Re: Flatpak on Sailfish OS
 
Thanks i installed angelfish just fine. Just wanted to know if there is anything around i can try as well :)

Running on fxtec pro1.

rinigus 2020-02-03 21:29

Re: Flatpak on Sailfish OS
 
@mosen, I wonder whether you rebooted after install of flatpak.

mosen 2020-02-03 22:04

Re: Flatpak on Sailfish OS
 
I did, after starting up the flatpak-launcher once from gui appdrawer.

Is it a clean way to "zypper remove flatpak flatpak-runner flatpak-maliit-plugin-qt" and try again?

rinigus 2020-02-03 22:08

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by mosen (Post 1565041)
I did, after starting up the flatpak-launcher once from gui appdrawer.

Is it a clean way to "zypper remove flatpak flatpak-runner flatpak-maliit-plugin-qt" and try again?

you can remove those, but I would suggest to remove

/home/nemo/.local/share/flatpak/

first. And check that your /var/lib/flatpak/ is empty. Then add repos again ...

coderus 2020-02-03 22:39

Re: Flatpak on Sailfish OS
 
i had no problems installing everything from scratch today. except instaalling missing pyotherside requires :)

rinigus 2020-02-04 08:25

Re: Flatpak on Sailfish OS
 
@coderus: requirement added and new release is out (minor)

If you want to develop using Flatpak or compile something, make sure you check https://github.com/sailfishos-flatpa...Development.md and the known issues listed there at the bottom.

lal 2020-02-04 17:15

Re: Flatpak on Sailfish OS
 
Quote:

Originally Posted by mosen (Post 1565031)
I am trying the github instructions on Proš but struggle at adding the repos.

.. snip ..

I have these Timeout errors too, from the "flathub" repo. From the look of it, "kdeapps" repo looks good. I tried from different networks and VPNs thinking my network was be the culprit, but it certainly wasn't the case.

Anyway, I did install the kde-arm-Qt-5.12 runtime and then the Angelfish on phone. I flatpak installed the org.kde.Platform/arm/5.12 in PC and copied the runtimes to the phone under ~/.local/share/flatpak/runtime/. Installing Angelfish from kdeapps repo went *mostly* fine then on Sailfish the normal way.

I observed that the flatpak wouldn't throw the timeout error when accessing flathub if the install/repo-sync operation was carried out quickly after a fresh Sailfish restart. It starts to throw errors after that.

rinigus 2020-02-04 17:48

Re: Flatpak on Sailfish OS
 
I have heard that Flathub has sometimes net issues, but usually its not too bad. I wonder now whether your phone enters suspend and looses connection because of that. In this case, the timeouts could come with switched off screen, but not with display on.

mosen 2020-02-04 19:52

Re: Flatpak on Sailfish OS
 
Happy lal has similar to tell :)
I thought i was stupid over the last 2 evenings :D
But yes, it looks like network issues and i had the same thought and tried with display on while charging and usb plugged in.
Can also confirm the kdeapps repo not throwing errors.
Also tried to switch wlan off and get repos from mobile data, same.
Standing by for debug instructions ;)

rinigus 2020-02-04 21:34

Re: Flatpak on Sailfish OS
 
TBH, I have no clue the downloads fail. Could be probably many reasons behind it. Maybe something is with infrastructure of Flathub leading to it. But a trick that @lal used should work for you too. If you have PC nearby


All times are GMT. The time now is 16:13.

vBulletin® Version 3.8.8