Flatpak Firefox (and forks) very slow to start
from SolarPunker@slrpnk.net to linux@lemmy.ml on 07 Jun 16:15
https://slrpnk.net/post/10302552

While other flatpak apps have no problems. Any suggestions?

#linux

threaded - newest

khorovodoved@lemm.ee on 07 Jun 16:19 next collapse

Native packages? Sorry.

SolarPunker@slrpnk.net on 07 Jun 16:36 collapse

Sorry for what? I’m trying a fresh install of Bazzite so the distro prefers flatpaks.

Telorand@reddthat.com on 07 Jun 16:52 next collapse

Probably best that you do the same (installing packages in the FS overlay kind of starts to defeat the point of containerization). You could try installing it with a distrobox and then exporting the app—see if that fixes your loading issues.

I run Bazzite on a gaming laptop from 2015, and I haven’t noticed any particularly long load times. Do you have some browser extension(s) that are maybe causing issues?

SolarPunker@slrpnk.net on 07 Jun 17:22 collapse

My only extension is uBlock Origin but it isn’t the problem (I uninstalled it to test and nothing changed). Thanks for your suggestion, I’ll try to play with distrobox (I’m new to Bazzite and immutable distros).

Telorand@reddthat.com on 07 Jun 17:30 next collapse

You can try rpm-ostree to install in the lowest userspace layer, but Bazzite purposely switched to flatpak Firefox and discourages installing software using rpm-ostree, unless you absolutely have to.

SolarPunker@slrpnk.net on 07 Jun 17:37 collapse

Oh I forgot about rpm-ostree ty! In this case of flatpak not working it is suggested rpm-ostree or distrobox?

Telorand@reddthat.com on 07 Jun 17:50 collapse

Recommended installation order is:

  • Flatpak
  • Distrobox
  • Rpm-ostree

toolbox should also be installed on your system, and it works similarly to distrobox, but I’m less familiar with it.

SolarPunker@slrpnk.net on 07 Jun 17:52 collapse

Thank you!

khorovodoved@lemm.ee on 07 Jun 17:36 collapse

Distrobox will introduce a startup lag of it’s own. I would rather recommend (seriously this time) something like nix (it is officially supported for your distro) or junest.

SolarPunker@slrpnk.net on 07 Jun 17:39 next collapse

Oh thx for the info, I can maybe try with rpm-ostree in the case of lag. Nix is very good but I’m liking Bazzite very much for my needs, everything else seems working very good.

khorovodoved@lemm.ee on 07 Jun 17:41 collapse

You don’t quite understand me, it seems. I do not mean nixos distro. Nix is already available inside Bazzite as an additional package manager.

SolarPunker@slrpnk.net on 07 Jun 17:51 collapse

In fact I hadn’t thought about it, I always tried Nix as a separate distribution.

Telorand@reddthat.com on 07 Jun 17:45 next collapse

Nix might have been removed. I’ll have to check, but I feel like the ujust command forv setting up nix went away a version or two ago.

But I think you can set distroboxes to run at startup, so you’d never know the difference when it came time to actually launch the program. Right (correct me if I’m wrong)?

khorovodoved@lemm.ee on 07 Jun 18:04 collapse

Maybe, I do not use bazzite and cannot check. But it used to be a feature. You can, of cause, start distrobox at startup, but literally running almost two operation systems might not be the best for performance and RAM usage.

Telorand@reddthat.com on 07 Jun 18:52 next collapse

Could be a case for toolbox, which I admittedly know even less about. Either way, people here have offered several options to try!

khorovodoved@lemm.ee on 07 Jun 19:28 collapse

Toolbox is effectively the same thing as distrobox. It is a linux distro inside docker-like container. They even use the same images.

SolarPunker@slrpnk.net on 07 Jun 20:06 collapse

Are there any processes in particular that I should keep an eye on? At the moment I don’t notice any new particularly high load.

khorovodoved@lemm.ee on 07 Jun 20:41 collapse

Fortunately, it does not usually cause high load, but it still exists. The only thing I can recomend here is to always check if the dependencies of any package you install in container require to run in the background and avoid those which do.

SolarPunker@slrpnk.net on 07 Jun 19:58 next collapse

Ok I’m writing this thru Firefox (distrobox) and it works pretty well, no lag noticed.

khorovodoved@lemm.ee on 07 Jun 20:34 collapse

The lag would be noticeable when you launch Firefox with stopped container (for example after reboot or manual stop).

SolarPunker@slrpnk.net on 07 Jun 20:55 collapse

