brave-browser: Brave won't start with "Preferred Ozone platform" flag set to "Wayland" on snap package (Ubuntu)
Description
If I set “Preferred Ozone platform” to “Wayland” in brave://flags, Brave won’t be able to start anymore.
Brave (1.42.97) was installed as a snap package on Ubuntu 22.04 (wayland is set as default). On same version of Brave installed using apt package manager from Brave apt repository I can enable this flag without any problems.
Reason why I want this flag enabled is so I can get gestures (Wayland) working (pinch too zoom) and being able use Brave rewards on Wayland (related: #13833, #9592).
Steps to Reproduce
brave --enable-features=UseOzonePlatform -ozone-platform=wayland
or
- Go to brave://flags
- Set “Preferred Ozone platform” flag to “Wayland” and restart Brave
- Try to start brave
Actual result:
Running brave in terminal will return following error:
[369020:369020:0830/173559.626648:ERROR:wayland_connection.cc(214)] Failed to connect to Wayland display
[369020:369020:0830/173559.626716:ERROR:ozone_platform_wayland.cc(227)] Failed to initialize Wayland platform
[369020:369020:0830/173559.626729:ERROR:env.cc(226)] The platform failed to initialize. Exiting.
[0830/173559.629908:ERROR:ptracer.cc(567)] ptrace: Input/output error (5)
[0830/173559.630099:ERROR:ptracer.cc(567)] ptrace: Input/output error (5)
[0830/173559.666067:ERROR:elf_dynamic_array_reader.h(64)] tag not found
/snap/brave/174/opt/brave.com/brave/brave-browser: line 48: 369020 Trace/breakpoint trap (core dumped) "$HERE/brave" "$@"
Expected result:
Brave will start.
Reproduces how often:
Easily reproduced
Brave version (brave://version info)
Brave 1.42.97 Chromium: 104.0.5112.102 (Official Build) (64-bit)
Revision 8e5396254975ef939f2ef7d0bd334e48a052b536-refs/branch-heads/5112@{#1478}
OS Linux
JavaScript V8 10.4.132.22
User Agent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.102 Safari/537.36
Command Line /snap/brave/174/opt/brave.com/brave/brave --enable-crashpad --disable-domain-reliability --enable-dom-distiller --component-updater=url-source=https://go-updater.brave.com/extensions --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --sync-url=https://sync-v2.brave.com/v2 --lso-url=https://no-thanks.invalid --variations-server-url=https://variations.brave.com/seed --variations-insecure-server-url=https://variations.brave.com/seed --enable-features --disable-features --flag-switches-begin --flag-switches-end --desktop-startup-id=gnome-shell/Brave Web Browser/3009-40-carbon7_TIME44741826
Executable Path /snap/brave/174/opt/brave.com/brave/brave
Profile Path /home/ahodzic/snap/brave/174/.config/BraveSoftware/Brave-Browser/Default
Active Variations ExtendedVariationsSafeMode5:SignalAndWriteViaFileUtil5
Version/Channel Information:
As mentioned above, this problem doesn’t exist when Brave is installed using apt package manager.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 6
- Comments: 16
This also works with the snapped Chromium, including gestures.
Workarounds are either to install Brave through a PPA, but this messes with the system and offsets the security and isolation benefits of the snap version, or to use the snap version with Xwayland, which results in a blurry mess for those who require fractional scaling.
I hope this will be fixed.
Actually on Firefox Snap beta channel (v105) on Ubuntu 22.04 absolutely everything works out of the box, including Wayland gestures pinch to zoom, swipe left/right for back/forward.
This is due to snap security profiles. Firefox doesn’t work either
I have used your script targodan on my Ubuntu Laptop, “works perfectly” I just had to point it to the right directory “/snap/bin/brave” I will add it in full below in case anyone else with Ubuntu wants to try it out.
Cheers guys.
#!/bin/bash
SNAP_WAYLAND_DISPLAY=$(snap run --shell brave -c env | grep WAYLAND_DISPLAY= | cut -d= -f2) SNAP_XDG_RUNTIME_DIR=$(snap run --shell brave -c env | grep XDG_RUNTIME_DIR= | cut -d= -f2)
ln -sf “$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY” “$SNAP_XDG_RUNTIME_DIR/$SNAP_WAYLAND_DISPLAY” ln -sf “$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY.lock” “$SNAP_XDG_RUNTIME_DIR/$SNAP_WAYLAND_DISPLAY.lock” ln -sf “$XDG_RUNTIME_DIR/pipewire-0” “$SNAP_XDG_RUNTIME_DIR/” ln -sf “$XDG_RUNTIME_DIR/pipewire-0.lock” “$SNAP_XDG_RUNTIME_DIR/” ln -sf “$XDG_RUNTIME_DIR/pipewire-0-manager” “$SNAP_XDG_RUNTIME_DIR/” ln -sf “$XDG_RUNTIME_DIR/pipewire-0-manager.lock” “$SNAP_XDG_RUNTIME_DIR/”
exec /snap/bin/brave --enable-features=UseOzonePlatform -ozone-platform=wayland
I’ve been thinking of getting rid of the snap version for a while but I wasn’t sure how to keep the data from my snap version.
Thanks for the help.