Skip to content

fix(webui): force headless ozone backend on linux#1973

Merged
piorpua merged 4 commits intoiOfficeAI:mainfrom
yejiming:jimmy/2026-03-31-03-19-38
Mar 31, 2026
Merged

fix(webui): force headless ozone backend on linux#1973
piorpua merged 4 commits intoiOfficeAI:mainfrom
yejiming:jimmy/2026-03-31-03-19-38

Conversation

@yejiming
Copy link
Copy Markdown
Contributor

Pull Request

Description

This PR fixes a startup crash in Linux headless environments (e.g., Termux/proot) when launching AionUi with --webui.

Previously, headless Ozone flags were only applied when DISPLAY was missing. In some environments, DISPLAY may be present but unusable, causing Electron to still initialize the X11 platform and crash with:

  • Missing X server or $DISPLAY
  • The platform failed to initialize. Exiting.
  • Segmentation fault

What changed

  • In src/process/utils/configureChromium.ts, for Linux in --webui and --resetpass modes, always force:
    • --ozone-platform=headless
    • --disable-gpu
    • --disable-software-rasterizer

This ensures WebUI/reset-password flows do not depend on X11/Wayland availability.

Related Issues

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

  • Tested on macOS
  • Tested on Windows
  • Tested on Linux
  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • My changes generate no new warnings or errors

Screenshots

N/A (no UI visual change).

Additional Context

This change intentionally scopes to WebUI/reset-password startup paths and does not affect normal desktop window mode.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@sentry
Copy link
Copy Markdown

sentry bot commented Mar 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yejiming yejiming force-pushed the jimmy/2026-03-31-03-19-38 branch from 39a4d00 to 198248b Compare March 31, 2026 03:35
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 31, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

