bitwarden / clients

Bitwarden client apps (web, browser extension, desktop, and cli).
https://bitwarden.com
Other
8.93k stars 1.16k forks source link

Not autostarting on linux #6181

Closed bjnobre closed 11 months ago

bjnobre commented 11 months ago

Steps To Reproduce

Set autstart option, on configuration menu.

Expected Result

App auto starting after logging

Actual Result

The option stays set, but when I log, after a reboot, or re-open the app, after closing it, the option is unset. I ran it from a terminal and got the follow error on console:

(node:2) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, mkdir '/home/jarvis/.config/autostart' at Object.mkdirSync (node:fs:1395:3) at MessagingMain.addOpenAtLogin (/app/Bitwarden/resources/app.asar/main.js:45819:30) at MessagingMain.onMessage (/app/Bitwarden/resources/app.asar/main.js:45750:22) at MessagingMain. (/app/Bitwarden/resources/app.asar/main.js:45722:151) at Generator.next () at /app/Bitwarden/resources/app.asar/main.js:45701:71 at new Promise () at messaging_main_awaiter (/app/Bitwarden/resources/app.asar/main.js:45697:12) at IpcMainImpl. (/app/Bitwarden/resources/app.asar/main.js:45722:79) at IpcMainImpl.emit (node:events:513:28) (node:2) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)

Screenshots or Videos

No response

Additional Context

No response

Operating System

Linux

Operating System Version

Arco linux [6.4.12-arch1-1]

Installation method

Other

Build Version

Version 2023.8.2 Shell 24.1.1 Renderer 112.0.5615.50 Node 18.14.0 Architecture x64 ----- flatpak version, form flathub

Issue Tracking Info

SergeantConfused commented 11 months ago

HI @bjnobre,

Thank you for your report; I was able to reproduce this and I have flagged it to our engineering team.

If you wish to add any further information/screenshots/recordings etc., please feel free to do so at any time - our engineering team will be happy to review these.

Thank you again,

Hinton commented 11 months ago

Hi @bjnobre,

This seems to be an issue with the flatpack permissions. The autostart functionality requires write access to the home directory which seems to be restricted in the flatpack.

Since the flatpack isn't distributed by Bitwarden I've opened a issue at https://github.com/flathub/com.bitwarden.desktop/issues/156. However since this has sandbox implications I'm not sure what their preference are on the topic.

Closing this since we're not maintaining the flatpack distribution.

bjnobre commented 11 months ago

I've switched to arco official extra repository version (see bellow) and it does'nt open, when I log on my account. Unlike the flatpak version, wich is unchecked after logon, the option to auto-start on this version still checked.

Version 2023.8.3 Shell 24.8.2 Renderer 112.0.5615.204 Node 18.14.0 Architecture x64

cassidyjames commented 11 months ago

FreeDesktop/GNOME/Flatpak/Flathub contributor here. 😄

The autostart functionality requires write access to the home directory which seems to be restricted in the flatpack.

Just for clarity, it doesn't require write access to the home directory if using the Background Portal, which is how permissions work across all modern Linux desktops. Portals work regardless of whether an app is packaged as a Flatpak or not, and they're standardized for interoperability. I think that would be the preferred route instead of accessing user files, anyway.

Hinton commented 11 months ago

@bjnobre Do you mean Arch? The only official Bitwarden distributions are the ones listed on the website, https://bitwarden.com/download/. AppImage, deb, rpm package and Snap. Can you launch it from the terminal and check if there are any error messages?

@cassidyjames Thanks for chiming in. I must admit I'm not well versed in the linux desktop environments. I did find a feature request for electron to add support for Background Portal https://github.com/electron/electron/issues/32388 unfortunately it hasn't seen much activity.

bjnobre commented 11 months ago

I mean ArcoLinux. I will install snap version and test it again.

Thanks!

bjnobre commented 11 months ago

I've tried and the same issue occurs. App version (snap): Version 2023.8.3 Shell 24.1.1 Renderer 112.0.5615.50 Node 18.14.0 Architecture x64

bjnobre commented 11 months ago

