18

How can I get this back to work ? My whole password manager integration is now broken thanks to snap. People with 1password will have the same problem.

Regarding "duplicate for ppa install over snap" I'll copy my comment: technically yes, but it's a nice hack and ultimately a workaround (and if you're just trying to get some native transport working after upgrading, it is not the thing you'll search for).

8
  • If you mean 22.04; most extensions work perfectly; a number have been reported as not working to Mozilla who are working to resolve a few issues, as was known prior to release of Ubuntu 22.04 LTS & is tracked, and why upgrades are not yet open for existing users. Some fixes are expected to land Monday, but most firefox fixes will only land when Mozilla deem them ready/stable.
    – guiverc
    Apr 22, 2022 at 23:02
  • 3
    I'd remove the snap version of Firefox, and install the APT/DEB version. There's plenty of info on how to do that, either here, or via Google.
    – heynnema
    Apr 22, 2022 at 23:06
  • 2
    The troubleshooting done in discourse.ubuntu.com/t/keepassxc-with-firefox-snap/27291/2 suggests that Firefox+Snap+KeepassXC worked fine until a couple weeks ago, so don't leap to the conclusion that it's a Snap-caused issue. Voting to close: This seems a known bug, reported or not. If you want it fixed, help troubleshoot it and add useful data to the bug report.
    – user535733
    Apr 23, 2022 at 2:33
  • 1
    I'm against closing this for now. In the issue linked this bug exists since over 3 years and for now nothing is resolved. Installing the PPA is a nice hack, but you'll then have to use ESR or beta as no ppa for stable exists from mozilla (using unofficial PPAs for your browser with its credentials is a no go.)
    – proc
    Apr 23, 2022 at 8:49
  • Another thing is that some people here mention using some kind of snap additon, I just want to use the extension in firefox together with the kasspassxc in my system.
    – proc
    Apr 23, 2022 at 8:52

4 Answers 4

17

Update: Native messaging support in the Firefox snap is now available as beta. Beware that this is pretty fresh - the code hasn't been merged upstream, yet, so don't expect this to be production-ready. There is also a German article by Heise Online with a step-by-step guide on how to get this going - in case you want to give it a try.


Unfortunately this issue can't be fixed on KeePassXC's end and so far neither Flatpak nor Snap support NativeMessaging, yet (their sandboxing techniques prevent the browser extension from talking to the KeePassXC process). While work on a solution is in progress, all we can do is work around this issue (or switch to a distro which still provides browsers as regular packages like Debian). The KeePassXC Troubleshooting guide recommends installing the browser from the official PPA. This isn't pretty but the following approach worked for me:

  1. Uninstall the Firefox snap
    sudo snap remove firefox
    
  2. Ubuntu provides a transitional firefox Debian package which installs the Snap. We need to ensure that packages from Mozilla's PPA have higher priority (otherwise apt might "upgrade" to the Snap again).
    echo '
    Package: firefox
    Pin: release o=LP-PPA-mozillateam
    Pin-Priority: 1001
    ' | sudo tee /etc/apt/preferences.d/mozilla-firefox
    
    If you are using unattended-upgrades you also need to run the following to ensure unattended-upgrades takes the Mozilla PPA into account:
    echo 'Unattended-Upgrade::Allowed-Origins:: "LP-PPA-mozillateam:${distro_codename}";' | sudo tee /etc/apt/apt.conf.d/51unattended-upgrades-firefox
    
  3. Install Firefox from Mozilla's PPA:
    sudo add-apt-repository ppa:mozillateam/ppa
    sudo apt update
    sudo apt install firefox
    
  4. Disable AppArmor for Firefox to ensure the Firefox extension can connect to KeepassXC:
    sudo ln -s /etc/apparmor.d/usr.bin.firefox /etc/apparmor.d/disable/
    sudo apparmor_parser -R /etc/apparmor.d/usr.bin.firefox
    
  5. Run KeePassXC and enable browser integration (menu Tools -> Settings -> Browser Integration, tick "Enable browser integration" and "Firefox").
  6. Run Firefox, open settings of the KeePassXC extension -> Connected Databases -> Connect.

Disclaimer

This approach has the drawback that AppArmor is disabled completely - beware that this weakens security. Maybe someone with more AppArmor experience can contribute a safer way to get NativeMessaging working again?

Troubleshooting

