Keepassxc: KeePassXC-Browser Helper Script giving errors

Created on 27 Mar 2019  路  16Comments  路  Source: keepassxreboot/keepassxc

I have installed the snap of 2.40 in Debian 10. I have installed the KeePassXC-Browser add-on (v1.3.3) in Firefox 60.5.1-ESR.

I have run the KeePassXC-Browser Helper Script downloaded from keepassxc.org.

When the script runs, I select the options for a non-snap installation of Firefox. Terminal gives the following message and drops me back to a prompt:

keepassxc-snap-helper.sh: 55: keepassxc-snap-helper.sh: [[: not found
keepassxc-snap-helper.sh: 60: keepassxc-snap-helper.sh: Bad substitution

As a result I have no access to my keepassxc database via the browser plugin, despite having enabled KeepassXC browser integration inside the settings for Keepassxc.

Debug Info

KeePassXC - Version 2.4.0
Revision: c51752d
Distribution: Snap

Libraries:

  • Qt 5.9.5
  • libgcrypt 1.8.1

Operating system: Ubuntu Core 18
CPU architecture: x86_64
Kernel: linux 4.19.0-2-amd64

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • SSH Agent
  • KeeShare (signed and unsigned sharing)
  • YubiKey

Operating system: Debian 10
CPU architecture: x64

Snap Browser integration

All 16 comments

Are you running this under bash??

Try running bash keepassxc-snap-helper.sh

I was using sh, when I ran it under bash the script completes and says to reboot browser.

Upon rebooting browser, and clicking the KeepassXC-Browser plugin (to connect/refresh) it says:

"KeePassXC-Browser has encountered an error:
Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings."

Please see this for some tips: https://keepassxc.org/docs/keepassxc-browser-migration/

You might also have to restart KeePassXC to establish everything. Can you confirm that you have $HOME/snap/keepassxc/common directory? I did not test this under Debian using snaps.

Restarting KeepassXC didn't help. I do have the /common directory. I will look at the link for tips.

Previously, I had installed Keepassxc via the Debian repositories which was v2.3.4 (iirc). It worked fine. But the new 2.40 version is not available in the Debian repositories and so I went with snap.

Now the browser integration doesn't work, despite having removed/uninstalled both and reinstalled...

I've gone through the tips... I believe the browser plugin can't see the KeepassXC. In the plugin, it shows:
KeePassXC - unknown
KeePassXC-Browser - 1.3.3
Operating system: Linux x86_64
Browser: Mozilla Firefox 60.0

This is despite having no connected databases shown in the Settings area inside the plugin. There is no response when pushing the Connect button from the Settings area inside the plugin.

And when trying to refresh the connection by clicking the plugin on the toolbar in Firefox just says: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings.

I have also noticed that in KeepassXC itself, under Browser Integration, I have checkbox to "Enable KeepassXC browser integration" only. On the screenshots posted on the tips page you linked to, it shows checkboxes for Firefox, Chrome, Chromium, Vivaldi. But mine does not. All it says is "KeePassXC-Browser is needed for the browser integration to work. Download it for Firefox and...." with no checkboxes.

Maybe this is a new change in 2.40? or maybe it's a clue to why it's not integrating.

Can you check that the ~/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json file points to the right path (the path variable in the file should point to snap's location of keepassxc-proxy)?

The check boxes missing are by design for the snap. It is sandboxed and cannot install the necessary files by itself. Thus the helper script.

@droidmonkey - thank you.

@varjolintu - the .json file you mentioned contains:
{
"allowed_extensions": [
"[email protected]"
],
"description": "KeePassXC integration with native messaging support",
"name": "org.keepassxc.keepassxc_browser",
"path": "/usr/bin/keepassxc-proxy",
"type": "stdio"
}

However, on my system there is no "keepassxc-proxy" file in /usr/bin/.

There IS a "keepassxc-proxy" file inside /snap/keepassxc/191/usr/bin/.

I've edited the .json file to reflect the different address thusly:

{
"allowed_extensions": [
"[email protected]"
],
"description": "KeePassXC integration with native messaging support",
"name": "org.keepassxc.keepassxc_browser",
"path": "/snap/keepassxc/191/usr/bin/keepassxc-proxy",
"type": "stdio"
}

Now, the browser plug in says:
"Message encryption failed. Is KeePassXC running?"

So the script didn't work correctly. The script uses a path /snap/bin/keepassxc.proxy which you can also try.

That error means KeePassXC is not running when you are trying to establish a connection.

Don't point directly to the binary in the snap folder. The correct binary is /snap/bin/keepassxc.proxy

@droidmonkey, @varijolintu - thank you both.

I have updated ~/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json, with:

{
"allowed_extensions": [
"[email protected]"
],
"description": "KeePassXC integration with native messaging support",
"name": "org.keepassxc.keepassxc_browser",
"path": "/snap/bin/keepassxc.proxy",
"type": "stdio"
}

and SUCCESS. Upon clicking the browser plugin's icon on Firefox's toolbar, KeePassXC prompted for a new key association request for access to the database.

It is now working normally. Many thanks to both of you.

I am really confused. The keepassxc-snap-helper.sh script writes the exact file information you pasted in your last message. From the script:

https://github.com/keepassxreboot/keepassxc/blob/d7660dad3774ee5192e3ce1728cb4945b1e834dc/utils/keepassxc-snap-helper.sh#L23-L32

When varjolintu first asked for the contents of the .json file (which was after I had run the browser help script multiple times without successfully connecting to the database), upon first opening that file, the path in that .json showed:

"path": "/usr/bin/keepassxc-proxy"

Then, upon your and his/her suggestion to manually change the path in that .json file, it became:

"path": "/snap/bin/keepassxc.proxy"

For whatever reason, the old version had /usr/bin/ and the new is using /snap/bin/. In addition, the path in the first version had a hyphen between keepassxc and proxy, and the new replaces it with a period.

Perhaps the /usr/bin/ was left there from my prior installation from the Debian repositories?

In any case, it seems that the script didn't work for me, or at least not write the path. Once I used bash instead of sh, the script did not give an error and seemed to complete normally.

I do know that it's working well now, as I've been using it all evening.

Thanks for the synopsis, I'll poke around to see if I can make it more robust.

I have to report that it doesn't work for me, even though the path seems to be the right one:

{
    "name": "org.keepassxc.keepassxc_browser",
    "description": "KeePassXC integration with native messaging support",
    "path": "/snap/bin/keepassxc.proxy",
    "type": "stdio",
    "allowed_extensions": [
        "[email protected]"
    ]
}

~
~

However, on my system there is no "keepassxc-proxy" file in /usr/bin/.

There IS a "keepassxc-proxy" file inside /snap/keepassxc/191/usr/bin/.

I guess the solution for that is to run
snap enable keepassxc

Was this page helpful?
0 / 5 - 0 ratings