[GH-ISSUE #5472] [Bug]: Better support for pure IPv6-only VPS: remove forced -4 in install script or add IPv6 option #3825

Closed
opened 2026-10-31 20:35:13 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @yominra on GitHub (Jun 21, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5472

Describe the bug

Title

Better support for pure IPv6-only VPS: remove forced -4 in install script or add IPv6 option

Problem

On pure IPv6-only VPS (no native IPv4 outbound connectivity), the official installation script fails because it forces IPv4 with the -4 flag:

curl -4fLR --retry 5 ... https://github.com/MHSanaei/3x-ui/releases/download/...

This results in:

curl: (28) Failed to connect to github.com port 443 after X ms: Connection timed out

Although users can manually remove -4 or use DNS64 servers, it is not beginner-friendly.

How to reproduce the problem

Please consider one of the following improvements in install.sh:

Best option: Remove the -4 flag entirely. Modern curl + DNS64 works well on IPv6-only systems.
Compatible option: Add a flag or environment variable such as:
--ipv6 parameter
XUI_IPV6_ONLY=1 environment variable
When detected (e.g. no global IPv4 address via ip -4 addr), the script should automatically avoid using -4.

This change should be applied to all curl commands that download the tar.gz, x-ui.sh, etc.
Affected Code
Main download commands in install_x-ui() function (around lines 1318 and 1335):

curl -4fLR --retry 5 --retry-delay 3 ...

Additional Recommendations
Apply the same logic to GitHub API calls for version checking.
Add a note in the README for IPv6-only users (e.g. recommend DNS64 or ghproxy mirrors).

This improvement would greatly help users on IPv6-only providers such as certain Oracle, Vultr, Hetzner, and other cloud instances.
Thank you for maintaining 3x-ui — it's currently one of the best Xray panels available!

Expected behavior

Change this line of code

curl -4fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz

to the following line.

curl -fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz

Alternatively, add a switch to enable IPv6 access.

curl -6fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz

Actual behavior

curl -4fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz

Relevant logs

I have enable test mode in bash by append "-x".
Origin command:

bash -x <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)

Running result:

+ curl -4fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
curl: (28) Failed to connect to github.com port 443 after 7523 ms: Connection timed out
Warning: Problem : timeout. Will retry in 3 seconds. 5 retries left.
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out
Warning: Problem : timeout. Will retry in 3 seconds. 4 retries left.
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
curl: (28) Failed to connect to github.com port 443 after 7501 ms: Connection timed out
Warning: Problem : timeout. Will retry in 3 seconds. 3 retries left.
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out
Warning: Problem : timeout. Will retry in 3 seconds. 2 retries left.
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out
Warning: Problem : timeout. Will retry in 3 seconds. 1 retries left.
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out
+ [[ 28 -ne 0 ]]
+ echo -e '\033[0;31mDownloading x-ui failed, please be sure that your server can access GitHub \033[0m'
Downloading x-ui failed, please be sure that your server can access GitHub 
+ exit 1

Screenshots

No response

3x-ui version

3.3.1

Xray-core version

No relationships

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 22.04

Which parts of the panel are affected?

Install / upgrade script

Browser (only if it is a UI bug)

No relationships

Is the panel behind a reverse proxy or CDN?

None

Before submitting

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
Originally created by @yominra on GitHub (Jun 21, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5472 ### Describe the bug ### Title Better support for pure IPv6-only VPS: remove forced `-4` in install script or add IPv6 option ### Problem On **pure IPv6-only** VPS (no native IPv4 outbound connectivity), the official installation script fails because it forces IPv4 with the `-4` flag: ```bash curl -4fLR --retry 5 ... https://github.com/MHSanaei/3x-ui/releases/download/... ``` This results in: ```bash curl: (28) Failed to connect to github.com port 443 after X ms: Connection timed out ``` Although users can manually remove -4 or use DNS64 servers, it is not beginner-friendly. ### How to reproduce the problem Please consider one of the following improvements in install.sh: Best option: Remove the -4 flag entirely. Modern curl + DNS64 works well on IPv6-only systems. Compatible option: Add a flag or environment variable such as: --ipv6 parameter XUI_IPV6_ONLY=1 environment variable When detected (e.g. no global IPv4 address via ip -4 addr), the script should automatically avoid using -4. This change should be applied to all curl commands that download the tar.gz, x-ui.sh, etc. Affected Code Main download commands in install_x-ui() function (around lines 1318 and 1335): ```Bash curl -4fLR --retry 5 --retry-delay 3 ... ``` Additional Recommendations Apply the same logic to GitHub API calls for version checking. Add a note in the README for IPv6-only users (e.g. recommend DNS64 or ghproxy mirrors). This improvement would greatly help users on IPv6-only providers such as certain Oracle, Vultr, Hetzner, and other cloud instances. Thank you for maintaining 3x-ui — it's currently one of the best Xray panels available! ### Expected behavior Change this line of code ```Bash curl -4fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz ``` to the following line. ```Bash curl -fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz ``` Alternatively, add a switch to enable IPv6 access. ```Bash curl -6fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz ``` ### Actual behavior ```Bash curl -4fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz ``` ### Relevant logs ```shell I have enable test mode in bash by append "-x". Origin command: bash -x <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh) Running result: + curl -4fLR --retry 5 --retry-delay 3 --connect-timeout 15 --max-time 300 -o /usr/local/x-ui-linux-amd64.tar.gz https://github.com/MHSanaei/3x-ui/releases/download/v3.3.1/x-ui-linux-amd64.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0 curl: (28) Failed to connect to github.com port 443 after 7523 ms: Connection timed out Warning: Problem : timeout. Will retry in 3 seconds. 5 retries left. 0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0 curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out Warning: Problem : timeout. Will retry in 3 seconds. 4 retries left. 0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0 curl: (28) Failed to connect to github.com port 443 after 7501 ms: Connection timed out Warning: Problem : timeout. Will retry in 3 seconds. 3 retries left. 0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0 curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out Warning: Problem : timeout. Will retry in 3 seconds. 2 retries left. 0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0 curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out Warning: Problem : timeout. Will retry in 3 seconds. 1 retries left. 0 0 0 0 0 0 0 0 --:--:-- 0:00:07 --:--:-- 0 curl: (28) Failed to connect to github.com port 443 after 7500 ms: Connection timed out + [[ 28 -ne 0 ]] + echo -e '\033[0;31mDownloading x-ui failed, please be sure that your server can access GitHub \033[0m' Downloading x-ui failed, please be sure that your server can access GitHub + exit 1 ``` ### Screenshots _No response_ ### 3x-ui version 3.3.1 ### Xray-core version No relationships ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 22.04 ### Which parts of the panel are affected? Install / upgrade script ### Browser (only if it is a UI bug) No relationships ### Is the panel behind a reverse proxy or CDN? None ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:35:13 +07:00
Author
Owner

@github-actions[bot] commented on GitHub (Jun 21, 2026):

The report is confirmed against the current source. Here is what the code actually does today:

Version fetch (install_x-ui, line 1308 of install.sh): already uses a fallback strategy — it first tries curl without -4, and only retries with -4 if the first attempt returns an empty string. On a pure IPv6-only host the first attempt may succeed, so version detection may pass.

Binary and script downloads (lines 1318, 1335, 1341, 1407, 1464, 1467, 1470 of install.sh): all still unconditionally pass -4. On a host with no global IPv4 address these calls will time out, which is exactly the failure shown in the log.

Affected curl calls in install_x-ui() and the downstream service-file download block:

curl -4fLR ... x-ui-linux-<arch>.tar.gz        # line 1318 / 1335
curl -4fLRo /usr/bin/x-ui-temp ... x-ui.sh     # line 1341
curl -4fLRo /etc/init.d/x-ui ... x-ui.rc       # line 1407
curl -4fLRo .../x-ui.service.*                  # lines 1464, 1467, 1470

Workaround until a fix is merged:

Download the installer, strip the -4 flags, then run it locally:

curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh -o install.sh
sed -i 's/curl -4f/curl -f/g; s/curl -4 -L/curl -L/g; s/curl -4fLRo/curl -fLRo/g' install.sh
bash install.sh

Verify with grep 'curl -4' install.sh that no -4 flags remain before running.

Fix: removing -4 from all download curl calls (and ideally adopting the same dual-stack-first pattern already used for the version fetch) would resolve this for IPv6-only hosts without breaking dual-stack hosts, since modern curl prefers the address family that works. A PR implementing this change would be welcome.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4762786388 --> @github-actions[bot] commented on GitHub (Jun 21, 2026): The report is confirmed against the current source. Here is what the code actually does today: **Version fetch** (`install_x-ui`, line 1308 of `install.sh`): already uses a fallback strategy — it first tries `curl` *without* `-4`, and only retries with `-4` if the first attempt returns an empty string. On a pure IPv6-only host the first attempt may succeed, so version detection may pass. **Binary and script downloads** (lines 1318, 1335, 1341, 1407, 1464, 1467, 1470 of `install.sh`): all still unconditionally pass `-4`. On a host with no global IPv4 address these calls will time out, which is exactly the failure shown in the log. Affected `curl` calls in `install_x-ui()` and the downstream service-file download block: ``` curl -4fLR ... x-ui-linux-<arch>.tar.gz # line 1318 / 1335 curl -4fLRo /usr/bin/x-ui-temp ... x-ui.sh # line 1341 curl -4fLRo /etc/init.d/x-ui ... x-ui.rc # line 1407 curl -4fLRo .../x-ui.service.* # lines 1464, 1467, 1470 ``` **Workaround until a fix is merged:** Download the installer, strip the `-4` flags, then run it locally: ```bash curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh -o install.sh sed -i 's/curl -4f/curl -f/g; s/curl -4 -L/curl -L/g; s/curl -4fLRo/curl -fLRo/g' install.sh bash install.sh ``` Verify with `grep 'curl -4' install.sh` that no `-4` flags remain before running. **Fix:** removing `-4` from all download `curl` calls (and ideally adopting the same dual-stack-first pattern already used for the version fetch) would resolve this for IPv6-only hosts without breaking dual-stack hosts, since modern `curl` prefers the address family that works. A PR implementing this change would be welcome. *This reply was generated automatically; a maintainer may follow up.*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#3825
No description provided.