element-desktop on linux won't start if user is not in /etc/passwd
Steps to reproduce
Used element-desktop as Snap on Ubunut 22.04 for months without problem, but was unable to start since some update a few weeks ago (around version 1.11.86).
I can reproduce the issue on Ubuntu 22.04 and 24.04 using the latest version provided as .deb package from element.io (version 1.11.89) or Snap (version 1.11.88).
"element-desktop" simply doesn't start. Starting on the commandline gives:
/usr/share/libdrm/amdgpu.ids: No such file or directory
A JavaScript error occurred in the main process
Uncaught Exception:
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
at Object.userInfo (node:os:365:11)
at file:///snap/element-desktop/119/opt/Element/resources/app.asar/node_modules/atomically/dist/constants.js:10:29
at ModuleJob.run (node:internal/modules/esm/module_job:234:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:473:24)
at async node:electron/js2c/browser_init:2:129567
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:137:5)
Gtk-Message: 08:32:40.075: Not loading module "atk-bridge": The functionality is provided by GTK natively. Please try to not load it.
[54394:1219/083240.282753:ERROR:zygote_host_impl_linux.cc(279)] Failed to adjust OOM score of renderer with pid 54507: Permission denied (13)
[54394:1219/083240.307017:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.Secret.Service.ReadAlias: object_path= /org/freedesktop/secrets: org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.1218" (uid=1020 pid=54394 comm="/snap/element-desktop/119/opt/Element/element-desk" label="snap.element-desktop.element-desktop (enforce)") interface="org.freedesktop.Secret.Service" member="ReadAlias" error name="(unset)" requested_reply="0" destination="org.freedesktop.secrets" (uid=1020 pid=14155 comm="/usr/bin/gnome-keyring-daemon --foreground --compo" label="unconfined")
/usr/share/libdrm/amdgpu.ids: No such file or directory
/usr/share/libdrm/amdgpu.ids: No such file or directory
/usr/share/libdrm/amdgpu.ids: No such file or directory
I searched a bit and found similar issues like this one: https://github.com/microsoft/vscode/issues/204178
Main issue seems to be that element-desktop expects that the user has an entry in /etc/passwd, while I'm logged in with an account which is defined in a LDAP directory server. So the user is not in /etc/passwd, but correctly listed for example by "getent passwd".
As a workaround I can add the user to /etc/passwd manually and start element-desktop.
Outcome
What did you expect?
element-desktop starts
What happened instead?
element-desktop is stucked and no window appears
Operating system
Ubuntu 24.04
Application version
1.11.89
How did you install the app?
deb package from https://element.io/download#linux
Homeserver
matrix.log
Will you send logs?
No
Looks to be upstream issue with https://github.com/sindresorhus/electron-store
~/W/element-desktop develop yarn why atomically Thu Dec 19 09:19:40 2024
yarn why v1.22.22
[1/4] 🤔 Why do we have the module "atomically"...?
[2/4] 🚚 Initialising dependency graph...
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/node@^17.0.36"
warning Resolution field "@types/[email protected]" is incompatible with requested version "@types/node@^20.9.0"
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists
- "electron-store#conf" depends on it
- Hoisted from "electron-store#conf#atomically"
info Disk size without dependencies: "180KB"
info Disk size with unique dependencies: "420KB"
info Disk size with transitive dependencies: "420KB"
info Number of shared dependencies: 2
✨ Done in 0.18s.
Looks like that is the built-in way for Node to get your UID/GID
https://nodejs.org/api/os.html#osuserinfooptions