A few tips in case you run into issues:

  • You can check whether you are running the Snap version or the regular version of Firefox by opening Help -> About Firefox. If the version number doesn't mention "Snap" you are running the regular version: enter image description here
  • You can check the apt priorities by running apt-cache policy firefox. Verify that the Mozilla PPA has higher priority than the official Ubuntu repository. The output might look like this:
    $ apt-cache policy firefox
    firefox:
      Installed: 101.0.1+build1-0ubuntu0.22.04.1~mt1
      Candidate: 101.0.1+build1-0ubuntu0.22.04.1~mt1
      Version table:
         1:1snap1-0ubuntu2 500
            500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages
    *** 101.0.1+build1-0ubuntu0.22.04.1~mt1 1001
            500 https://ppa.launchpadcontent.net/mozillateam/ppa/ubuntu jammy/main amd64 Packages
            100 /var/lib/dpkg/status
    
1
  • 2
    I just tested it on my machine and it looks to me that both downsides are not an issue (anymore?): The package firefox Mozilla Team PPA has version 100 of Firefox, while the ESR version is in a separate package - firefox-esr. I also did not have to do anything in regards to AppArmor in order to get KeePassXC to work with Firefox. It looks like a usable /etc/apparmor.d/usr.bin.firefox is part of the firefox package from the PPA.
    – Adaephon
    May 4, 2022 at 7:33
4

As an alternative to the other answer (without PPA), simply use the official version from mozilla.org.

It can be used as static/portable installation, the executable is path/to/firefox/firefox. It can also be installed system-level as said here (as per comment by @mook75), something which copies that folder to /opt, creates needed symlinks (so that a command like firefox starts the browser), and provides a launcher.

Testing in 22.04 (portable) I have found no limitations compared to the previous non-snap version, all addons work, there is just the fact that update has to be done with a click in Help - About Firefox.

screenshot

With portable install we need to create a launcher for it, manually or with a menu editor like Alacarte or KDE Menu Editor.

5
  • 2
    Since the tarball doesn't include any instructions how to install, this might be helpful.
    – mook765
    May 4, 2022 at 11:49
  • @mook - just curious - Are there advantages in installing it (which is nothing but moving firefox folder to /opt by mv firefox /opt ) over keeping the firefox folder anywhere? Does the system starts prompting for updates or something?
    – cipricus
    May 4, 2022 at 11:54
  • I don't know, I didn't test it, I installed firefox from mozilla team ppa. I just wanted to add the link to the instructions. I guess that there are many users around not knowing what to do with the tarball.
    – mook765
    May 4, 2022 at 12:00
  • @mook765 - my installation is local (~/Applications), and no update prompt will be gained. But creating needed symlink a command like firefox starts the browser etc.
    – cipricus
    May 4, 2022 at 12:15
  • thanks! didn't even knew there are static builds of ff
    – proc
    May 4, 2022 at 20:04
3

I prefer to use the Firefox Snap Beta with native messaging support (as mentioned by others), over the other alternatives which also have their drawbacks. Install it with:

sudo snap refresh firefox --beta

On a fully updated Ubuntu 22.04 LTS, I did not have to do any additional steps mentioned in the Heise article, such as systemctl --user restart xdg-desktop-portal.

The Firefox beta (105.0b3) works well with KeePassXC (2.7.1) from the official PPA and the Firefox KeePassXC-Browser extension (version 1.8.1). Other KeePassXC packages did not work for me. Install KeePassXC with:

sudo add-apt-repository ppa:phoerious/keepassxc
sudo apt update
sudo apt install keepassxc
2
  • Works perfectly!
    – aksh1618
    Oct 14, 2022 at 10:49
  • 1
    Just tested on Ubuntu (Mate) 22.04 and this works. Just an additional step was needed, as explained in the troubleshooting page github.com/keepassxreboot/keepassxc-browser/wiki/…. flatpak permission-set webextensions org.keepassxc.keepassxc_browser snap.firefox yes
    – Barnercart
    Dec 11, 2022 at 15:23
0

Just wait :)

This is a known issue, and a fix is underway, expected somewhere in June

See the Native messaging section here: https://ubuntu.com/blog/how-are-we-improving-firefox-snap-performance-part-1

UPDATE

AFAICS this is fixed now.

Not sure if the KeePassXC integration is already working, but other native-messaging apps are.

Just check them with:

flatpak permissions webextensions

And add a permission with:

flatpak permission-set webextensions xx.yy.zz snap.firefox yes

2
  • that's not a solution / answer
    – proc
    Jun 16, 2022 at 20:10
  • It's almost September now, and there is now fix
    – rozumir
    Aug 29, 2022 at 6:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.