mirror of
https://github.com/MrTheory/os-xray.git
synced 2026-11-05 00:27:59 +00:00
[GH-ISSUE #20] auto-imported config never starts: outbound_config field left empty by install.sh #14
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MrTheory/os-xray#14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tqb333 on GitHub (Aug 1, 2026).
Original GitHub issue: https://github.com/MrTheory/os-xray/issues/20
install.sh auto-import (
import_existing_config()) populates wizard display fields but notoutbound_config, so the imported instance fails to startEnvironment: OPNsense 26.7.1 (FreeBSD 15.1 amd64), os-xray v3.0.0, tun2socks v2.7.0, xray-core v26.3.27
Description
When
install.shdetects a pre-existingxray-core/tun2socksconfig on disk (detect_existing()) and imports it (import_existing_config()), it writes individual instance fields toconfig.xml:server_address,server_port,vless_uuid,flow,reality_sni,reality_pubkey,reality_shortid,reality_fingerprint,socks5_port,tun_interface,mtu,config_mode=wizard. These display correctly in the GUI's Instance tab afterward.However,
xray-service-control.php'sxray_write_config()builds the actual runtimeoutboundblock entirely from a separate field,outbound_config(a serialized JSON string of the full Xray outbound object — protocol/settings/streamSettings) — a fieldimport_existing_config()never writes. Presumably this field is normally populated by the GUI controller's own save/serialize logic when a user submits the Instance form, which the CLI import path bypasses entirely.Result: starting an auto-imported instance fails silently from the user's point of view:
even though every field looks correctly populated in the GUI.
Steps to reproduce
xray-coreconfig.json(vless+reality outbound) at/usr/local/etc/xray-core/config.jsonand a matchingtun2socksconfig.yamlat/usr/local/tun2socks/config.yamlbefore runninginstall.shon a fresh install.install.sh— it correctly detects and reports the existing config ([FOUND] Existing xray/tun2socks config detected: ...), and the GUI Instance tab shows all fields populated.Workaround that confirms root cause
Manually adding
<outbound_config>{"protocol":"vless","settings":{...},"streamSettings":{...}}</outbound_config>(the same object asconfig.json'soutbounds[0]) directly to the instance inconfig.xmlmakes the instance start immediately, with no other changes.Suggested fix
Either have
import_existing_config()also construct and writeoutbound_configfrom the detected values (mirroring whatever the GUI's own save logic does), or havexray_write_config()fall back to building the outbound object from the individual wizard fields whenoutbound_configis empty.