Stop Element Desktop Crashes on Wayland with Xwayland

If Element Desktop began crashing or stopped opening after a Linux or app update, first test it through Xwayland: close every Element process, then launch element-desktop --ozone-platform=x11 from a terminal. Electron 38 changed its default to use native Wayland in a Wayland session, and Electron documents the Xwayland flag as the way to return to the X11 compatibility path. If that makes Element stable, you have a practical workaround while you check for an updated package or a compositor-specific issue.

This does not prove Wayland is the cause in every case. Element is an Electron application, but crashes can also come from a stale package, graphics drivers, extensions, or local configuration. Use the steps below to isolate the problem without deleting account data.

Why the Wayland change matters

Wayland is the display protocol used by many current Linux desktops. Xwayland is a compatibility layer that lets traditional X11 applications run inside a Wayland session. Electron 38 changed its Ozone platform default to auto; when XDG_SESSION_TYPE=wayland, Electron now runs natively on Wayland by default. Electron also removed the older ELECTRON_OZONE_PLATFORM_HINT environment variable. The documented switch for forcing Xwayland is --ozone-platform=x11. See Electron’s breaking changes documentation.

Element Desktop runs Element Web inside Electron. Its desktop code now lives in the Element Web repository, and the project documents the desktop app as Electron-wrapped. Element’s downloads page currently provides the official Linux installation route for Debian and Ubuntu and links to community-maintained packages for other distributions. Package behavior can vary by distribution and packaging format.

1. Confirm the session and capture the failure

Open a terminal and check which display session is active:

echo "$XDG_SESSION_TYPE"
element-desktop --version

If the first command prints wayland, the session is Wayland. If it prints x11, the Electron Wayland-default change is less likely to explain the crash. The version command may be unavailable for some packaging formats; if so, check the app’s About screen or your package manager.

Start Element from that same terminal and keep the output visible:

element-desktop

Record the first error printed before the window exits, along with your Linux distribution, desktop environment, graphics driver, Element version, and installation type (for example, the Element APT package, Flatpak, or a community package). Do not publish access tokens, message contents, or private account data when sharing logs.

2. Test Element through Xwayland

Close Element completely before starting the test. Check for remaining processes and stop only Element processes if needed:

pgrep -a element

If the process is stuck, close it from your desktop’s system monitor, or use pkill element-desktop after confirming the listed process is Element. Then run:

element-desktop --ozone-platform=x11

For the official Debian/Ubuntu package, the executable is normally element-desktop. Other packages may use a different launcher. For Flatpak, try passing the switch after the application ID:

flatpak run im.riot.Riot --ozone-platform=x11

If that application ID is not installed on your system, use flatpak list to find the Element app ID and substitute it. Do not add the flag to a random wrapper command without checking the package’s launch syntax.

Try the app for several minutes and repeat the action that previously triggered the crash. If it remains open, use the Xwayland launch as a temporary workaround. Electron notes that some window behaviors differ between native Wayland and Xwayland; for example, certain programmatic window sizing and positioning operations are restricted under Wayland. The Electron BrowserWindow documentation describes this limitation and the Xwayland switch.

3. Make the workaround persistent only if it helps

For a one-time test, the terminal command is safest because it changes no files. If it consistently resolves the crash, you can add the argument to your desktop launcher. The exact method depends on how Element was installed:

  • APT or a standalone package: copy the system launcher into your user applications directory, then edit the copied launcher's Exec= line to append --ozone-platform=x11. Do not edit the vendor file under /usr/share/applications; package updates may replace it.
  • Flatpak: use your desktop environment’s application editor if available, or create a user-level launcher that runs flatpak run im.riot.Riot --ozone-platform=x11. Confirm the installed app ID first.

Keep the original launcher command and add the flag after the executable or Flatpak app ID. Avoid broad shell changes such as exporting an obsolete ELECTRON_OZONE_PLATFORM_HINT; Electron 38 removed that variable. You can remove the added argument later to return to native Wayland.

4. If Xwayland does not stop the crash

Update Element from the package source you originally used, then retest with the normal launcher and with the Xwayland flag. The official Element download page lists its current Linux instructions. Avoid mixing packages from different sources, because duplicate installations can leave multiple launchers and versions on the same system.

