Skip to content
This repository has been archived by the owner on Jul 23, 2022. It is now read-only.

bitwarden snap fails to launch #56

Closed
popey opened this issue Mar 2, 2018 · 25 comments
Closed

bitwarden snap fails to launch #56

popey opened this issue Mar 2, 2018 · 25 comments

Comments

@popey
Copy link

popey commented Mar 2, 2018

I just installed the bitwarden snap from the store on 18.04.

Looks like you're missing a libssl or related stage package.

A JavaScript error occurred in the main process
Uncaught Exception:
Error: libsecret-1.so.0: cannot open shared object file: No such file or directory
    at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
    at Object.Module._extensions..node (module.js:598:18)
    at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:186:18)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/snap/bitwarden/3/resources/app.asar/node_modules/keytar/lib/keytar.js:1:169)
    at Object.<anonymous> (/snap/bitwarden/3/resources/app.asar/node_modules/keytar/lib/keytar.js:61:3)
@kspearrin
Copy link
Member

We've been trying to get the snap working, but was not able to get any kind of stack trace on the errors. How did you get that stack trace?

@kspearrin
Copy link
Member

@kspearrin
Copy link
Member

@popey Any update here? We'd like to get this snap out but are having a hard time debugging it.

@popey
Copy link
Author

popey commented Mar 5, 2018

I just installed your snap out of the store and did snap run bitwarden and got the error above.

How are you currently building bitwarden? I'm trying to debug it here, but I can't even get it to build. If I grab your source and npm install then npm run dist:lin it falls over. https://paste.ubuntu.com/p/skBp75WJQS/ is the full output.

Essentially what I wanted to do was add libsecret-1-0 as a stage-package in your package.json to try and build with that.

You can try this yourself by adding a snap stanza and populating it like this..

   "snap": {
    "plugs": ["default", "password-manager-service"],
    "stagePackages": ["default", "libsecret-1-0"]
   },

It's possible we may also need to add another stage package, but this will get us passed the first issue I identified above.

@kspearrin
Copy link
Member

@popey

Looks like you don't have the jslib submodule is why it is failing for you on the dist:build script. Did you run npm install?

I was trying to run the snap via just clicking bitwarden icon after install. I guess I need to use snap run from terminal to get more feedback. I'll try another build with your package.json suggestions soon and report back.

@popey
Copy link
Author

popey commented Mar 5, 2018

I did do npm install, yes.

@kspearrin
Copy link
Member

@popey I am still not sure why you cannot build yourself. Maybe try npm run sub:update? Is there anything in ./jslib folder?

I just tried again after adding the following to package.json:

   "snap": {
    "confinement": "devmode",
    "plugs": ["default", "password-manager-service"],
    "stagePackages": ["default", "libsecret-1-0"]
   },

and I get:

$ sudo snap install bitwarden_1.0.5_amd64.snap --devmode
error: cannot install snap file: snap is unusable due to missing files; contact
developer

Any ideas?

@popey
Copy link
Author

popey commented Mar 6, 2018

I tried npm run sub:update and it returned fine.

root@electron:~/desktop# npm run sub:update

> [email protected] sub:update /root/desktop
> git submodule update --remote



   ╭─────────────────────────────────────╮
   │                                     │
   │   Update available 5.6.0 → 5.7.1    │
   │     Run npm i -g npm to update      │
   │                                     │
   ╰─────────────────────────────────────╯

root@electron:~/desktop# npm install

Then I did npm install again for good measure....

root@electron:~/desktop# npm install
npm WARN lifecycle [email protected]~postinstall: cannot run in wd %s %s (wd=%s) [email protected] electron-rebuild && npm run sub:init /root/desktop
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/app-builder-bin-mac):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/7zip-bin-win):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/app-builder-bin-win):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/dmg-builder/node_modules/app-builder-bin-mac):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/dmg-builder/node_modules/app-builder-bin-win):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"win32","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/7zip-bin-mac):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

Then did npm run dist:lin which failed in the same way.

I am clearly missing a step I think. Are you able to build it in a clean machine ? I used lxc to create a clean 16.04 machine, and then installed node version v8.9.4, git and other build tools. I may have missed some dependency though.

Odd that you get a broken snap out of the build! Can you share the snap so I can look at it?

@kspearrin
Copy link
Member

kspearrin commented Mar 6, 2018

@popey Our CI does clean builds every time. See process here: https://travis-ci.org/bitwarden/desktop

Let me see if I can upload the snap.

@kspearrin
Copy link
Member

Here's the snap I just built with those changes: https://send.firefox.com/download/9004179935/#zDi3uMZglZIj3D6pcR4zvA

@popey
Copy link
Author

popey commented Mar 6, 2018

Ok! I finally got it to build thanks to reading your travis output. Thanks! I'd missed the git submodule update --init --recursive. I patched it and now also get the same issue you have. error: cannot install snap file: snap is unusable due to missing files; contact developer which is documented on our forum at https://forum.snapcraft.io/t/snapd-is-now-doing-a-little-sanity-check-on-install/3566/ (this was new to me too!).