Ok, I’ve tested this, I’ve noticed a lag of a couple of seconds for the first time I launched a distroboxed app.

Para_lyzed@lemmy.world on 09 Jun 06:35 collapse

Sounds about in line with what I’d expect. If that works for you where the flatpak doesn’t, then it at least makes a viable solution for the short term (though I don’t know how much overhead would be introduced). A minute of delay is ridiculously long for startup, so I still don’t know why you were having that issue with the flatpak

Para_lyzed@lemmy.world on 09 Jun 06:31 collapse

Is it? I was looking a few months ago at Nix support in Fedora Atomic (which Bazzite is based on), and it required some minor hacks to get the /nix folder and Nix itself working properly with rpm-ostree distros, as root is otherwise immutable. Plus, Nix isn’t available by default in the Fedora repos it seems. I believe it required something along the lines of making a /var/nix folder and symlinking it, but I believe you’d also have to work around SELinux contexts on the folder and symlink. I’ve heard of people even having issues after that, so I wouldn’t consider it “official” support. Here’s an open issue thread about it

khorovodoved@lemm.ee on 09 Jun 10:00 collapse

Well, I know it used to be available and officially supported through available installation script. I do not have bazzite installed right now and their website does not have a proper documentation, so I can not check if it is available now.

khorovodoved@lemm.ee on 07 Jun 16:53 next collapse

Sorry for giving a rather useless advice. Of cause, you know about native packages, but since you are asking about flatpak, you, probably, have a reason to chose it. So, my original message was mostly intended as a joke, for which I am sorry.

boredsquirrel@slrpnk.net on 07 Jun 17:15 next collapse

Yeah that is a dumb decision of the uBlue folks. I really like their tooling but their Flatpak browser stuff (and a bit more) are annoying.

You also cant even layer Firefox, due to this rpm-ostree bug

github.com/coreos/rpm-ostree/issues/4554

Make some noise there if you want.

Telorand@reddthat.com on 07 Jun 17:35 collapse

Just curious why you think it’s dumb. I think it’s a great idea, since it gives more protection by containerizing the app.

Like I told OP, I haven’t had any particularly long load times, but “long” is a subjective measure, after all.

boredsquirrel@slrpnk.net on 07 Jun 20:48 collapse

It is a great idea but the concept is flawed

This issue helps to understand it

seccomp background

libseccomp is a long established security “firewall for syscalls”, it allows to restrict what actions programs can perform on the system.

I dont know what exactly these are, often low level stuff I guess, but one of these actions is “create an unprivileged user namespace”.

Flatpak uses a single, “badness enumerating” seccomp filter, which means they block the syscalls “A”, “B” and “C” for all programs. All others are allowed, and (see the issue) programs cannot define a more restrictive one.

user namespaces

A namespace is a virtual filesystem on top of the “real” one, where certain real system files are mounted to. This means unprivileged programs can suddenly do “OS stuff”, needed to create this filesystem.

contra user namespaces

Many distros like Debian (and Arch) didnt enable this feature for a long time, because user namespaces mean that unprivileged userspace programs, like your browser, can suddenly access low level system components like the filesystem.

If there now is a bug in such a component, user namespaces allow the program to directly access a way more privileged area, escape here and thus have privilege escalation.

This would not be possible when not using user namespaces.

Flatpak has a seccomp filter that blocks the creation of user namespaces, to avoid this low level system access. Which is a very good thing, but the missing modularity doesnt allow anything else!

pro usernamespaces

Over time even slow pacing distros like Debian enabled user namespaces.

Today they are the core feature of bubblewrap, podman, docker, (and thus distrobox and toolbox)…

The concept is that a rootless binary, running in userspace, can access system components which would normally require root.

Firejail is the opposite example, it is a root binary and sandboxes apps also when user namespaces are disabled. Chromium has a fallback suid sandbox which also is a root, same with bubblewrap after the modification by 34N0 implemented in the “no userns” images of secureblue.

The problem is, a root binary has root access. If there is a flaw in it, which was the case with firejail, the “nice and secure isolated app” could now use the root binary to escalate its privileges to root level, more than what it could have done without it.

Browsers and Sandboxes

A browser is basically a platform to run “apps” on. Nearly all websites nowadays require executable code, which means browsers are the attack surface for malware. Scrap your verified Flathub or well maintained distro repository, a single website could use a weakness and break your system.

This was a thing back in the time… crazy huh?

Chromium (Chrome, Edge, Brave, Vivaldi, Opera, …) has the said rootful sandbox as a fallback, I guess implemented back when user namespace sandboxes were not adopted enough.

But is normally uses a user namespace sandbox for process isolation, every tab runs in a different process, on Android too.

Firefox also uses user namespace sandboxes for tabs, but additionally uses seccomp-bpf to restrict the syscalls that the isolated tabs/processes can execute.

Flatpak and Chromium

Chromium relies exclusively on the ability to create sandboxes, with a root binary (the strange not really used fallback method) or with user namespaces.

So much that it straight up doesnt run if it cannot do that. The same goes for Electron apps, which are a browser platform running a single or very few processes.

This is why zypak was created. It redirects the calls of Chromium to flatpak, so it uses the builtin Flatpak sandbox instead.

As I said, all Flatpak apps (and thus all processes) use the same seccomp filter, so I assume that zypak is less secure than the native sandbox, which is battle tested by Google, Microsoft and more companies.

But it uses a sandbox, it is rootless and uses user namespaces. It just needs a little testing, a security audit, a bit of pentesting.

At the current stage I would honestly not trust it, so Flatpak Chromium browsers are not recommended for “production”.

Flatpak and Firefox

The Firefox Flatpak is official.

What the heck?

Thats what I asked byself and created this issue but honestly, this issue thread is way more informative.

edinbruh@feddit.it on 07 Jun 20:16 collapse

IMHO I would avoid the ublue distros and just go for official fedora spins. The guys have good intentions, but they don’t have the means to maintain that many distros “properly”. I often end up enabling copr packages for bazzite in my fedora install, just to find out the program doesn’t work.

That being said, as the other comments told you, you can still install native apps on immutable distros, it’s just a bit more work. I don’t expect distrobox or toolbox to be much faster than flatpak, as they are all just containers with a nice cli, except flatpak is easier to update. But trying costs nothing

SolarPunker@slrpnk.net on 07 Jun 20:20 next collapse

I’ve “solved” using distrobox, it work pretty well and I don’t see any lag. Bazzite is a very good distro imho, the problem is more on Firefox here.

lemmyreader@lemmy.ml on 08 Jun 22:06 collapse

While toolbox and distrobox seem very similar, distrobox comes with a slight warning :

biribiri11@lemmy.ml on 07 Jun 20:30 collapse

but they don’t have the means to maintain that many distros “properly”

That’s why they’re not separate distros from Fedora (as in, they don’t even host their own RPM repos nor maintain their own set of Fedora packages like Manjaro vs Arch) and purposefully so. It’s just stock Fedora with a few configs, third party repos/packages, and some scripts preinstalled. The entire thing runs on GH actions.

GolfNovemberUniform@lemmy.ml on 07 Jun 16:29 next collapse

I noticed this too on my slowest machine. I guess you should just use native packages or other formats to fix it (as the other person said). I’d stick with Flatpak if possible though. It’s more secure

SolarPunker@slrpnk.net on 07 Jun 16:38 collapse

Anything else works fine, the only other problem I’ve noticed is that some GTK applications don’t respect the KDE Plasma theme (in my case only Quod Libet).

BaalInvoker@lemmy.eco.br on 07 Jun 16:34 next collapse

Firefox is one of the few exceptions I suggest always use native version

SolarPunker@slrpnk.net on 07 Jun 16:39 collapse

If it is due to an inefficiency of Firefox it seems strange to me that no fork has solved the problem, other browsers like Brave work perfectly.

boredsquirrel@slrpnk.net on 07 Jun 17:13 next collapse

Flatpak Firefox and Chromium are very different. Note that Flatpak Firefox starts normally fast for me.

Use the native version, it is one of the best maintained software and has access to “user namespaces” for isolation.

Now search on the internet what that is XD

SolarPunker@slrpnk.net on 07 Jun 17:19 collapse

The only “Firefox” not presenting this start issue for me is Floorp but it’s proprietary.

boredsquirrel@slrpnk.net on 07 Jun 20:51 next collapse

Run it from the terminal to get more info.

Also run it through a profiler software like perf with the GUI hotspot.

Also, you are not by accident using secureblue, are you?

SolarPunker@slrpnk.net on 07 Jun 21:00 collapse

What is it? I’m on Bazzite.

boredsquirrel@slrpnk.net on 07 Jun 22:17 collapse

Dont mind then. Secureblue uses a strange hacky workaround for manking Flatpaks supposedly more secure.

So then try the other things I said.

real3245@lemmy.world on 08 Jun 08:08 collapse

Is floorp proprietary ?

SolarPunker@slrpnk.net on 08 Jun 16:37 collapse

raw.githubusercontent.com/…/LICENSE

I’m not sure, Wikipedia says partially

BaalInvoker@lemmy.eco.br on 07 Jun 17:18 collapse

Not only because of performance issues, but also because it’s clunky sometimes. For example, I cannot use KeePassXC Browser extension on Flatpak Firefox cause this implementation is borked. However in native version works flawlessly

CrumblyLiquid@lemmy.ml on 07 Jun 23:16 collapse

The extension is probably not broken because of Firefox but because Flatpak’s sandboxing prevents it from talking to KeePassXC.

BaalInvoker@lemmy.eco.br on 08 Jun 00:06 collapse

I know. That’s why I’m using native Firefox version, which works flawlessly

Magister@lemmy.world on 07 Jun 17:00 next collapse

I’m so glad to use a distro with 0 flatpak/snap/whatever, my FF is always the latest one, with a simple .deb install from apt, ❤️ MX Linux

Dsklnsadog@lemmy.dbzer0.com on 07 Jun 17:02 collapse

I mean, it doesn’t matter the distro…

yo_scottie_oh@lemmy.ml on 07 Jun 17:23 collapse

Except Ubuntu b/c they’re pushing snaps.

ElectroLisa@lemmy.blahaj.zone on 07 Jun 23:32 next collapse

You’re on X or Wayland?

SolarPunker@slrpnk.net on 08 Jun 02:14 collapse

Bazzite should have wayland by default

fenndev@leminal.space on 07 Jun 23:37 next collapse

Any issues lately with your network? When DNS is down or having issues, Firefox and forks take forever to start up.

SolarPunker@slrpnk.net on 08 Jun 02:18 collapse

Nothing special, I don’t think that’s the problem since the lag is at every launch and it takes something like a minute to appear.

Bitrot@lemmy.sdf.org on 08 Jun 06:35 next collapse

It also happens when the hosts file is messed up and the system can’t resolve its own hostnames. Opensuse used to be pretty notorious for doing something odd to the hosts file by default that really only affected Firefox.

Edit: the increased security they’re trying around the browser might also be triggering that local resolution issue

gnuhaut@lemmy.ml on 08 Jun 07:31 collapse

I don’t think that’s the problem

Listen to the parent, this is almost certainly something to do with DNS (i.e. Firefox is not getting an answer for some reason, then timing out, then using maybe a backup DNS server; maybe there are multiple rounds of this). Who knows how your distro and that flatpak produce this interaction, but something is going on there.

SolarPunker@slrpnk.net on 08 Jun 16:34 collapse

If that’s the issue, why it doesn’t happen with all other flatpaks?

gnuhaut@lemmy.ml on 08 Jun 18:23 collapse

Don’t know. Different runtimes? Different permissions?

Para_lyzed@lemmy.world on 09 Jun 06:17 next collapse

Is this new, or has it been happening for a few days/weeks? I’m on Fedora Atomic (which Bazzite is based on) and have never experienced this (though I mostly use Mullvad browser, a fork of Firefox). I tried Bazzite a few weeks ago and also never experienced this with the Firefox flatpak. If it’s been happening for awhile, it may be hardware-specific or a config thing. Out of curiosity (just to get a 1:1 comparison), do you experience the same thing with the Mullvad browser flatpak?

SolarPunker@slrpnk.net on 09 Jun 08:06 collapse

I’m on a fresh install. I experienced this with Firefox, LibreWolf and Waterfox.

Para_lyzed@lemmy.world on 09 Jun 09:02 collapse

Hm, it could be a new issue then. I’m not seeing it on the Bazzite issues page, perhaps you should open a new issue on it here, and provide your hardware specs. At the very least, you could see if this issue is reproducible on other installs, and someone there could help to obtain more useful debug info to determine the actual problem. You could also report it on the Mozilla Bugzilla page, as chances are this is a Firefox issue and not a Bazzite issue, but I admit that the interface for bug reports is less intuitive for non-developers there. Bazzite devs would likely direct you to there first anyway though.

All I can really say myself is that I don’t experience this on Fedora Atomic KDE 40.20240607 with Mullvad Browser or the Firefox flatpak. I suspect it is either a hardware/config issue (on fresh install, I’d say a config issue is a distro issue if you haven’t changed anything), or that this is Bazzite specific and not present in upstream Fedora Atomic. Regardless, it’s a good idea to report this so that other users don’t experience the same bug

ColdWater@lemmy.ca on 09 Jun 07:05 collapse

I have many flatpak apps bork down on me (steam, wine, emulators…) just install from your distro repo instead and only use flatpak if you don’t have other choices