mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5299] [Bug]: Custom geofiles and routing rules causes xray fail on panel update #3710
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3710
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 @ilya-practicum on GitHub (Jun 13, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5299
Describe the bug
If you run 3x-ui in docker and add rules with custom geofiles ext:geosite_custom.dat, for example. Then on next panel update xray will fail with error:
ERROR - XRAY: Failed to start: main: failed to load config files: [bin/config.json] > infra/conf: failed to build routing configuration > infra/conf: invalid field rule > common/geodata: illegal domain rule: ext:geosite_custom.dat:win-spy > common/geodata: failed to open geosite_custom.dat > stat /app/bin/geosite_custom.dat: no such file or directoryIf you mount that file via volumes, then 3x-ui runs fine but that geofile will never be updated because of this error:
XRAY: app/geodata: scheduled geodata reload failed > multierr: rename /app/bin/geosite_custom.dat /app/bin/.geosite_custom.dat.888306995.bak: device or resource busy |If you mount the whole folder, then xray will fail on start up with error:
Failure in running xray-core process: fork/exec bin/xray-linux-amd64: no such file or directoryMay I ask to move custom geofiles to other folder, not bin. Then you will be able to mount that folder as volume and update files smoothly
How to reproduce the problem
Expected behavior
No response
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.3.1
Xray-core version
No response
How did you install 3x-ui?
Docker / Docker Compose
Operating system
Debian 13
Which parts of the panel are affected?
Docker image
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jun 13, 2026):
The report is accurate. All three failure modes trace to the same root cause: the Xray binary and all geodata files share a single directory (
/app/bin/by default), which is not mounted as a Docker volume.Why each failure happens
Problem 1 — custom geofile lost on update
The
Dockerfiledeclares only one volume:/app/bin/is an ordinary image layer, not a volume. Whendocker compose pull && up -drecreates the container from the new image, any file you had placed in/app/bin/in the old container is gone. The routing rules stored in the database (/etc/x-ui/x-ui.db, which IS persisted) still referenceext:geosite_custom.dat, so xray-core fails to start.Problem 2 — bind-mounting a single file blocks xray-core's geodata reload
Bind-mounting a single file (
./geosite_custom.dat:/app/bin/geosite_custom.dat) makes that path a bind-mount point in the container's mount namespace. The Linuxrename(2)syscall returnsEBUSYwhen the source path is a mount point. xray-core's internal scheduled geodata reload uses an atomic rename (to a.bakpath) before replacing the file, so it fails with the error you see.Problem 3 — mounting the whole bin directory hides the binary
/app/bin/contains both the xray binary (xray-linux-amd64) and all geodata files (confirmed inDockerInit.sh). Mounting an empty host directory at/app/bin/shadows the image's bin directory entirely, leaving no binary to execute.Workaround available without code changes
xray-core reads the
XRAY_LOCATION_ASSETenvironment variable to resolve geodata files (geosite.dat,geoip.dat, andext:…custom files). The panel sets this to the bin folder path at startup only if it is not already present in the environment (internal/xray/api.go:380–387). This means you can override it from docker-compose.Add a host directory mapped inside the existing
/etc/x-uivolume and setXRAY_LOCATION_ASSETto it:Then on the host:
After
docker compose up -d, xray-core will resolve allext:…rules from/etc/x-ui/geo/, which survives container recreation. Since that directory is a plain directory bind-mount (not a single-file bind-mount), xray-core's rename-based geodata reload will not hitEBUSY.Caveat: the panel's built-in "Update Geo Files" button/API (
POST /server/updateGeofile) still downloads the standard files to/app/bin/(internal/web/service/server.go:1585), which will differ fromXRAY_LOCATION_ASSET. You will need to refresh the standard files manually (or by copying from/app/bin/as above) until the panel's update logic is made aware ofXRAY_LOCATION_ASSET.Enhancement request
Separating the geodata directory from the binary directory (either by honouring
XRAY_LOCATION_ASSETinUpdateGeofile, or by introducing a dedicatedXUI_GEO_FOLDERenv var that maps to a path that can be independently volume-mounted) would make this use case straightforward and would alignUpdateGeofilewith however xray-core actually resolves assets. Tracking this as an enhancement alongside the bug label.This reply was generated automatically; a maintainer may follow up.