If the crash continues, test whether the graphics path is involved by launching once with GPU acceleration disabled:

element-desktop --disable-gpu

This is a diagnostic test, not a preferred permanent setting. If it changes the behavior, update your graphics driver through your distribution’s supported method and check for known compositor or GPU-driver issues. Do not combine many Chromium flags at once; one change per test makes the result useful.

You can also check whether the problem is limited to the current local profile. Do not delete ~/.config/Element or the Flatpak data directory as a first step: they may contain local app state and removing them can sign you out or discard unsynced data. A safer first check is to launch a separate temporary profile if your build supports Electron’s --user-data-dir option, pointing it to a new directory under /tmp. Treat that as a diagnostic only, and do not sign in if you do not need to test account behavior. If a clean profile changes the result, preserve the original directory and investigate local state rather than erasing it.

Verify the fix

After the change, launch Element several times, open the conversation or view that previously triggered the crash, and leave it running long enough to reproduce the original condition. Confirm that the terminal no longer reports the same fatal error. Then test the normal launcher again after updating: if the crash returns only in native Wayland mode, keep the documented Xwayland workaround and report the details to Element with your version, distribution, compositor, GPU driver, launch command, and sanitized logs.

Element’s issue tracker includes an Ubuntu 24.04 report in which a user described the app failing to open under Wayland and reported GBM buffer export errors. That issue demonstrates one reported graphics-path failure, not a universal diagnosis or a confirmed fix for every system. See the Element project issue for the report. If Xwayland and a clean package update do not help, your terminal output and system details are more useful than repeatedly changing unrelated settings.

Leave a Comment

Get Element Android Notifications Without Google Services

Set up Element Android with UnifiedPush and ntfy, then check the self-hosted Matrix gateway and Android background settings when alerts fail.

Get Nextcloud iPhone Photo Uploads Running in the Background

Get Nextcloud iPhone Photo Uploads Running in the Background

Restore background photo detection by checking Nextcloud upload settings, iOS permissions, battery mode, and the limits of iPhone background scheduling.

Clearer Text in ONLYOFFICE Desktop: Tune Font Hinting on Linux

Clearer Text in ONLYOFFICE Desktop: Tune Font Hinting on Linux

Compare ONLYOFFICE font hinting modes, check zoom and Linux font availability, and verify whether blur is limited to the editor or affects the whole desktop.

Turn a PDF into an Editable DOCX in ONLYOFFICE Desktop

Turn a PDF into an Editable DOCX in ONLYOFFICE Desktop

Convert a PDF locally in ONLYOFFICE Desktop Editors, then review the DOCX for layout changes, scanned pages, and text that needs correction.

Connect ONLYOFFICE Desktop Editors to Your ownCloud Files

Add your ownCloud account to ONLYOFFICE Desktop Editors, understand what the connection enables, and choose between direct access, sync, and browser editing.

Fix ONLYOFFICE Mobile Timeouts by Checking the Server URL

Fix ONLYOFFICE Mobile Timeouts by Checking the Server URL

Use the right portal or WebDAV address, test HTTPS reachability from your phone, and distinguish private-network, TLS, and login problems.

Enable ONLYOFFICE Desktop Plugin Development and Debugging

Enable ONLYOFFICE Desktop Plugin Development and Debugging

Build and test a custom ONLYOFFICE Desktop Editors plugin, install its .plugin archive, and activate developer tools for debugging.

Run Python in Calc Through LibreOffice’s Macro System

Run Python in Calc Through LibreOffice’s Macro System

Make a Python function available in Calc, run it against the open spreadsheet, and troubleshoot missing macros or imports without mixing up LibreOffice and system Python.

Protect Selected Writer Text with a Section Password

Protect Selected Writer Text with a Section Password

Lock a specific passage against routine edits while keeping the rest of a Writer document usable, and learn when file encryption is the better choice.

Make Spreadsheet Text Readable in LibreOffice Calc Dark Mode

Make Spreadsheet Text Readable in LibreOffice Calc Dark Mode

Fix hard-to-see spreadsheet text by checking the theme, cell font color, fills, and conditional formatting in Calc.