8

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

Sergi
  • 81
  • 1
  • 2

3 Answers3

2

Likely your firefox is installed with snap and it doesn't have privileges, simplest solution is to reinstall it with Ubuntu package from mozilla repository.

This is what worked for me:

  1. Remove snap firefox installation:
    sudo snap remove firefox
  1. Add mozilla repo
    sudo add-apt-repository ppa:mozillateam/ppa

3.Change priority, so ubuntu will use repo instead of snap

    echo '  
    Package: *  
    Pin: release o=LP-PPA-mozillateam  
    Pin-Priority: 1001  
    ' | sudo tee /etc/apt/preferences.d/mozilla-firefox
  1. Install Firefox:
    sudo apt install firefox

These steps were taken from there: https://fosspost.org/how-to-install-firefox-as-a-deb-package-on-ubuntu-22-04/

W4ltz
  • 31
1

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.

Alexis Wilke
  • 2,707
0

Maybe this can help you:

Try to install [Firefox without snap].1

If that does not work, try this:

If any of the following settings are in bold text, reset their values. To reset a value, click the Delete Fx71aboutconfig-DeleteButton or Reset Fx71aboutconfig-ResetButton button, depending on the preference:

browser.download.dir
browser.download.downloadDir
browser.download.folderList
browser.download.lastDir
browser.download.useDownloadDir

For me browser.download.useDownloadDir had "false" value. Reset button change to true and everything is working now.

See also https://support.mozilla.org/en-US/kb/cant-download-or-save-files

TommyPeanuts
  • 1,079