Blog-Archiv

Sonntag, 22. Januar 2023

Change LINUX Firefox Snap to Traditional Package

I got slow performance issues with Ubuntu 22.04 ugrade. After I encountered also drag & drop problems in Firefox, I decided to do something.

Remove Firefox Snap

Snap is a new Ubuntu package manager that offers applications directly from the provider, with all neeed library-versions included ("containerized"). There is a big discussion about snap being a proprietary Canonical (Ubuntu) software, while flatpak is the open source solution and thus to be preferred (remember that Ubuntu builds on Debian LINUX which is 100% open source). There are several scripts and Blogs on the Internet that enable you to remove snap completely from your Ubuntu and install flatpak instead.

As I just wanted a faster (and maybe more stable) Firefox browser, I did not remove snap entirely, but tried to remove the snap-Firefox and instead install Firefox traditionally. Here are the commands I launched, in order.

Mind that when you are looking at commands in a browser and you are about to remove that browser, you need to copy all these command-lines to some text file before terminating the browser, because it could happen that the browser is not available anymore afterwards!

List all snaps on system:

$ snap list

When Firefox is not in that list - no need to continue!

Get rid of firefox as snap:

$ sudo snap remove firefox
$ sudo apt purge firefox
$ rm -rf $HOME/snap/firefox

This takes a while, because snap is ....

Avoid Firefox getting reinstalled as snap.
There are numerous solutions for this on the web, I ended up doing them all, here is one:

$ sudo vi /etc/apt/preferences.d/firefox-no-snap
i
Package: firefox*
Pin: release o=Ubuntu*
Pin-Priority: -1
<ESCAPE>
:x
The input i stands for "insert" and is the vi-command for starting to write text.
The <ESCAPE> key finishes the insertion-mode of the editor.
:x is the vi-command for saving and terminating.

And here is another one:

$ sudo vi /etc/apt/preferences.d/mozilla-firefox
i
Package: *
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 1001
<ESCAPE>
:x

Install Firefox Traditionally

Tell your LINUX where the Mozilla/Firefox installation site is:

$ sudo add-apt-repository ppa:mozillateam/ppa

Reinstall Firefox traditionally from its Mozilla PPA ("Personal Package Archive"):

$ sudo apt install -t 'o=LP-PPA-mozillateam' firefox
I am not sure if the -t option is needed, but I am not willing to try it out. (Why are there so many ways to do things?)

Make sure Firefox will be upgraded in future:

$ sudo vi /etc/apt/apt.conf.d/51unattended-upgrades-firefox
i
Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";
<ESCAPE>
:x

Mind that when you do this before reinstalling Firefox, you would see this error:

$ sudo apt install firefox
....
Package firefox is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'firefox' has no installation candidate

In that case you should remove /etc/apt/apt.conf.d/51unattended-upgrades-firefox, install Firefox, then create the file again.

Resume

Both snap and flatpak are container-systems, that means an application built with one of them has all its needed libraries in its container. Container-Systems are well-known from cloud computing, e.g. docker containers even hold the needed operating-system. Before container-systems, installed applications had to use the libraries that were present in the underlying operating-system. Of course there was a dependency management for that, meaning a newly installed application may also have caused the installation of newer libraries. But this opened problems for older applications in case some new library was not backward-compatible.

Reusing system-libraries would optimize disk consumption. If you have some application that itself has 2 MB and uses only pre-installed libraries, this is the best case. But if you use containers, you may end up with lots of applications that use the same set of libraries, and they do not share them. Disk consumption may climb from 2 MB to 90 MB for such an application, as some wise guy found out. Now, if you install that application traditionally, and maybe just few of the required libraries are present, the space consumption may rise to even 600 MB in some cases! Why is that? Because dependencies are not so cleanly modelled. Separation of concerns is a subtle topic, and reality deviates from the ideal.

But why do containerization? Because of dependency hell, also called DLL hell (Microsoft), in contrast to isolation heaven. Libraries live, applications live, all of them permanently release new versions. Thus permanently upgrading software is a MUST, not a SHOULD or a CAN. You can not preserve applications for eternity. Even their underlying operating-system and hardware-interfaces may change in course of time.




Keine Kommentare: