Score:4

Firefox can't open files

cn flag

I just updated from Ubuntu 20.04 to 22.04 and it looks since then Firefox can't open a file. When I download a file from a website, I get the dialog box "Open with... System Handler (default)". I try that and it looks the file is downloaded but I can't open it or even access the folder when it was downloaded. I have Firefox 105.0.3 (64 bits) Mozilla Firefox Snap for Canonical-002 - 1.0

vanadium avatar
cn flag
Can you give specific step by step instructions allowing others to reproduce your issue?
us flag
Switching from the snap to the apt version should fix such permission issues. https://askubuntu.com/questions/1399383/how-to-install-firefox-as-a-traditional-deb-package-without-snap-in-ubuntu-22/1404401#1404401
us flag
Does this answer your question? [How to install Firefox as a traditional deb package (without snap) in Ubuntu 22.04 (jammy)](https://askubuntu.com/questions/1399383/how-to-install-firefox-as-a-traditional-deb-package-without-snap-in-ubuntu-22)
David avatar
cn flag
If you do not want to change Firefox to apt version you need to download the file to your home directory so Firefox can access it.
Sergi avatar
cn flag
Thanks for the answers! Yes, I can download the file to a folder and then open it from there. I read that there have been some issues with snap Firefox. Do you really advice me to install it with deb package and forget snap or maybe think that these issues will be resolved in a near future?
Score:0
ph flag

snap packages are used to improve security in several different ways. The parts that help:

  1. a snap package gets installed in its own environment (a chroot environment)
  2. snap dependencies have to be installed within its environment (avoid using an invalid / incompatible / unsafe version of a package)
  3. access to files on your system from a snap package is controlled by apparmor

so you have several solutions:

  • one is to find an up to date version of the .deb but Ubuntu was saying that they would stop producing those... yet it looks like there are PPAs with the latest

  • save the files in different locations to be able to open them; it should work from your folders (under your /home/<login>). This may still fail if apparmor prevents firefox from starting other binaries.

  • edit the apparmor settings to allow firefox to do this and/or that; the apparmor files are not in the snap since they are required for the main host apparmor system; the ones for firefox are found here:

    $ ls /var/lib/snapd/apparmor/profiles/snap.firefox.*
    /var/lib/snapd/apparmor/profiles/snap.firefox.firefox
    /var/lib/snapd/apparmor/profiles/snap.firefox.geckodriver
    /var/lib/snapd/apparmor/profiles/snap.firefox.hook.configure
    /var/lib/snapd/apparmor/profiles/snap.firefox.hook.connect-plug-host-hunspell
    /var/lib/snapd/apparmor/profiles/snap.firefox.hook.disconnect-plug-host-hunspell
    /var/lib/snapd/apparmor/profiles/snap.firefox.hook.post-refresh
    

    You need to edit /var/lib/snapd/apparmor/profiles/snap.firefox.firefox and make the changes to make it all work. For example, to allow execution of binaries under ~/bin, you could add something like:

    @{HOME}/bin rx,   # allow Read & eXecute under /home/<login>/bin
    

    Once done with the edits, run:

    sudo apparmor_parser -r /var/lib/snapd/apparmor/profiles/snap.firefox.firefox
    

    then restart firefox.

    As for the change itself, it depends on what you are trying to do. To access a file in a directory, that directory needs to be allowed. The type of access is defined by a set of letters.

    Note 1: The changes you make are going to be overwritten each time the snap is refreshed. So make sure to make a clear copy of you changes so you can re-apply them. Outside of that side problem, it's probably the best solution.

    Note 2: The changes to snap.firefox.firefox are for all users on your machine. If you have multiple users, you may want to reconsider. At the same time, installing the .deb would allow anyone to (nearly) do anything as before without any real protection.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.