~fgaz/nix-bubblewrap#2: 
doesn't work with element-desktop

Not sure where it's normally finding icudtl.dat:

$ nix-shell -p element-desktop --run "result/bin/nix-bwrap element-desktop"
[1004/074200.818105:ERROR:icu_util.cc(145)] Can't find icudtl.dat
[1004/074200.818158:ERROR:icu_util.cc(225)] Invalid file descriptor to ICU data received.

Of course this could be a nix-bwrap problem or perhaps more likely a problem with the element-desktop packaging, but since I encountered it running nix-bwrap I'm sharing it here first for further analysis ;)

Status
REPORTED
Submitter
~raboof
Assigned to
No-one
Submitted
2 years ago
Updated
2 years ago
Labels
No labels applied.

~fgaz 2 years ago

By default nix-bubblewrap is very restrictive: it just gives access to the package closure, but most packages need more. The error you encountered is fixed by passing -gpu to nix-bwrap, but for element desktop to work properly you'll need to also pass -net, -x11 (I didn't test it on wayland yet, patches welcome), and -pulse or -alsa, and probably more if you also want the webcam to work (again, patches welcome).

You probably also want to add something like

-bwrap-options "--bind $HOME/.config/Element $HOME/.config/Element"

if you want your data to persist across sessions.

~raboof 2 years ago

Thanks, that helps!

Indeed I had to tweak slightly since I'm using a profile:

result/bin/nix-bwrap -gpu -x11 -net -bwrap-options "--bind $HOME/.config/Element-matrixorg $HOME/.config/Element-matrixorg" element-desktop --profile matrixorg

This showed my chat window once, but now just presents me with a blank screen after showing the auto-login spinner for a while. Looks like some problem in element I guess... nothing obvious in the logs AFAICS:

Fontconfig error: Cannot load default config file: No such file: (null)
/home/aengelen/.config/Element-matrixorg exists: yes
/home/aengelen/.config/Riot-matrixorg exists: no
LaunchProcess: failed to execvp:
xdg-settings
Fontconfig error: Cannot load default config file: No such file: (null)
[2:1006/100237.606692:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[2:1006/100237.606748:ERROR:bus.cc(398)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[2:1006/100237.609177:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[2:1006/100237.609216:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
No update_base_url is defined: auto update is disabled
[2:1006/100237.632722:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[2:1006/100237.633533:ERROR:platform_font_skia.cc(245)] Could not find any font: Sans, sans. Falling back to the default
Fetching translation json for locale: en_EN
Changing application language to en-us
Fetching translation json for locale: en-us
Resetting the UI components after locale change
[2:1006/100237.652241:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Resetting the UI components after locale change
[2:1006/100237.654616:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")

(electron:2): libappindicator-WARNING **: 10:02:37.662: Unable to get the session bus: Unknown or unsupported transport ?disabled? for address ?disabled:?

(electron:2): LIBDBUSMENU-GLIB-WARNING **: 10:02:37.663: Unable to get session bus: Unknown or unsupported transport ?disabled? for address ?disabled:?
[2:1006/100237.776104:ERROR:browser_main_loop.cc(270)] Gdk: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
Changing application language to en-us
Fetching translation json for locale: en-us
Resetting the UI components after locale change
[2:1006/100237.945206:ERROR:bus.cc(398)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
Error getting the event index passphrase out of the secret store [Error: Unknown or unsupported transport “disabled” for address “disabled:”]
[2:1006/100240.083368:ERROR:platform_font_skia.cc(245)] Could not find any font: Sans, sans. Falling back to the default

(the font errors seem harmless, as they also show when starting without a profile, and then the login screen is rendered fine with fonts and all)

~fgaz 2 years ago

Looks like it needs dbus access. Try passing through $DBUS_SESSION_BUS_ADDRESS and adding a ro-bind for the path present in that variable.

By the way, the arch wiki is a great resource for fixing these type of errors: https://wiki.archlinux.org/title/Bubblewrap

~fgaz 2 years ago

In flatpak it's actually possible to give restricted access to dbus (see --talk-name here). I wonder if/how that can be done with only bubblewrap. I don't see similar flags in its --help.

Register here or Log in to comment, or comment via email.