I run it from terminal, and there is no log when I change auto-start option. Here is the log messages at logon time: [jarvis@jarvis-bjnobreeng ~]$ bitwarden (node:10322) DeprecationWarning: file property is deprecated and will be removed in v5. (Use bitwarden --trace-deprecation ... to show where the warning was created) Gtk-Message: 18:52:44.146: Failed to load module "xapp-gtk3-module" Driver does not support the 0x4626 PCI ID. libGL error: failed to create dri screen libGL error: failed to load driver: iris Driver does not support the 0x4626 PCI ID. libGL error: failed to create dri screen libGL error: failed to load driver: iris [10395:0907/185244.222243:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization (node:10322) UnhandledPromiseRejectionWarning: TypeError: Cannot read properties of undefined (reading 'init') at BiometricsService. (/snap/bitwarden/93/resources/app.asar/main.js:47195:55) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47161:71 at new Promise () at biometrics_service_awaiter (/snap/bitwarden/93/resources/app.asar/main.js:47157:12) at BiometricsService.init (/snap/bitwarden/93/resources/app.asar/main.js:47194:16) at Main. (/snap/bitwarden/93/resources/app.asar/main.js:53060:46) at Generator.next () at fulfilled (/snap/bitwarden/93/resources/app.asar/main.js:52957:58) (node:10322) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2) Driver does not support the 0x4626 PCI ID. libGL error: failed to create dri screen libGL error: failed to load driver: iris Driver does not support the 0x4626 PCI ID. libGL error: failed to create dri screen libGL error: failed to load driver: iris [10456:0907/185244.303222:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization Driver does not support the 0x4626 PCI ID. [10442:0907/185244.331142:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer. 18:52:44.595 › Error: No password found 18:52:44.604 › Error: No password found 18:52:44.620 › Error: No password found 18:52:44.621 › Error: No password found 18:52:44.621 › Error: No password found 18:52:44.634 › Error: No password found 18:52:44.641 › TypeError: Cannot read properties of undefined (reading 'osSupportsBiometric') at BiometricsService. (/snap/bitwarden/93/resources/app.asar/main.js:47200:55) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47161:71 at new Promise () at biometrics_service_awaiter (/snap/bitwarden/93/resources/app.asar/main.js:47157:12) at BiometricsService.osSupportsBiometric (/snap/bitwarden/93/resources/app.asar/main.js:47199:16) at BiometricsService. (/snap/bitwarden/93/resources/app.asar/main.js:47210:58) at Generator.next () at fulfilled (/snap/bitwarden/93/resources/app.asar/main.js:47158:58) 18:52:44.641 › TypeError: Cannot read properties of undefined (reading 'osSupportsBiometric') at BiometricsService. (/snap/bitwarden/93/resources/app.asar/main.js:47200:55) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47161:71 at new Promise () at biometrics_service_awaiter (/snap/bitwarden/93/resources/app.asar/main.js:47157:12) at BiometricsService.osSupportsBiometric (/snap/bitwarden/93/resources/app.asar/main.js:47199:16) at DesktopCredentialStorageListener. (/snap/bitwarden/93/resources/app.asar/main.js:47384:59) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47312:71 at new Promise () 18:52:45.023 › Error: No password found 18:52:45.618 › Error: No password found 18:52:45.843 › Error: No password found 18:52:45.873 › Error: No password found 18:52:45.906 › Error: No password found 18:52:45.932 › Error: No password found 18:52:45.937 › Error: No password found 18:52:45.963 › Error: No password found 18:52:45.964 › Error: No password found 18:52:45.992 › Error: No password found 18:52:46.007 › Error: No password found 18:52:46.012 › Error: No password found 18:52:46.014 › Error: No password found 18:52:46.261 › Error: No password found 18:52:47.621 › Error: No password found 18:52:54.608 › Error: No password found 18:52:57.266 › Error: No password found 18:52:57.286 › TypeError: Cannot read properties of undefined (reading 'deleteBiometricKey') at BiometricsService. (/snap/bitwarden/93/resources/app.asar/main.js:47253:55) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47161:71 at new Promise () at biometrics_service_awaiter (/snap/bitwarden/93/resources/app.asar/main.js:47157:12) at BiometricsService.deleteBiometricKey (/snap/bitwarden/93/resources/app.asar/main.js:47251:16) at DesktopCredentialStorageListener. (/snap/bitwarden/93/resources/app.asar/main.js:47435:45) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47312:71 at new Promise () 18:52:57.288 › TypeError: Cannot read properties of undefined (reading 'deleteBiometricKey') at BiometricsService. (/snap/bitwarden/93/resources/app.asar/main.js:47253:55) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47161:71 at new Promise () at biometrics_service_awaiter (/snap/bitwarden/93/resources/app.asar/main.js:47157:12) at BiometricsService.deleteBiometricKey (/snap/bitwarden/93/resources/app.asar/main.js:47251:16) at DesktopCredentialStorageListener. (/snap/bitwarden/93/resources/app.asar/main.js:47435:45) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47312:71 at new Promise () 18:52:59.122 › TypeError: Cannot read properties of undefined (reading 'osSupportsBiometric') at BiometricsService. (/snap/bitwarden/93/resources/app.asar/main.js:47200:55) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47161:71 at new Promise () at biometrics_service_awaiter (/snap/bitwarden/93/resources/app.asar/main.js:47157:12) at BiometricsService.osSupportsBiometric (/snap/bitwarden/93/resources/app.asar/main.js:47199:16) at DesktopCredentialStorageListener. (/snap/bitwarden/93/resources/app.asar/main.js:47384:59) at Generator.next () at /snap/bitwarden/93/resources/app.asar/main.js:47312:71 at new Promise ()

Hinton commented 11 months ago

@bjnobre which desktop environment are you using? It's possible it doesn't support .config/autostart. Can you also verify there is a file in~/.config/autostart` for bitwarden?

bjnobre commented 11 months ago

I just found my WM (qtile) utilizes another method to autostart apps. It uses a script on a config folder. I realize it occurs with another app too. I'did set it on its config script and bw just run after login.

Thank you all for your attention.

Hinton commented 11 months ago

No problems, glad it resolved itself.

savely-krasovsky commented 2 months ago

@Hinton it shouldn't be closed. The best way is still to implement the Background portal. In that case autostart will work for everyone.

cc @quexten

quexten commented 2 months ago

@savely-krasovsky I agree, the portal is the right way to do this, at least on Flatpak. I have created an internal issue tracking this. I will note though that Flatpak is currently not an officially supported distribution method, and there is no QA process for it, making PR's in this regard a bit tricky.

savely-krasovsky commented 2 months ago

@quexten thank you! Sorry if you are a wrong person to mention, but at least you seemed the only with deep Linux background.

quexten commented 1 month ago

I created https://github.com/electron/electron/pull/42727 for upstream electron. Should they merge it, and once bitwarden desktop's electron version gets upgraded, this should be resolved on flatpak.

savely-krasovsky commented 1 month ago

Thank you very much. Yeah, Electron is definitely a better place to fix it.