Code Review:fix(webui): force headless ozone backend on linux (#1973)

变更概述

本 PR 修改了 src/process/utils/configureChromium.ts 中 Linux 平台 headless Ozone 后端的启用条件:在 WebUI/resetpass 模式下,不再依赖 DISPLAY 环境变量是否存在,而是始终强制启用 --ozone-platform=headless--disable-gpu--disable-software-rasterizer。同时新增了 4 个单元测试覆盖各场景。


方案评估

结论:✅ 方案合理

方案正确解决了 PR 描述的问题——在某些 Linux 环境(如 Termux/proot)中,DISPLAY 变量存在但显示服务不可用,导致 Electron 初始化 X11 平台后崩溃。WebUI/resetpass 模式本身不需要图形显示,始终使用 headless 后端是合理的设计。变更范围精确,仅影响 WebUI/resetpass 启动路径,不影响正常桌面窗口模式。


问题清单

✅ 未发现明显问题,代码质量良好,建议批准合并。


汇总

# 严重级别 文件 问题
无问题

结论

  • 批准合并 — 变更最小且精确,逻辑正确,测试覆盖完整(Codecov 确认所有改动行均被测试覆盖),无阻塞性问题。

本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

CONCLUSION: APPROVED
IS_CRITICAL_PATH: false
PR_NUMBER: 1973

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 31, 2026

✅ 已自动 review,无阻塞性问题,正在触发自动合并。

@piorpua piorpua merged commit a5670e0 into iOfficeAI:main Mar 31, 2026
14 checks passed
@piorpua piorpua added bot:done Auto-merged by bot and removed bot:reviewing Review in progress (mutex) labels Mar 31, 2026
@kachunchan-analytics
Copy link
Copy Markdown

Hello, thanks for your prompt edit.
I have rebuild the latest edited version in to a deb and tested it. It still gives the same error.

root@localhost:~# dpkg -P AionUi
(Reading database ... 87204 files and directories currently installed.)
Removing aionui (1.9.4) ...
update-alternatives: warning: alternative /opt/AionUi/AionUi (part of link group AionUi) doesn't exist; removing from list of alternatives
update-alternatives: warning: /etc/alternatives/AionUi is dangling; it will be updated with best choice
Purging configuration files for aionui (1.9.4) ...
Processing triggers for hicolor-icon-theme (0.18-2) ...
root@localhost:~# apt purge --autoremove
Summary:
  Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 81
root@localhost:~# dpkg -i AionUi-1.9.4-linux-arm64.deb
Selecting previously unselected package aionui.
(Reading database ... 86627 files and directories currently installed.)
Preparing to unpack AionUi-1.9.4-linux-arm64.deb ...
Unpacking aionui (1.9.4) ...
Setting up aionui (1.9.4) ...
update-alternatives: using /opt/AionUi/AionUi to provide /usr/bin/AionUi (AionUi) in auto mode
Processing triggers for hicolor-icon-theme (0.18-2) ...
root@localhost:~# AionUi --no-sandbox --webui
[10861:0331/174501.584677:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
build.buildStorage global
build.buildStorage system
build.buildStorage agent.chat
build.buildStorage agent.chat.message
build.buildStorage agent.config
build.buildStorage agent.env
[CDP] Chrome DevTools Protocol disabled
17:45:11.676 › [security] Generated random CSRF secret for this session
17:45:11.710 › [ChannelBridge] Initializing...
17:45:11.715 › [ChannelBridge] Initialized
17:45:17.500 › [ShellEnv-Diag] platform=linux, arch=arm64, node=v22.21.1
17:45:17.509 › [ShellEnv-Diag] process.env.PATH (first 300): /opt/AionUi:/root/.cargo/bin:/root/.bun/bin:/root/.local/bin:/root/.nvm/versions/node/v24.11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/data/data/com.termux/files/usr/bin:/system/bin:/system/xbin:/root/.dotnet/tools
17:45:18.376 › [Database] Schema initialized successfully
[10861:0331/174518.420317:ERROR:ui/ozone/platform/x11/ozone_platform_x11.cc:250] Missing X server or $DISPLAY
[10861:0331/174518.420535:ERROR:ui/aura/env.cc:257] The platform failed to initialize.  Exiting.
Segmentation fault

@yejiming yejiming deleted the jimmy/2026-03-31-03-19-38 branch March 31, 2026 10:29
@yejiming
Copy link
Copy Markdown
Contributor Author

Hello, thanks for your prompt edit. I have rebuild the latest edited version in to a deb and tested it. It still gives the same error.

root@localhost:~# dpkg -P AionUi
(Reading database ... 87204 files and directories currently installed.)
Removing aionui (1.9.4) ...
update-alternatives: warning: alternative /opt/AionUi/AionUi (part of link group AionUi) doesn't exist; removing from list of alternatives
update-alternatives: warning: /etc/alternatives/AionUi is dangling; it will be updated with best choice
Purging configuration files for aionui (1.9.4) ...
Processing triggers for hicolor-icon-theme (0.18-2) ...
root@localhost:~# apt purge --autoremove
Summary:
  Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 81
root@localhost:~# dpkg -i AionUi-1.9.4-linux-arm64.deb
Selecting previously unselected package aionui.
(Reading database ... 86627 files and directories currently installed.)
Preparing to unpack AionUi-1.9.4-linux-arm64.deb ...
Unpacking aionui (1.9.4) ...
Setting up aionui (1.9.4) ...
update-alternatives: using /opt/AionUi/AionUi to provide /usr/bin/AionUi (AionUi) in auto mode
Processing triggers for hicolor-icon-theme (0.18-2) ...
root@localhost:~# AionUi --no-sandbox --webui
[10861:0331/174501.584677:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
build.buildStorage global
build.buildStorage system
build.buildStorage agent.chat
build.buildStorage agent.chat.message
build.buildStorage agent.config
build.buildStorage agent.env
[CDP] Chrome DevTools Protocol disabled
17:45:11.676 › [security] Generated random CSRF secret for this session
17:45:11.710 › [ChannelBridge] Initializing...
17:45:11.715 › [ChannelBridge] Initialized
17:45:17.500 › [ShellEnv-Diag] platform=linux, arch=arm64, node=v22.21.1
17:45:17.509 › [ShellEnv-Diag] process.env.PATH (first 300): /opt/AionUi:/root/.cargo/bin:/root/.bun/bin:/root/.local/bin:/root/.nvm/versions/node/v24.11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/data/data/com.termux/files/usr/bin:/system/bin:/system/xbin:/root/.dotnet/tools
17:45:18.376 › [Database] Schema initialized successfully
[10861:0331/174518.420317:ERROR:ui/ozone/platform/x11/ozone_platform_x11.cc:250] Missing X server or $DISPLAY
[10861:0331/174518.420535:ERROR:ui/aura/env.cc:257] The platform failed to initialize.  Exiting.
Segmentation fault

Let me double-check this.

@kachunchan-analytics
Copy link
Copy Markdown

Currently doing this works:
xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" AionUi --webui --no-sandbox

root@localhost:~# xvfb-run --auto-servernum --server-args="-screen 0 1920x1080x24" AionUi --webui --no-sandbox
[6605:0401/111629.521961:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
build.buildStorage global
build.buildStorage system
build.buildStorage agent.chat
build.buildStorage agent.chat.message
build.buildStorage agent.config
build.buildStorage agent.env
[CDP] Chrome DevTools Protocol disabled
11:16:39.692 › [security] Generated random CSRF secret for this session
11:16:39.719 › [ChannelBridge] Initializing...
11:16:39.722 › [ChannelBridge] Initialized
11:16:45.672 › [ShellEnv-Diag] platform=linux, arch=arm64, node=v22.21.1
11:16:45.675 › [ShellEnv-Diag] process.env.PATH (first 300): /opt/AionUi:/root/.cargo/bin:/root/.bun/bin:/root/.local/bin:/root/.nvm/versions/node/v24.11.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games:/data/data/com.termux/files/usr/bin:/system/bin:/system/xbin:/root/.dotnet/tools
11:16:46.465 › [Database] Schema initialized successfully
[6605:0401/111647.640399:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[6605:0401/111647.642002:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[6605:0401/111647.700441:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[6605:0401/111647.700776:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[6605:0401/111647.700912:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[6605:0401/111647.701231:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[6605:0401/111647.703045:ERROR:dbus/object_proxy.cc:590] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type:
[6605:0401/111647.767525:ERROR:content/browser/zygote_host/zygote_host_impl_linux.cc:283] Failed to adjust OOM score of renderer with pid 6902: Permission denied (13)
[6605:0401/111647.790382:ERROR:device/udev_linux/udev_watcher.cc:51] Failed to initialize a udev monitor.
11:16:49.143 › [AionUi:ready] start +0ms
11:16:49.155 › [AionUi:init] start +0ms
11:16:49.163 › [AionUi:init] 1. migrateLegacyData +9ms
11:16:49.177 › [AionUi:init] 3. storage interceptors +22ms
11:16:49.291 › [AionUi:init] 4. MCP config +137ms
11:16:56.436 › [AionUi:init] 5.1 initBuiltinAssistantRules +7281ms
11:16:56.527 › [AionUi:init] 5.2 assistant config + migrations +7372ms
11:16:56.543 › [AionUi:init] 6. database +7389ms
11:16:56.550 › [AionUi:init] done +7395ms
11:16:56.556 › [AionUi:process] initStorage +7403ms
11:16:56.568 › [Extensions] Initializing extension registry...
11:16:56.619 › [Extensions] Registry initialized in 42ms: 0 extension(s), 0 adapter(s), 0 MCP server(s), 0 assistant(s), 0 agent(s), 0 skill(s), 0 theme(s), 0 channel plugin(s), 0 webui contribution(s), 0 settings tab(s), 0 model provider(s), 0 i18n locale(s)
11:16:56.622 › [AionUi:process] ExtensionRegistry +7470ms
11:16:56.626 › [ChannelManager] Initializing...
11:16:56.634 › [ChannelManager] Initialized successfully
11:16:56.635 › [AionUi:process] ChannelManager +7483ms
11:16:56.636 › [AionUi:ready] initializeProcess +7493ms
11:16:56.648 › [AionUi:ready] initializeZoomFactor +7505ms
11:16:56.662 › [WebUI] Serving renderer from: /opt/AionUi/resources/app.asar/out/renderer
11:16:56.678 ›
   🚀 WebUI started / WebUI 已启动: http://localhost:25808

11:16:56.679 › [WebSocketManager] Initialized
11:16:56.680 › [ACP] Starting agent detection...
11:17:01.701 › [ShellEnv] Failed to load shell environment: spawnSync /bin/bash ETIMEDOUT
11:17:03.888 › [ACP] Detection completed in 7207ms, found 14 agents
[6605:0401/111703.900048:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[6605:0401/111703.902815:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[6605:0401/111703.905218:ERROR:dbus/bus.cc:408] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory

Workaround resource usage:

root@localhost:~# top -b | grep -E 'xvfb-run|Xvfb'
  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
 6551 root      10 -10    2404   1528   1408 S   0.0   0.0   0:00.04 xvfb-run
 6600 root      10 -10  182900  64376  45700 S   0.0   1.1   0:00.35 Xvfb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Unable to launch in Termux Server

4 participants