Here's an extra thing you can do. The store does a review of snaps before they can be released. You can get the same review tools which can check your snap for sanity. Here's how.

$ snap install review-tools --edge
review-tools (edge) 0.48+git from 'jdstrand' installed

Now run the review on the snap:-

$ snap-review ../bitwarden_1.0.5_amd64.snap 
Errors
------
 - lint-snap-v2:command:bitwarden
        command.sh does not exist
../bitwarden_1.0.5_amd64.snap: FAIL

Aha! What's "command.sh"? Looks like that's coming from electron-builder?

@kspearrin
Copy link
Member

@popey

It's weird that wasn't run for you automatically by package.json's postinstall script.

Anyways, I found this. Looks like it was fixed in 20.2.1. I updated electron-builder now and it builds and runs!

I can log into an account, however, it seems that rendering data in the vault is broken. Investigating further shows that none of my synced data is in the data.json file at ~/snap/bitwarden/current/appdata/data.json. There is some data there, so it seems that it can write to that file. Need to figure out why the vault data is not getting in there after a sync though. No errors being thrown in the console by the app so I am not sure at this point.

@popey
Copy link
Author

popey commented Mar 7, 2018

Ok, it's now failing because one of the node modules you're using (atomic) is trying to do a chown which is being blocked our confinement. We're looking into this.

@kspearrin
Copy link
Member

Great. Let me know if anything changes, but shouldn't devmode confinement not be restricted at all? I thought that was the point of it?

@popey
Copy link
Author

popey commented Mar 8, 2018

In theory, but there's a bug. It's now fixed and should land in snapd 2.32. Once that is released I'll get back to you so we can move forward.

@kspearrin
Copy link
Member

@popey Anything changed yet regarding this?

@popey
Copy link
Author

popey commented Apr 17, 2018

@kspearrin apologies for the delay getting back to you. 2.32 has been released, so you should be good to go. if you want to push a built to the edge channel, I can help test that.

@kspearrin
Copy link
Member

Built in devmode and got it all running without issue. I see these messages in terminal though, not sure if they are a problem or not:

$ sudo snap install ./bitwarden_1.2.0_amd64.snap --devmode
bitwarden 1.2.0 installed
$ snap run bitwarden --dev-mode
Gtk-Message: Failed to load module "overlay-scrollbar"
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "unity-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

When I try to install it with a confinement strict build I get:

$ sudo snap install ./bitwarden_1.2.0_amd64.snap 
error: cannot find signatures with metadata for snap "./bitwarden_1.2.0_amd64.snap"

Any ideas?

@kspearrin
Copy link
Member

kspearrin commented Apr 18, 2018

@popey I got around the above mentioned error by using the --dangerous flag.

One last problem I see. When running in strict mode, I now see this error:

$ snap run bitwarden
Gtk-Message: Failed to load module "overlay-scrollbar"
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "unity-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
** Message: Remote error from secret service: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.110" (uid=1000 pid=22459 comm="/snap/bitwarden/x1/app/bitwarden ") interface="org.freedesktop.Secret.Service" member="SearchItems" error name="(unset)" requested_reply="0" destination=":1.2" (uid=1000 pid=1389 comm="/usr/bin/gnome-keyring-daemon --daemonize --login ")

I am guessing this will prevent the app from using the gnome keyring when trying to persist the encryption key on the device (Settings -> Lock Options -> Never).

I thought we added the needed plug and packages for this though?

    "snap": {
      "confinement": "strict",
      "plugs": ["default", "password-manager-service"],
      "stagePackages": ["default", "libsecret-1-0"]
     } 

@popey
Copy link
Author

popey commented Apr 18, 2018

According to https://docs.snapcraft.io/reference/interfaces the password-manager-service is not autoconnected. So after installing you need to snap connect bitwarden:password-manager-service. If that works we can request that it's auto connected by an assertion in the store. So end users wouldn't have to connect it themselves as above.

@kspearrin
Copy link
Member

Looks like that solved it! The only things left are the Gtk-Message: outputs, which don't appear to be affecting anything that I can see. Any idea what those are all about?

@popey
Copy link
Author

popey commented Apr 18, 2018

I don't believe they're a problem as such, all apps which use the desktop-gtk launchers spit that garbage out :). Glad to see it's all fixed now!

@kspearrin
Copy link
Member

@popey I pushed 1.2.0 to the snap store. Seems to be working in my tests.

https://snapcraft.io/bitwarden

If that works we can request that it's auto connected by an assertion in the store. So end users wouldn't have to connect it themselves as above.

What do I need to do to make this happen?

@popey
Copy link
Author

popey commented Apr 19, 2018

Awesome! Create a thread on the store category on the forum, requesting autoconnection.

@kspearrin
Copy link
Member

I have opened the auto connection request here: https://forum.snapcraft.io/t/auto-connecting-the-password-manager-service-interface-for-the-bitwarden-snap/5051

Closing this topic now. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants